1# Copyright (C) 2023-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########################################## 19ohos_fuzztest("MDnsClientFuzzTest") { 20 module_out_path = fuzz_test_path 21 fuzz_config_file = 22 "$NETMANAGER_EXT_ROOT/test/mdnsmanager/fuzztest/mdnsclient_fuzzer" 23 _cfi_blocklist_path = "$NETMANAGER_EXT_ROOT/test/mdnsmanager/fuzztest/mdnsclient_fuzzer/cfi_blocklist.txt" 24 25 include_dirs = [ 26 "$NETMANAGER_EXT_ROOT/interfaces/innerkits/mdnsclient", 27 "$NETMANAGER_EXT_ROOT/interfaces/innerkits/mdnsclient/proxy", 28 "$NETMANAGER_EXT_ROOT/services/mdnsmanager/include", 29 "$NETMANAGER_EXT_ROOT/services/mdnsmanager/include/stub", 30 "$EXT_INNERKITS_ROOT/include", 31 "$NETMANAGER_EXT_ROOT/utils/log/include", 32 "$BASE_INNERKITS_ROOT/netconnclient/include", 33 "$BASE_INNERKITS_ROOT/netconnclient/include/proxy", 34 ] 35 cflags = [ 36 "-g", 37 "-O0", 38 "-Wno-unused-variable", 39 "-fno-omit-frame-pointer", 40 ] 41 42 if (!(use_libfuzzer || use_clang_coverage)) { 43 cflags += [ 44 "-flto", 45 "-fsanitize=cfi", 46 "-fsanitize-cfi-cross-dso", 47 "-fvisibility=hidden", 48 "-fsanitize-blacklist=" + 49 rebase_path(_cfi_blocklist_path, root_build_dir), 50 ] 51 } 52 ldflags = [] 53 if (!(use_libfuzzer || use_clang_coverage)) { 54 ldflags += [ 55 "-flto", 56 "-fsanitize=cfi", 57 "-fsanitize-cfi-cross-dso", 58 ] 59 } 60 sources = [ "mdns_client_fuzzer.cpp" ] 61 62 deps = [ 63 "$EXT_INNERKITS_ROOT/mdnsclient:mdns_manager_if", 64 "$NETMANAGER_EXT_ROOT/services/mdnsmanager:mdns_manager_static", 65 ] 66 67 external_deps = [ 68 "c_utils:utils", 69 "hilog:libhilog", 70 "ipc:ipc_core", 71 "netmanager_base:net_conn_manager_if", 72 "safwk:system_ability_fwk", 73 ] 74 75 defines = [ 76 "NETMGR_LOG_TAG = \"NetShareManager\"", 77 "LOG_DOMAIN = 0xD0015B0", 78 ] 79} 80 81############################################################################### 82group("fuzztest") { 83 testonly = true 84 deps = [ ":MDnsClientFuzzTest" ] 85} 86############################################################################### 87