1# Copyright (c) 2022-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/config/features.gni")
15
16#####################hydra-fuzz###################
17import("//build/test.gni")
18import("//foundation/communication/netmanager_base/netmanager_base_config.gni")
19
20##############################fuzztest##########################################
21ohos_fuzztest("NetConnClientFuzzTest") {
22  module_out_path = fuzz_test_path
23  fuzz_config_file = "$NETMANAGER_BASE_ROOT/test/fuzztest/netconnclient_fuzzer"
24
25  include_dirs = [
26    "$INNERKITS_ROOT/include",
27    "$INNERKITS_ROOT/netconnclient/include",
28    "$INNERKITS_ROOT/netconnclient/include/proxy",
29    "$INNERKITS_ROOT/netmanagernative/include",
30    "$NETCONNMANAGER_SOURCE_DIR/include/stub",
31    "$NETCONNMANAGER_SOURCE_DIR/include",
32    "$SAMGR_MANAGER_ROOT/interfaces/innerkits/samgr_proxy/include",
33    "$NETMANAGERNATIVE_ROOT/net_mgr_native/include",
34    "$NETMANAGERNATIVE_ROOT/common/include",
35    "$NETMANAGER_BASE_ROOT/services/common/include",
36    "$NETMANAGER_BASE_ROOT/test/commonduplicatedcode",
37    "$NETMANAGER_BASE_ROOT/test/security",
38    "$NETSYSCONTROLLER_ROOT_DIR/include",
39    "$THIRD_PARTY_ROOT/curl/include",
40    "$NETPOLICYMANAGER_SOURCE_DIR/include",
41    "$NETPOLICYMANAGER_SOURCE_DIR/include/stub",
42  ]
43
44  cflags = [
45    "-g",
46    "-O0",
47    "-Wno-unused-variable",
48    "-fno-omit-frame-pointer",
49  ]
50
51  sources = [
52    "$NETMANAGER_BASE_ROOT/test/security/netmanager_base_test_security.cpp",
53    "mock_net_conn_permission.cpp",
54    "net_conn_client_fuzzer.cpp",
55  ]
56
57  deps = [
58    "$INNERKITS_ROOT/netconnclient:net_conn_manager_if",
59    "$NETCONNMANAGER_SOURCE_DIR:net_conn_manager_static",
60    "$NETMANAGER_BASE_ROOT/utils:net_manager_common",
61    "$NETSYSCONTROLLER_ROOT_DIR:netsys_controller",
62    "$THIRD_PARTY_ROOT/curl:curl_shared",
63  ]
64
65  defines = [
66    "HI_LOG_ENABLE",
67    "DH_LOG_TAG=\"NetConnClientFuzzTest\"",
68    "LOG_DOMAIN=0xD004100",
69  ]
70
71  external_deps = [
72    "ability_base:want",
73    "ability_base:zuri",
74    "ability_runtime:ability_manager",
75    "access_token:libaccesstoken_sdk",
76    "access_token:libnativetoken",
77    "access_token:libtoken_setproc",
78    "bundle_framework:appexecfwk_base",
79    "bundle_framework:appexecfwk_core",
80    "cJSON:cjson",
81    "data_share:datashare_common",
82    "data_share:datashare_consumer",
83    "eventhandler:libeventhandler",
84    "ffrt:libffrt",
85    "hilog:libhilog",
86    "hitrace:hitrace_meter",
87    "init:libbegetutil",
88    "ipc:ipc_core",
89    "os_account:os_account_innerkits",
90    "safwk:system_ability_fwk",
91    "samgr:samgr_proxy",
92  ]
93}
94
95###############################################################################
96group("fuzztest") {
97  testonly = true
98
99  deps = [ ":NetConnClientFuzzTest" ]
100}
101
102###############################################################################
103
104