• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  ]
33  cflags = [
34    "-g",
35    "-O0",
36    "-Wno-unused-variable",
37    "-fno-omit-frame-pointer",
38  ]
39
40  if (!(use_libfuzzer || use_clang_coverage)) {
41    cflags += [
42      "-flto",
43      "-fsanitize=cfi",
44      "-fsanitize-cfi-cross-dso",
45      "-fvisibility=hidden",
46      "-fsanitize-blacklist=" +
47          rebase_path(_cfi_blocklist_path, root_build_dir),
48    ]
49  }
50  ldflags = []
51  if (!(use_libfuzzer || use_clang_coverage)) {
52    ldflags += [
53      "-flto",
54      "-fsanitize=cfi",
55      "-fsanitize-cfi-cross-dso",
56    ]
57  }
58  sources = [ "mdns_client_fuzzer.cpp" ]
59
60  deps = [
61    "$EXT_INNERKITS_ROOT/mdnsclient:mdns_manager_if",
62    "$NETMANAGER_EXT_ROOT/services/mdnsmanager:mdns_manager_static",
63  ]
64
65  external_deps = [
66    "c_utils:utils",
67    "common_event_service:cesfwk_innerkits",
68    "hilog:libhilog",
69    "ipc:ipc_core",
70    "netmanager_base:net_conn_manager_if",
71    "safwk:system_ability_fwk",
72    "samgr:samgr_proxy",
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