1b1b8bc3fSopenharmony_ci# Copyright (c) 2021-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("NetStatsClientFuzzTest") {
22b1b8bc3fSopenharmony_ci  module_out_path = fuzz_test_path
23b1b8bc3fSopenharmony_ci  fuzz_config_file = "$NETMANAGER_BASE_ROOT/test/fuzztest/netstatsclient_fuzzer"
24b1b8bc3fSopenharmony_ci  _cfi_blocklist_path = "$NETMANAGER_BASE_ROOT/test/fuzztest/netstatsclient_fuzzer/cfi_blocklist.txt"
25b1b8bc3fSopenharmony_ci
26b1b8bc3fSopenharmony_ci  include_dirs = [
27b1b8bc3fSopenharmony_ci    "$INNERKITS_ROOT/netstatsclient/include",
28b1b8bc3fSopenharmony_ci    "$NETCONNMANAGER_COMMON_DIR/include",
29b1b8bc3fSopenharmony_ci    "$NETSTATSMANAGER_SOURCE_DIR/include/stub",
30b1b8bc3fSopenharmony_ci    "$NETSTATSMANAGER_SOURCE_DIR/include",
31b1b8bc3fSopenharmony_ci    "$NETSYSCONTROLLER_ROOT_DIR/include",
32b1b8bc3fSopenharmony_ci    "$NETSYSNATIVE_SOURCE_DIR/include/manager",
33b1b8bc3fSopenharmony_ci    "$NETSYSNATIVE_SOURCE_DIR/include/netsys/wrapper",
34b1b8bc3fSopenharmony_ci    "$NETMANAGERNATIVE_ROOT/netsys_bpf_map/include",
35b1b8bc3fSopenharmony_ci  ]
36b1b8bc3fSopenharmony_ci
37b1b8bc3fSopenharmony_ci  cflags = [
38b1b8bc3fSopenharmony_ci    "-g",
39b1b8bc3fSopenharmony_ci    "-O0",
40b1b8bc3fSopenharmony_ci    "-Wno-unused-variable",
41b1b8bc3fSopenharmony_ci    "-fno-omit-frame-pointer",
42b1b8bc3fSopenharmony_ci    "-flto",
43b1b8bc3fSopenharmony_ci    "-fsanitize=cfi",
44b1b8bc3fSopenharmony_ci    "-fsanitize-cfi-cross-dso",
45b1b8bc3fSopenharmony_ci    "-fvisibility=hidden",
46b1b8bc3fSopenharmony_ci    "-fsanitize-blacklist=" + rebase_path(_cfi_blocklist_path, root_build_dir),
47b1b8bc3fSopenharmony_ci  ]
48b1b8bc3fSopenharmony_ci
49b1b8bc3fSopenharmony_ci  ldflags = [
50b1b8bc3fSopenharmony_ci    "-flto",
51b1b8bc3fSopenharmony_ci    "-fsanitize=cfi",
52b1b8bc3fSopenharmony_ci    "-fsanitize-cfi-cross-dso",
53b1b8bc3fSopenharmony_ci  ]
54b1b8bc3fSopenharmony_ci
55b1b8bc3fSopenharmony_ci  sources = [
56b1b8bc3fSopenharmony_ci    "mock_net_permission.cpp",
57b1b8bc3fSopenharmony_ci    "net_stats_client_fuzzer.cpp",
58b1b8bc3fSopenharmony_ci  ]
59b1b8bc3fSopenharmony_ci
60b1b8bc3fSopenharmony_ci  deps = [
61b1b8bc3fSopenharmony_ci    "$INNERKITS_ROOT/netstatsclient:net_stats_manager_if",
62b1b8bc3fSopenharmony_ci    "$NETMANAGER_BASE_ROOT/services/netstatsmanager:net_stats_manager_static",
63b1b8bc3fSopenharmony_ci    "$NETMANAGER_BASE_ROOT/utils:net_manager_common",
64b1b8bc3fSopenharmony_ci    "$NETSYSCONTROLLER_ROOT_DIR:netsys_controller",
65b1b8bc3fSopenharmony_ci  ]
66b1b8bc3fSopenharmony_ci
67b1b8bc3fSopenharmony_ci  defines = [
68b1b8bc3fSopenharmony_ci    "HI_LOG_ENABLE",
69b1b8bc3fSopenharmony_ci    "DH_LOG_TAG=\"NetStatsClientFuzzTest\"",
70b1b8bc3fSopenharmony_ci    "LOG_DOMAIN=0xD004100",
71b1b8bc3fSopenharmony_ci  ]
72b1b8bc3fSopenharmony_ci
73b1b8bc3fSopenharmony_ci  external_deps = [
74b1b8bc3fSopenharmony_ci    "bundle_framework:appexecfwk_base",
75b1b8bc3fSopenharmony_ci    "bundle_framework:appexecfwk_core",
76b1b8bc3fSopenharmony_ci    "c_utils:utils",
77b1b8bc3fSopenharmony_ci    "eventhandler:libeventhandler",
78b1b8bc3fSopenharmony_ci    "ffrt:libffrt",
79b1b8bc3fSopenharmony_ci    "hilog:libhilog",
80b1b8bc3fSopenharmony_ci    "init:libbegetutil",
81b1b8bc3fSopenharmony_ci    "ipc:ipc_core",
82b1b8bc3fSopenharmony_ci    "ipc:ipc_core",
83b1b8bc3fSopenharmony_ci    "safwk:system_ability_fwk",
84b1b8bc3fSopenharmony_ci    "samgr:samgr_proxy",
85b1b8bc3fSopenharmony_ci  ]
86b1b8bc3fSopenharmony_ci}
87b1b8bc3fSopenharmony_ci
88b1b8bc3fSopenharmony_ci###############################################################################
89b1b8bc3fSopenharmony_cigroup("fuzztest") {
90b1b8bc3fSopenharmony_ci  testonly = true
91b1b8bc3fSopenharmony_ci
92b1b8bc3fSopenharmony_ci  deps = [ ":NetStatsClientFuzzTest" ]
93b1b8bc3fSopenharmony_ci}
94b1b8bc3fSopenharmony_ci
95b1b8bc3fSopenharmony_ci###############################################################################
96b1b8bc3fSopenharmony_ci
97