# 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. import("//build/config/features.gni") #####################hydra-fuzz################### import("//build/test.gni") import("//foundation/communication/netmanager_base/netmanager_base_config.gni") ##############################fuzztest########################################## ohos_fuzztest("NetSysClientNetDiagFuzzTest") { module_out_path = fuzz_test_path fuzz_config_file = "$NETMANAGER_BASE_ROOT/test/fuzztest/netsysclientnetdiag_fuzzer" _cfi_blocklist_path = "$NETMANAGER_BASE_ROOT/test/fuzztest/netsysclientnetdiag_fuzzer/cfi_blocklist.txt" include_dirs = [ "$NETCONNMANAGER_COMMON_DIR/include", "$NETCONNMANAGER_SOURCE_DIR/include", "$NETMANAGER_BASE_ROOT/services/netmanagernative/bpf/include", "$NETMANAGER_BASE_ROOT/test/commonduplicatedcode", "$NETMANAGER_BASE_ROOT/utils/log/include", "$NETSYSNATIVE_INNERKITS_SOURCE_DIR", "$INNERKITS_ROOT/netmanagernative/include", "$NETSYSCONTROLLER_ROOT_DIR/include", "$NETSYSNATIVE_SOURCE_DIR/include", "$NETSYSNATIVE_SOURCE_DIR/include/manager", "$NETSYSNATIVE_SOURCE_DIR/include/netsys", "$NETSYSNATIVE_SOURCE_DIR/include/netsys/wrapper", ] 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 = [ "net_sys_client_netdiag_fuzzer.cpp" ] deps = [ "$NETMANAGER_BASE_ROOT/services/netmanagernative:netsys_native_manager_static", "$NETMANAGER_BASE_ROOT/services/netmanagernative/bpf:netsys_bpf_utils", "$NETMANAGER_BASE_ROOT/utils:net_manager_common", "$NETSYSCONTROLLER_ROOT_DIR:netsys_controller", ] defines = [ "HI_LOG_ENABLE", "DH_LOG_TAG=\"NetSysClientNetDiagFuzzTest\"", "LOG_DOMAIN=0xD004100", ] external_deps = [ "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "access_token:libtoken_setproc", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "c_utils:utils", "dhcp:dhcp_sdk", "eventhandler:libeventhandler", "ffrt:libffrt", "hilog:libhilog", "init:libbegetutil", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] } ############################################################################### group("fuzztest") { testonly = true deps = [ ":NetSysClientNetDiagFuzzTest" ] } ###############################################################################