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 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("EthernetClientFuzzTest") { 22 module_out_path = fuzz_test_path 23 fuzz_config_file = 24 "$NETMANAGER_EXT_ROOT/test/ethernetmanager/fuzztest/ethernetclient_fuzzer" 25 26 include_dirs = [ 27 "$EXT_INNERKITS_ROOT/include", 28 "$EXT_INNERKITS_ROOT/ethernetclient/include", 29 "$EXT_INNERKITS_ROOT/ethernetclient/include/proxy", 30 "$EXT_SECURITY_PATH/security", 31 "$NETMANAGER_EXT_ROOT/utils/log/include", 32 "$ETHERNETMANAGER_SOURCE_DIR/include", 33 "$NETSYSCONTROLLER_ROOT_DIR/include", 34 "$NETCONNMANAGER_COMMON_DIR/include", 35 "$ETHERNETMANAGER_SOURCE_DIR/include/stub", 36 ] 37 38 cflags = [ 39 "-g", 40 "-O0", 41 "-Wno-unused-variable", 42 "-fno-omit-frame-pointer", 43 "-flto", 44 "-fsanitize=cfi", 45 "-fsanitize-cfi-cross-dso", 46 "-fvisibility=hidden", 47 ] 48 49 ldflags = [ 50 "-flto", 51 "-fsanitize=cfi", 52 "-fsanitize-cfi-cross-dso", 53 ] 54 55 sources = [ 56 "$EXT_SECURITY_PATH/security/netmanager_ext_test_security.cpp", 57 "ethernet_client_fuzzer.cpp", 58 ] 59 60 deps = [ 61 "$ETHERNETMANAGER_SOURCE_DIR:ethernet_manager", 62 "$EXT_INNERKITS_ROOT/ethernetclient:ethernet_manager_if", 63 "$NETMANAGER_EXT_ROOT/utils:net_manager_ext_common", 64 "$NETSYSCONTROLLER_ROOT_DIR:netsys_controller", 65 ] 66 67 external_deps = [ 68 "access_token:libaccesstoken_sdk", 69 "access_token:libnativetoken", 70 "access_token:libtoken_setproc", 71 "cJSON:cjson", 72 "c_utils:utils", 73 "dhcp:dhcp_sdk", 74 "ffrt:libffrt", 75 "ipc:ipc_core", 76 "netmanager_base:net_manager_common", 77 "netmanager_base:net_native_manager_if", 78 ] 79 external_deps += [ "hilog:libhilog" ] 80 81 defines = [ 82 "NETMGR_LOG_TAG = \"EthernetManager\"", 83 "LOG_DOMAIN = 0xD0015B0", 84 ] 85} 86 87############################################################################### 88group("fuzztest") { 89 testonly = true 90 91 deps = [ ":EthernetClientFuzzTest" ] 92} 93############################################################################### 94