1b1b8bc3fSopenharmony_ci# Copyright (c) 2022-2024 Huawei Device Co., Ltd.
2b1b8bc3fSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3b1b8bc3fSopenharmony_ci# you may not use this file except in compliance with the License.
4b1b8bc3fSopenharmony_ci# You may obtain a copy of the License at
5b1b8bc3fSopenharmony_ci#
6b1b8bc3fSopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
7b1b8bc3fSopenharmony_ci#
8b1b8bc3fSopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9b1b8bc3fSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10b1b8bc3fSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11b1b8bc3fSopenharmony_ci# See the License for the specific language governing permissions and
12b1b8bc3fSopenharmony_ci# limitations under the License.
13b1b8bc3fSopenharmony_ci
14b1b8bc3fSopenharmony_ciimport("//build/config/features.gni")
15b1b8bc3fSopenharmony_ci
16b1b8bc3fSopenharmony_ci#####################hydra-fuzz###################
17b1b8bc3fSopenharmony_ciimport("//build/test.gni")
18b1b8bc3fSopenharmony_ciimport("//foundation/communication/netmanager_base/netmanager_base_config.gni")
19b1b8bc3fSopenharmony_ci
20b1b8bc3fSopenharmony_ci##############################fuzztest##########################################
21b1b8bc3fSopenharmony_ciohos_fuzztest("CommonFuzzTest") {
22b1b8bc3fSopenharmony_ci  module_out_path = fuzz_test_path
23b1b8bc3fSopenharmony_ci  fuzz_config_file = "$NETMANAGER_BASE_ROOT/test/fuzztest/common_fuzzer"
24b1b8bc3fSopenharmony_ci  _cfi_blocklist_path =
25b1b8bc3fSopenharmony_ci      "$NETMANAGER_BASE_ROOT/test/fuzztest/common_fuzzer/cfi_blocklist.txt"
26b1b8bc3fSopenharmony_ci
27b1b8bc3fSopenharmony_ci  include_dirs = [
28b1b8bc3fSopenharmony_ci    "$INNERKITS_ROOT/include",
29b1b8bc3fSopenharmony_ci    "$INNERKITS_ROOT/netmanagernative/include",
30b1b8bc3fSopenharmony_ci    "$INNERKITS_ROOT/netpolicyclient/include",
31b1b8bc3fSopenharmony_ci    "$INNERKITS_ROOT/netpolicyclient/include/proxy",
32b1b8bc3fSopenharmony_ci    "$INNERKITS_ROOT/netstatsclient/include",
33b1b8bc3fSopenharmony_ci    "$NETCONNMANAGER_SOURCE_DIR/include",
34b1b8bc3fSopenharmony_ci    "$NETMANAGER_BASE_ROOT/services/common/include",
35b1b8bc3fSopenharmony_ci    "$NETPOLICYMANAGER_SOURCE_DIR/include",
36b1b8bc3fSopenharmony_ci    "$NETPOLICYMANAGER_SOURCE_DIR/include/stub",
37b1b8bc3fSopenharmony_ci    "$NETSYSCONTROLLER_ROOT_DIR/include",
38b1b8bc3fSopenharmony_ci    "$NETSYSNATIVE_INNERKITS_SOURCE_DIR",
39b1b8bc3fSopenharmony_ci  ]
40b1b8bc3fSopenharmony_ci
41b1b8bc3fSopenharmony_ci  cflags = [
42b1b8bc3fSopenharmony_ci    "-g",
43b1b8bc3fSopenharmony_ci    "-O0",
44b1b8bc3fSopenharmony_ci    "-Wno-unused-variable",
45b1b8bc3fSopenharmony_ci    "-fno-omit-frame-pointer",
46b1b8bc3fSopenharmony_ci    "-flto",
47b1b8bc3fSopenharmony_ci    "-fsanitize=cfi",
48b1b8bc3fSopenharmony_ci    "-fsanitize-cfi-cross-dso",
49b1b8bc3fSopenharmony_ci    "-fvisibility=hidden",
50b1b8bc3fSopenharmony_ci    "-fsanitize-blacklist=" + rebase_path(_cfi_blocklist_path, root_build_dir),
51b1b8bc3fSopenharmony_ci  ]
52b1b8bc3fSopenharmony_ci
53b1b8bc3fSopenharmony_ci  ldflags = [
54b1b8bc3fSopenharmony_ci    "-flto",
55b1b8bc3fSopenharmony_ci    "-fsanitize=cfi",
56b1b8bc3fSopenharmony_ci    "-fsanitize-cfi-cross-dso",
57b1b8bc3fSopenharmony_ci  ]
58b1b8bc3fSopenharmony_ci
59b1b8bc3fSopenharmony_ci  sources = [ "common_fuzzer.cpp" ]
60b1b8bc3fSopenharmony_ci
61b1b8bc3fSopenharmony_ci  deps = [
62b1b8bc3fSopenharmony_ci    "$INNERKITS_ROOT/netpolicyclient:net_policy_manager_if",
63b1b8bc3fSopenharmony_ci    "$INNERKITS_ROOT/netstatsclient:net_stats_manager_if",
64b1b8bc3fSopenharmony_ci    "$NETCONNMANAGER_COMMON_DIR:net_service_common",
65b1b8bc3fSopenharmony_ci    "$NETCONNMANAGER_SOURCE_DIR:net_conn_manager_static",
66b1b8bc3fSopenharmony_ci    "$NETMANAGER_BASE_ROOT/services/netpolicymanager:net_policy_manager_static",
67b1b8bc3fSopenharmony_ci    "$NETMANAGER_BASE_ROOT/utils:net_manager_common",
68b1b8bc3fSopenharmony_ci  ]
69b1b8bc3fSopenharmony_ci
70b1b8bc3fSopenharmony_ci  defines = [
71b1b8bc3fSopenharmony_ci    "HI_LOG_ENABLE",
72b1b8bc3fSopenharmony_ci    "DH_LOG_TAG=\"NetPolicyClientFuzzTest\"",
73b1b8bc3fSopenharmony_ci    "LOG_DOMAIN=0xD004100",
74b1b8bc3fSopenharmony_ci  ]
75b1b8bc3fSopenharmony_ci
76b1b8bc3fSopenharmony_ci  external_deps = [
77b1b8bc3fSopenharmony_ci    "bundle_framework:appexecfwk_base",
78b1b8bc3fSopenharmony_ci    "bundle_framework:appexecfwk_core",
79b1b8bc3fSopenharmony_ci    "common_event_service:cesfwk_innerkits",
80b1b8bc3fSopenharmony_ci    "eventhandler:libeventhandler",
81b1b8bc3fSopenharmony_ci    "ffrt:libffrt",
82b1b8bc3fSopenharmony_ci    "hilog:libhilog",
83b1b8bc3fSopenharmony_ci    "hitrace:hitrace_meter",
84b1b8bc3fSopenharmony_ci    "init:libbegetutil",
85b1b8bc3fSopenharmony_ci    "ipc:ipc_core",
86b1b8bc3fSopenharmony_ci    "safwk:system_ability_fwk",
87b1b8bc3fSopenharmony_ci    "samgr:samgr_proxy",
88b1b8bc3fSopenharmony_ci  ]
89b1b8bc3fSopenharmony_ci}
90b1b8bc3fSopenharmony_ci
91b1b8bc3fSopenharmony_ci###############################################################################
92b1b8bc3fSopenharmony_cigroup("fuzztest") {
93b1b8bc3fSopenharmony_ci  testonly = true
94b1b8bc3fSopenharmony_ci
95b1b8bc3fSopenharmony_ci  deps = [ ":CommonFuzzTest" ]
96b1b8bc3fSopenharmony_ci}
97b1b8bc3fSopenharmony_ci
98b1b8bc3fSopenharmony_ci###############################################################################
99b1b8bc3fSopenharmony_ci
100