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