# Copyright (c) 2022-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") import("//foundation/communication/netmanager_ext/netmanager_ext_config.gni") ##############################fuzztest########################################## EXT_SECURITY_PATH = "../../.." ohos_fuzztest("NetShareClientFuzzTest") { module_out_path = fuzz_test_path fuzz_config_file = "$NETMANAGER_EXT_ROOT/test/networksharemanager/fuzztest/netshareclient_fuzzer" _cfi_blocklist_path = "$NETMANAGER_EXT_ROOT/test/networksharemanager/fuzztest/netshareclient_fuzzer/cfi_blocklist.txt" include_dirs = [ "$EXT_INNERKITS_ROOT/ethernetclient/include", "$EXT_INNERKITS_ROOT/netshareclient/include", "$EXT_INNERKITS_ROOT/netshareclient/include/proxy", "$EXT_INNERKITS_ROOT/netshareclient/include/proxy/ipccallback", "$EXT_INNERKITS_ROOT/include", "$EXT_INNERKITS_ROOT/include/proxy", "$EXT_SECURITY_PATH/security", "$NETMANAGER_EXT_ROOT/utils/log/include", "$NETWORKSHAREMANAGER_SOURCE_DIR/include", "$NETWORKSHAREMANAGER_SOURCE_DIR/include/stub", "$NETWORKSHAREMANAGER_UTILS_DIR/event_report/include", "$NETSYSCONTROLLER_ROOT_DIR/include", ] if (communication_wifi_switch_enable) { include_dirs += [ "$WIFI_MANAGER_ROOT/interfaces/kits/c", "$WIFI_MANAGER_ROOT/frameworks/native/interfaces", ] } cflags = [ "-g", "-O0", "-Wno-unused-variable", "-fno-omit-frame-pointer", ] if (!(use_libfuzzer || use_clang_coverage)) { cflags += [ "-flto", "-fsanitize=cfi", "-fsanitize-cfi-cross-dso", "-fvisibility=hidden", "-fsanitize-blacklist=" + rebase_path(_cfi_blocklist_path, root_build_dir), ] } ldflags = [] if (!(use_libfuzzer || use_clang_coverage)) { ldflags += [ "-flto", "-fsanitize=cfi", "-fsanitize-cfi-cross-dso", ] } sources = [ "$EXT_SECURITY_PATH/security/netmanager_ext_test_security.cpp", "netshare_client_fuzzer.cpp", ] deps = [ "$BASE_INNERKITS_ROOT/netconnclient:net_conn_manager_if", "$BLUETOOTH_ROOT/frameworks/inner:btframework", "$NETMANAGER_BASE_ROOT/utils:net_manager_common", "$NETMANAGER_EXT_ROOT/services/networksharemanager:net_tether_manager_static", "$NETSYSCONTROLLER_ROOT_DIR:netsys_controller", ] external_deps = [ "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "access_token:libtoken_setproc", "c_utils:utils", "dhcp:dhcp_sdk", "ffrt:libffrt", "hilog:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", ] defines = [] if (communication_wifi_switch_enable) { defines += [ "WIFI_MODOULE" ] external_deps += [ "wifi:wifi_sdk" ] } defines += [ "NETMGR_LOG_TAG = \"NetShareManager\"", "LOG_DOMAIN = 0xD0015B0", ] if (communication_bluetooth_switch_enable) { defines += [ "BLUETOOTH_MODOULE=1" ] external_deps += [ "bluetooth:btframework" ] } } ############################################################################### group("fuzztest") { testonly = true deps = [ ":NetShareClientFuzzTest" ] } ###############################################################################