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("CommonFuzzTest") { 22 module_out_path = fuzz_test_path 23 fuzz_config_file = "$NETMANAGER_BASE_ROOT/test/fuzztest/common_fuzzer" 24 _cfi_blocklist_path = 25 "$NETMANAGER_BASE_ROOT/test/fuzztest/common_fuzzer/cfi_blocklist.txt" 26 27 include_dirs = [ 28 "$ETHERNETMANAGER_SOURCE_DIR/include", 29 "$INNERKITS_ROOT/include", 30 "$INNERKITS_ROOT/netmanagernative/include", 31 "$INNERKITS_ROOT/netpolicyclient/include", 32 "$INNERKITS_ROOT/netpolicyclient/include/proxy", 33 "$INNERKITS_ROOT/netstatsclient/include", 34 "$NETCONNMANAGER_SOURCE_DIR/include", 35 "$NETMANAGER_BASE_ROOT/services/common/include", 36 "$NETPOLICYMANAGER_SOURCE_DIR/include", 37 "$NETPOLICYMANAGER_SOURCE_DIR/include/stub", 38 "$NETSYSCONTROLLER_ROOT_DIR/include", 39 "$NETSYSNATIVE_INNERKITS_SOURCE_DIR", 40 ] 41 42 cflags = [ 43 "-g", 44 "-O0", 45 "-Wno-unused-variable", 46 "-fno-omit-frame-pointer", 47 "-flto", 48 "-fsanitize=cfi", 49 "-fsanitize-cfi-cross-dso", 50 "-fvisibility=hidden", 51 "-fsanitize-blacklist=" + rebase_path(_cfi_blocklist_path, root_build_dir), 52 ] 53 54 ldflags = [ 55 "-flto", 56 "-fsanitize=cfi", 57 "-fsanitize-cfi-cross-dso", 58 ] 59 60 sources = [ "common_fuzzer.cpp" ] 61 62 deps = [ 63 "$ETHERNETMANAGER_SOURCE_DIR:ethernet_manager", 64 "$INNERKITS_ROOT/netpolicyclient:net_policy_manager_if", 65 "$INNERKITS_ROOT/netstatsclient:net_stats_manager_if", 66 "$NETCONNMANAGER_COMMON_DIR:net_service_common", 67 "$NETCONNMANAGER_SOURCE_DIR:net_conn_manager_static", 68 "$NETMANAGER_BASE_ROOT/services/netpolicymanager:net_policy_manager_static", 69 "$NETMANAGER_BASE_ROOT/utils:net_manager_common", 70 ] 71 72 defines = [ 73 "HI_LOG_ENABLE", 74 "DH_LOG_TAG=\"NetPolicyClientFuzzTest\"", 75 "LOG_DOMAIN=0xD004100", 76 ] 77 78 external_deps = [ 79 "bundle_framework:appexecfwk_base", 80 "bundle_framework:appexecfwk_core", 81 "common_event_service:cesfwk_innerkits", 82 "eventhandler:libeventhandler", 83 "ffrt:libffrt", 84 "hilog:libhilog", 85 "hitrace:hitrace_meter", 86 "init:libbegetutil", 87 "ipc:ipc_core", 88 "safwk:system_ability_fwk", 89 "samgr:samgr_proxy", 90 ] 91} 92 93############################################################################### 94group("fuzztest") { 95 testonly = true 96 97 deps = [ ":CommonFuzzTest" ] 98} 99 100############################################################################### 101 102