• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2021-2023 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
17module_output_path = "dhcp/dhcp_client_test"
18
19config("module_private_config") {
20  visibility = [ ":*" ]
21  include_dirs = [ "$DHCP_ROOT_DIR/services/dhcp_client/include" ]
22}
23
24ohos_unittest("dhcp_client_unittest") {
25  module_out_path = module_output_path
26  sources = [
27    "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_client_callback_proxy.cpp",
28    "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_client_death_recipient.cpp",
29    "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_client_service_impl.cpp",
30    "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_client_state_machine.cpp",
31    "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_client_stub.cpp",
32    "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_function.cpp",
33    "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_ipv6_client.cpp",
34    "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_ipv6_event.cpp",
35    "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_options.cpp",
36    "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_result.cpp",
37    "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_socket.cpp",
38    "dhcp_client_callback_proxy_test.cpp",
39    "dhcp_client_death_recipient_test.cpp",
40    "dhcp_client_service_impl_test.cpp",
41    "dhcp_client_state_machine_test.cpp",
42    "dhcp_client_stub_test.cpp",
43    "dhcp_client_test.cpp",
44    "dhcp_function_test.cpp",
45    "dhcp_ipv6_client_test.cpp",
46    "dhcp_options_test.cpp",
47    "dhcp_result_test.cpp",
48    "dhcp_socket_test.cpp",
49    "mock_custom_func.cpp",
50    "mock_system_func.cpp",
51  ]
52
53  include_dirs = [
54    "//third_party/openssl/include",
55    "$DHCP_ROOT_DIR/frameworks/native/include",
56    "$DHCP_ROOT_DIR/frameworks/native/interfaces",
57    "$DHCP_ROOT_DIR/frameworks/native/src",
58    "$DHCP_ROOT_DIR/frameworks/native/c_adapter/inc",
59    "$DHCP_ROOT_DIR/interfaces",
60    "$DHCP_ROOT_DIR/interfaces/inner_api",
61    "$DHCP_ROOT_DIR/interfaces/inner_api/include",
62    "$DHCP_ROOT_DIR/interfaces/kits/c",
63    "$DHCP_ROOT_DIR/services",
64    "$DHCP_ROOT_DIR/services/dhcp_client/include",
65    "$DHCP_ROOT_DIR/services/dhcp_server/include",
66  ]
67
68  deps = [
69    "//third_party/googletest:gmock_main",
70    "//third_party/googletest:gtest_main",
71    "//third_party/openssl:libcrypto_shared",
72  ]
73
74  ldflags = [
75    "-fPIC",
76    "-Wl,-E",
77    "--coverage",
78    "-Wl,-rpath=/vendor/lib64/hw",
79    "-Wl,--wrap=open",
80    "-Wl,--wrap=close",
81    "-Wl,--wrap=write",
82    "-Wl,--wrap=read",
83    "-Wl,--wrap=socket",
84    "-Wl,--wrap=setsockopt",
85    "-Wl,--wrap=ioctl",
86    "-Wl,--wrap=bind",
87    "-Wl,--wrap=listen",
88    "-Wl,--wrap=connect",
89    "-Wl,--wrap=select",
90    "-Wl,--wrap=sendto",
91    "-Wl,--wrap=socketpair",
92    "-Wl,--wrap=GetDhcpRawPacket",
93    "-Wl,--wrap=GetDhcpKernelPacket",
94    "-Wl,--wrap=GetSelectRet",
95  ]
96
97  cflags_cc = [ "-Wno-unused-variable" ]
98
99  external_deps = [
100    "access_token:libaccesstoken_sdk",
101    "access_token:libtokenid_sdk",
102    "c_utils:utils",
103    "hilog:libhilog",
104    "ipc:ipc_single",
105    "safwk:system_ability_fwk",
106    "samgr:samgr_proxy",
107  ]
108
109  configs = [ ":module_private_config" ]
110
111  defines = [
112    "private = public",
113    "protected = public",
114  ]
115
116  part_name = "dhcp"
117  subsystem_name = "communication"
118  testonly = true
119}
120
121group("unittest") {
122  testonly = true
123  deps = [ ":dhcp_client_unittest" ]
124}
125