1# Copyright (C) 2021-2022 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//build/test.gni") 15import("//foundation/communication/wifi/dhcp/dhcp.gni") 16 17################################################################################ 18 19module_output_path = "dhcp/dhcp_client_test" 20 21config("module_private_config") { 22 visibility = [ ":*" ] 23 include_dirs = [ 24 "//commonlibrary/c_utils/base/include", 25 "$DHCP_ROOT_DIR/services/dhcp_client/include", 26 ] 27} 28 29ohos_unittest("dhcp_client_unittest") { 30 module_out_path = module_output_path 31 sources = [ 32 "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_api.cpp", 33 "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_client.c", 34 "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_function.c", 35 "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_ipv4.c", 36 "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_options.c", 37 "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_socket.c", 38 "dhcp_client_test.cpp", 39 "dhcp_function_test.cpp", 40 "dhcp_ipv4_test.cpp", 41 "dhcp_options_test.cpp", 42 "dhcp_socket_test.cpp", 43 "global_test.cpp", 44 "mock_custom_func.cpp", 45 "mock_system_func.cpp", 46 ] 47 48 include_dirs = [ 49 "//third_party/googletest/googlemock/include", 50 "$DHCP_ROOT_DIR/services/dhcp_client/test", 51 "$DHCP_ROOT_DIR/services/dhcp_client/include", 52 "$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/log", 53 "//commonlibrary/c_utils/base/include", 54 "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include", 55 "//third_party/openssl/include", 56 ] 57 58 deps = [ 59 "//third_party/googletest:gmock_main", 60 "//third_party/googletest:gtest_main", 61 "//third_party/openssl:libcrypto_shared", 62 ] 63 64 ldflags = [ 65 "-fPIC", 66 "-Wl,-E", 67 "--coverage", 68 "-Wl,-rpath=/vendor/lib64/hw", 69 "-Wl,--wrap=open", 70 "-Wl,--wrap=close", 71 "-Wl,--wrap=write", 72 "-Wl,--wrap=read", 73 "-Wl,--wrap=socket", 74 "-Wl,--wrap=setsockopt", 75 "-Wl,--wrap=ioctl", 76 "-Wl,--wrap=bind", 77 "-Wl,--wrap=listen", 78 "-Wl,--wrap=connect", 79 "-Wl,--wrap=select", 80 "-Wl,--wrap=sendto", 81 "-Wl,--wrap=GetDhcpRawPacket", 82 "-Wl,--wrap=GetDhcpKernelPacket", 83 "-Wl,--wrap=GetSelectRet", 84 ] 85 86 external_deps = [ 87 "ability_base:want", 88 "bundle_framework:appexecfwk_base", 89 "c_utils:utils", 90 "common_event_service:cesfwk_innerkits", 91 "eventhandler:libeventhandler", 92 "hiviewdfx_hilog_native:libhilog", 93 ] 94 configs = [ ":module_private_config" ] 95 96 part_name = "dhcp" 97 subsystem_name = "communication" 98 testonly = true 99} 100 101group("unittest") { 102 testonly = true 103 deps = [ ":dhcp_client_unittest" ] 104} 105