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