1518678f8Sopenharmony_ci# Copyright (C) 2024 Huawei Device Co., Ltd. 2518678f8Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 3518678f8Sopenharmony_ci# you may not use this file except in compliance with the License. 4518678f8Sopenharmony_ci# You may obtain a copy of the License at 5518678f8Sopenharmony_ci# 6518678f8Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 7518678f8Sopenharmony_ci# 8518678f8Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software 9518678f8Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 10518678f8Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11518678f8Sopenharmony_ci# See the License for the specific language governing permissions and 12518678f8Sopenharmony_ci# limitations under the License. 13518678f8Sopenharmony_ci 14518678f8Sopenharmony_ciimport("//build/test.gni") 15518678f8Sopenharmony_ciimport("//foundation/communication/dhcp/dhcp.gni") 16518678f8Sopenharmony_ci 17518678f8Sopenharmony_cimodule_output_path = "dhcp/dhcp_util_test" 18518678f8Sopenharmony_ci 19518678f8Sopenharmony_ciohos_unittest("dhcp_util_unittest") { 20518678f8Sopenharmony_ci module_out_path = module_output_path 21518678f8Sopenharmony_ci 22518678f8Sopenharmony_ci sources = [ 23518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_client_callback_proxy.cpp", 24518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_client_death_recipient.cpp", 25518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_client_service_impl.cpp", 26518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_client_state_machine.cpp", 27518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_client_stub.cpp", 28518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_function.cpp", 29518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_ipv6_client.cpp", 30518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_ipv6_event.cpp", 31518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_options.cpp", 32518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_result.cpp", 33518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_result_store_manager.cpp", 34518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_socket.cpp", 35518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_thread.cpp", 36518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/utils/src/dhcp_arp_checker.cpp", 37518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/utils/src/dhcp_common_utils.cpp", 38518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/test/unittest/services/dhcp_client/mock_custom_func.cpp", 39518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/test/unittest/services/dhcp_client/mock_system_func.cpp", 40518678f8Sopenharmony_ci "dhcp_arp_checker_test.cpp", 41518678f8Sopenharmony_ci "dhcp_common_utils_test.cpp", 42518678f8Sopenharmony_ci "dhcp_permission_utils_test.cpp", 43518678f8Sopenharmony_ci "dhcp_system_timer_test.cpp", 44518678f8Sopenharmony_ci ] 45518678f8Sopenharmony_ci 46518678f8Sopenharmony_ci include_dirs = [ 47518678f8Sopenharmony_ci "//third_party/openssl/include", 48518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/frameworks/native/include", 49518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/frameworks/native/interfaces", 50518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/frameworks/native/src", 51518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/frameworks/native/c_adapter/inc", 52518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/interfaces", 53518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/interfaces/inner_api", 54518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/interfaces/inner_api/include", 55518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/interfaces/kits/c", 56518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services", 57518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/include", 58518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_server/include", 59518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/utils/include", 60518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/test/unittest/services/dhcp_client", 61518678f8Sopenharmony_ci ] 62518678f8Sopenharmony_ci 63518678f8Sopenharmony_ci deps = [ 64518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/utils:dhcp_utils", 65518678f8Sopenharmony_ci "//third_party/googletest:gmock_main", 66518678f8Sopenharmony_ci "//third_party/googletest:gtest_main", 67518678f8Sopenharmony_ci "//third_party/openssl:libcrypto_shared", 68518678f8Sopenharmony_ci ] 69518678f8Sopenharmony_ci 70518678f8Sopenharmony_ci ldflags = [ 71518678f8Sopenharmony_ci "-fPIC", 72518678f8Sopenharmony_ci "-Wl,-E", 73518678f8Sopenharmony_ci "--coverage", 74518678f8Sopenharmony_ci "-Wl,-rpath=/vendor/lib64/hw", 75518678f8Sopenharmony_ci "-Wl,--wrap=open", 76518678f8Sopenharmony_ci "-Wl,--wrap=close", 77518678f8Sopenharmony_ci "-Wl,--wrap=write", 78518678f8Sopenharmony_ci "-Wl,--wrap=read", 79518678f8Sopenharmony_ci "-Wl,--wrap=socket", 80518678f8Sopenharmony_ci "-Wl,--wrap=setsockopt", 81518678f8Sopenharmony_ci "-Wl,--wrap=ioctl", 82518678f8Sopenharmony_ci "-Wl,--wrap=bind", 83518678f8Sopenharmony_ci "-Wl,--wrap=listen", 84518678f8Sopenharmony_ci "-Wl,--wrap=connect", 85518678f8Sopenharmony_ci "-Wl,--wrap=select", 86518678f8Sopenharmony_ci "-Wl,--wrap=sendto", 87518678f8Sopenharmony_ci "-Wl,--wrap=socketpair", 88518678f8Sopenharmony_ci "-Wl,--wrap=GetDhcpRawPacket", 89518678f8Sopenharmony_ci "-Wl,--wrap=GetDhcpKernelPacket", 90518678f8Sopenharmony_ci "-Wl,--wrap=GetSelectRet", 91518678f8Sopenharmony_ci ] 92518678f8Sopenharmony_ci 93518678f8Sopenharmony_ci cflags_cc = [ "-Wno-unused-variable" ] 94518678f8Sopenharmony_ci 95518678f8Sopenharmony_ci external_deps = [ 96518678f8Sopenharmony_ci "ability_runtime:wantagent_innerkits", 97518678f8Sopenharmony_ci "access_token:libaccesstoken_sdk", 98518678f8Sopenharmony_ci "access_token:libtokenid_sdk", 99518678f8Sopenharmony_ci "c_utils:utils", 100518678f8Sopenharmony_ci "hilog:libhilog", 101518678f8Sopenharmony_ci "ipc:ipc_single", 102518678f8Sopenharmony_ci "netmanager_base:net_native_manager_if", 103518678f8Sopenharmony_ci "netmanager_base:netsys_controller", 104518678f8Sopenharmony_ci "safwk:system_ability_fwk", 105518678f8Sopenharmony_ci "samgr:samgr_proxy", 106518678f8Sopenharmony_ci "time_service:time_client", 107518678f8Sopenharmony_ci ] 108518678f8Sopenharmony_ci 109518678f8Sopenharmony_ci defines = [ 110518678f8Sopenharmony_ci "private = public", 111518678f8Sopenharmony_ci "protected = public", 112518678f8Sopenharmony_ci "VENDOR_NAME_PREFIX=\"$VENDOR_NAME\"", 113518678f8Sopenharmony_ci "DEFAULT_IPV4_DNS_PRI=\"$IPV4_DNS_PRI\"", 114518678f8Sopenharmony_ci "DEFAULT_IPV4_DNS_SEC=\"$IPV4_DNS_SEC\"", 115518678f8Sopenharmony_ci ] 116518678f8Sopenharmony_ci 117518678f8Sopenharmony_ci if (defined(global_parts_info) && 118518678f8Sopenharmony_ci defined(global_parts_info.resourceschedule_ffrt)) { 119518678f8Sopenharmony_ci external_deps += [ "ffrt:libffrt" ] 120518678f8Sopenharmony_ci defines += [ "DHCP_FFRT_ENABLE" ] 121518678f8Sopenharmony_ci } 122518678f8Sopenharmony_ci 123518678f8Sopenharmony_ci part_name = "dhcp" 124518678f8Sopenharmony_ci subsystem_name = "communication" 125518678f8Sopenharmony_ci testonly = true 126518678f8Sopenharmony_ci} 127