• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/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    "mock_custom_func.cpp",
44    "mock_system_func.cpp",
45  ]
46
47  include_dirs = [
48    "//third_party/googletest/googlemock/include",
49    "$DHCP_ROOT_DIR/services/dhcp_client/test",
50    "$DHCP_ROOT_DIR/services/dhcp_client/include",
51    "$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/log",
52    "//commonlibrary/c_utils/base/include",
53    "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include",
54    "//third_party/openssl/include",
55  ]
56
57  deps = [
58    "//third_party/googletest:gmock_main",
59    "//third_party/googletest:gtest_main",
60    "//third_party/openssl:libcrypto_shared",
61  ]
62
63  ldflags = [
64    "-fPIC",
65    "-Wl,-E",
66    "--coverage",
67    "-Wl,-rpath=/vendor/lib64/hw",
68    "-Wl,--wrap=open",
69    "-Wl,--wrap=close",
70    "-Wl,--wrap=write",
71    "-Wl,--wrap=read",
72    "-Wl,--wrap=socket",
73    "-Wl,--wrap=setsockopt",
74    "-Wl,--wrap=ioctl",
75    "-Wl,--wrap=bind",
76    "-Wl,--wrap=listen",
77    "-Wl,--wrap=connect",
78    "-Wl,--wrap=select",
79    "-Wl,--wrap=sendto",
80    "-Wl,--wrap=GetDhcpRawPacket",
81    "-Wl,--wrap=GetDhcpKernelPacket",
82    "-Wl,--wrap=GetSelectRet",
83  ]
84
85  external_deps = [
86    "ability_base:want",
87    "bundle_framework:appexecfwk_base",
88    "c_utils:utils",
89    "common_event_service:cesfwk_innerkits",
90    "eventhandler:libeventhandler",
91    "hilog:libhilog",
92  ]
93  configs = [ ":module_private_config" ]
94
95  part_name = "dhcp"
96  subsystem_name = "communication"
97  testonly = true
98}
99
100group("unittest") {
101  testonly = true
102  deps = [ ":dhcp_client_unittest" ]
103}
104