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("NetSysClientNetDiagFuzzTest") { 22 module_out_path = fuzz_test_path 23 fuzz_config_file = 24 "$NETMANAGER_BASE_ROOT/test/fuzztest/netsysclientnetdiag_fuzzer" 25 _cfi_blocklist_path = "$NETMANAGER_BASE_ROOT/test/fuzztest/netsysclientnetdiag_fuzzer/cfi_blocklist.txt" 26 27 include_dirs = [ 28 "$NETCONNMANAGER_COMMON_DIR/include", 29 "$NETCONNMANAGER_SOURCE_DIR/include", 30 "$NETMANAGER_BASE_ROOT/services/netmanagernative/bpf/include", 31 "$NETMANAGER_BASE_ROOT/test/commonduplicatedcode", 32 "$NETMANAGER_BASE_ROOT/utils/common_utils/include", 33 "$NETSYSNATIVE_INNERKITS_SOURCE_DIR", 34 "$INNERKITS_ROOT/netmanagernative/include", 35 "$NETSYSCONTROLLER_ROOT_DIR/include", 36 "$NETSYSNATIVE_SOURCE_DIR/include", 37 "$NETSYSNATIVE_SOURCE_DIR/include/manager", 38 "$NETSYSNATIVE_SOURCE_DIR/include/netsys", 39 "$NETSYSNATIVE_SOURCE_DIR/include/netsys/wrapper", 40 ] 41 42 cflags = [ 43 "-g", 44 "-O0", 45 "-Wno-unused-variable", 46 "-fno-omit-frame-pointer", 47 ] 48 49 if (!(use_libfuzzer || use_clang_coverage)) { 50 cflags += [ 51 "-flto", 52 "-fvisibility=hidden", 53 ] 54 } 55 56 ldflags = [] 57 if (!(use_libfuzzer || use_clang_coverage)) { 58 ldflags += [ "-flto" ] 59 } 60 61 sources = [ "net_sys_client_netdiag_fuzzer.cpp" ] 62 63 deps = [ 64 "$NETMANAGER_BASE_ROOT/services/netmanagernative:netsys_native_manager_static", 65 "$NETMANAGER_BASE_ROOT/services/netmanagernative/bpf:netsys_bpf_utils", 66 "$NETMANAGER_BASE_ROOT/utils:net_manager_common", 67 "$NETSYSCONTROLLER_ROOT_DIR:netsys_controller", 68 ] 69 70 defines = [ 71 "HI_LOG_ENABLE", 72 "DH_LOG_TAG=\"NetSysClientNetDiagFuzzTest\"", 73 "LOG_DOMAIN=0xD004100", 74 ] 75 76 external_deps = [ 77 "access_token:libaccesstoken_sdk", 78 "access_token:libnativetoken", 79 "access_token:libtoken_setproc", 80 "bundle_framework:appexecfwk_base", 81 "bundle_framework:appexecfwk_core", 82 "c_utils:utils", 83 "dhcp:dhcp_sdk", 84 "eventhandler:libeventhandler", 85 "ffrt:libffrt", 86 "hilog:libhilog", 87 "init:libbegetutil", 88 "ipc:ipc_core", 89 "safwk:system_ability_fwk", 90 "samgr:samgr_proxy", 91 ] 92} 93 94############################################################################### 95group("fuzztest") { 96 testonly = true 97 98 deps = [ ":NetSysClientNetDiagFuzzTest" ] 99} 100 101############################################################################### 102 103