# Copyright (C) 2021-2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//build/test.gni") import("//foundation/communication/dhcp/dhcp.gni") ################################################################################ module_output_path = "dhcp/dhcp_client_test" config("module_private_config") { visibility = [ ":*" ] include_dirs = [ "//commonlibrary/c_utils/base/include", "$DHCP_ROOT_DIR/services/dhcp_client/include", ] } ohos_unittest("dhcp_client_unittest") { module_out_path = module_output_path sources = [ "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_api.cpp", "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_client.c", "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_function.c", "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_ipv4.c", "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_options.c", "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_socket.c", "dhcp_client_test.cpp", "dhcp_function_test.cpp", "dhcp_ipv4_test.cpp", "dhcp_options_test.cpp", "dhcp_socket_test.cpp", "mock_custom_func.cpp", "mock_system_func.cpp", ] include_dirs = [ "//third_party/googletest/googlemock/include", "$DHCP_ROOT_DIR/services/dhcp_client/test", "$DHCP_ROOT_DIR/services/dhcp_client/include", "$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/log", "//commonlibrary/c_utils/base/include", "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include", "//third_party/openssl/include", ] deps = [ "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", "//third_party/openssl:libcrypto_shared", ] ldflags = [ "-fPIC", "-Wl,-E", "--coverage", "-Wl,-rpath=/vendor/lib64/hw", "-Wl,--wrap=open", "-Wl,--wrap=close", "-Wl,--wrap=write", "-Wl,--wrap=read", "-Wl,--wrap=socket", "-Wl,--wrap=setsockopt", "-Wl,--wrap=ioctl", "-Wl,--wrap=bind", "-Wl,--wrap=listen", "-Wl,--wrap=connect", "-Wl,--wrap=select", "-Wl,--wrap=sendto", "-Wl,--wrap=GetDhcpRawPacket", "-Wl,--wrap=GetDhcpKernelPacket", "-Wl,--wrap=GetSelectRet", ] external_deps = [ "ability_base:want", "bundle_framework:appexecfwk_base", "c_utils:utils", "common_event_service:cesfwk_innerkits", "eventhandler:libeventhandler", "hilog:libhilog", ] configs = [ ":module_private_config" ] part_name = "dhcp" subsystem_name = "communication" testonly = true } group("unittest") { testonly = true deps = [ ":dhcp_client_unittest" ] }