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