1# Copyright (c) 2021-2024 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/netmanager_ext/netmanager_ext_config.gni")
16
17EXT_SECURITY_PATH = "../../.."
18
19ohos_unittest("ethernet_manager_test") {
20  sanitize = {
21    cfi = true
22    cfi_cross_dso = true
23    blocklist = "./cfi_blocklist.txt"
24    debug = false
25  }
26
27  branch_protector_ret = "pac_ret"
28
29  module_out_path = "netmanager_ext/ethernet_manager_test"
30
31  sources = [
32    "$EXT_SECURITY_PATH/security/netmanager_ext_test_security.cpp",
33    "dev_interface_state_test.cpp",
34    "ethernet_configuration_test.cpp",
35    "ethernet_lan_management_test.cpp",
36    "ethernet_manager_test.cpp",
37    "ethernet_service_proxy_test.cpp",
38    "ethernet_service_stub_test.cpp",
39    "ethernet_service_test.cpp",
40  ]
41
42  include_dirs = [
43    "$EXT_INNERKITS_ROOT/include",
44    "$EXT_INNERKITS_ROOT/ethernetclient/include",
45    "$EXT_INNERKITS_ROOT/ethernetclient/include/proxy",
46    "$EXT_SECURITY_PATH/security",
47    "$ETHERNETMANAGER_SOURCE_DIR/include",
48    "$BASE_INNERKITS_ROOT/netconnclient/include",
49    "$ETHERNETMANAGER_SOURCE_DIR/include/stub",
50    "$BASE_INNERKITS_ROOT/netconnclient/include",
51    "$NETSYSCONTROLLER_ROOT_DIR/include",
52    "$NETCONNMANAGER_COMMON_DIR/include",
53  ]
54
55  deps = [
56    "$BASE_INNERKITS_ROOT/netconnclient:net_conn_parcel",
57    "$ETHERNETMANAGER_SOURCE_DIR:ethernet_manager",
58    "$EXT_INNERKITS_ROOT/ethernetclient:ethernet_manager_if",
59    "$NETCONNMANAGER_COMMON_DIR:net_service_common",
60    "$NETMANAGER_EXT_ROOT/utils:net_manager_ext_common",
61    "$NETSYSCONTROLLER_ROOT_DIR:netsys_controller",
62  ]
63
64  external_deps = [
65    "access_token:libaccesstoken_sdk",
66    "access_token:libnativetoken",
67    "access_token:libtoken_setproc",
68    "bounds_checking_function:libsec_shared",
69    "cJSON:cjson",
70    "dhcp:dhcp_sdk",
71    "ffrt:libffrt",
72    "ipc:ipc_core",
73  ]
74
75  defines = [
76    "NETMGR_LOG_TAG = \"EthernetManager\"",
77    "LOG_DOMAIN = 0xD0015B0",
78  ]
79
80  if (enable_netmgr_ext_debug) {
81    defines += [ "NETMGR_DEBUG" ]
82  }
83
84  external_deps += [ "hilog:libhilog" ]
85
86  part_name = "netmanager_ext"
87  subsystem_name = "communication"
88}
89
90group("unittest") {
91  testonly = true
92  deps = [ ":ethernet_manager_test" ]
93}
94