• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2023-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
14#####################hydra-fuzz###################
15import("//build/config/features.gni")
16import("//build/test.gni")
17import("//foundation/communication/netmanager_ext/netmanager_ext_config.gni")
18##############################fuzztest##########################################
19EXT_SECURITY_PATH = "../../.."
20
21ohos_fuzztest("VpnClientFuzzTest") {
22  module_out_path = fuzz_test_path
23  fuzz_config_file =
24      "$NETMANAGER_EXT_ROOT/test/vpnmanager/fuzztest/vpnclient_fuzzer"
25  _cfi_blocklist_path = "$NETMANAGER_EXT_ROOT/test/vpnmanager/fuzztest/vpnclient_fuzzer/cfi_blocklist.txt"
26
27  include_dirs = [
28    "$EXT_INNERKITS_ROOT/netvpnclient/include",
29    "$EXT_INNERKITS_ROOT/netvpnclient/include/ipc",
30    "$EXT_SECURITY_PATH/security",
31    "$NETMANAGER_EXT_ROOT/utils/log/include",
32    "$NETMANAGER_EXT_ROOT/utils/event_report/include",
33    "$VPNMANAGER_SOURCE_DIR/include",
34    "$VPNMANAGER_SOURCE_DIR/include/ipc",
35  ]
36
37  cflags = [
38    "-g",
39    "-O0",
40    "-Wno-unused-variable",
41    "-fno-omit-frame-pointer",
42    "-flto",
43    "-fsanitize=cfi",
44    "-fsanitize-cfi-cross-dso",
45    "-fvisibility=hidden",
46    "-fsanitize-blacklist=" + rebase_path(_cfi_blocklist_path, root_build_dir),
47  ]
48  ldflags = [
49    "-flto",
50    "-fsanitize=cfi",
51    "-fsanitize-cfi-cross-dso",
52  ]
53
54  sources = [
55    "$EXT_SECURITY_PATH/security/netmanager_ext_test_security.cpp",
56    "vpnclient_fuzzer.cpp",
57  ]
58
59  deps = [
60    "$EXT_INNERKITS_ROOT/netvpnclient:net_vpn_manager_if",
61    "$NETMANAGER_EXT_ROOT/services/vpnmanager:net_vpn_manager_static",
62  ]
63
64  external_deps = [
65    "ability_runtime:app_manager",
66    "access_token:libaccesstoken_sdk",
67    "access_token:libnativetoken",
68    "access_token:libtoken_setproc",
69    "bundle_framework:appexecfwk_core",
70    "cJSON:cjson",
71    "c_utils:utils",
72    "ffrt:libffrt",
73    "hilog:libhilog",
74    "hisysevent:libhisysevent",
75    "ipc:ipc_core",
76    "netmanager_base:net_conn_manager_if",
77    "netmanager_base:net_manager_common",
78    "netmanager_base:netsys_controller",
79    "os_account:os_account_innerkits",
80    "relational_store:native_rdb",
81    "safwk:system_ability_fwk",
82  ]
83
84  defines = [
85    "NETMGR_LOG_TAG = \"NetVpnManager\"",
86    "LOG_DOMAIN = 0xD0015B0",
87  ]
88}
89
90group("fuzztest") {
91  testonly = true
92  deps = [ ":VpnClientFuzzTest" ]
93}
94