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 17module_output_path = "dhcp/dhcp_server_test" 18 19config("module_private_config") { 20 visibility = [ ":*" ] 21 include_dirs = [ 22 "//commonlibrary/c_utils/base/include", 23 "$DHCP_ROOT_DIR/services/dhcp_server/include", 24 ] 25} 26 27ohos_unittest("dhcp_server_unittest") { 28 module_out_path = module_output_path 29 dhcp_hilog_enable = true 30 sources = [ 31 "$DHCP_ROOT_DIR/services/dhcp_server/src/address_utils.c", 32 "$DHCP_ROOT_DIR/services/dhcp_server/src/common_util.c", 33 "$DHCP_ROOT_DIR/services/dhcp_server/src/dhcp_address_pool.c", 34 "$DHCP_ROOT_DIR/services/dhcp_server/src/dhcp_argument.c", 35 "$DHCP_ROOT_DIR/services/dhcp_server/src/dhcp_binding.c", 36 "$DHCP_ROOT_DIR/services/dhcp_server/src/dhcp_config.c", 37 "$DHCP_ROOT_DIR/services/dhcp_server/src/dhcp_option.c", 38 "$DHCP_ROOT_DIR/services/dhcp_server/src/dhcp_server.c", 39 "$DHCP_ROOT_DIR/services/dhcp_server/src/hash_table.c", 40 "address_utils_test.cpp", 41 "common_util_test.cpp", 42 "dhcp_address_pool_test.cpp", 43 "dhcp_argument_test.cpp", 44 "dhcp_binding_test.cpp", 45 "dhcp_config_test.cpp", 46 "dhcp_message_sim.cpp", 47 "dhcp_option_test.cpp", 48 "dhcp_server_test.cpp", 49 "hash_table_test.cpp", 50 "system_func_mock.cpp", 51 ] 52 53 include_dirs = [ 54 "//commonlibrary/c_utils/base/include", 55 "//third_party/googletest/googlemock/include", 56 "//base/hiviewdfx/hilog/interfaces/native/innerkits/include", 57 "$DHCP_ROOT_DIR/services/dhcp_server/include", 58 ] 59 60 cflags = [] 61 62 deps = [ 63 "//third_party/googletest:gmock_main", 64 "//third_party/googletest:gtest_main", 65 ] 66 67 external_deps = [ "c_utils:utils" ] 68 69 ldflags = [ 70 "-fPIC", 71 "-Wl,-E", 72 "-Wl,--wrap=socket", 73 "-Wl,--wrap=setsockopt", 74 "-Wl,--wrap=select", 75 "-Wl,--wrap=bind", 76 "-Wl,--wrap=close", 77 "--coverage", 78 ] 79 80 configs = [ ":module_private_config" ] 81 82 defines = [ "DHCP_SEL_WAIT_TIMEOUTS=1" ] 83 84 if (dhcp_hilog_enable) { 85 external_deps += [ "hiviewdfx_hilog_native:libhilog" ] 86 defines += [ "DHCP_HILOG_ENABLE" ] 87 } 88 89 part_name = "dhcp" 90 subsystem_name = "communication" 91 testonly = true 92} 93 94group("unittest") { 95 testonly = true 96 deps = [ ":dhcp_server_unittest" ] 97} 98