1# Copyright (c) 2023 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/ohos.gni")
17import("//build/test.gni")
18import("//foundation/communication/netstack/netstack_config.gni")
19
20##############################fuzztest##########################################
21WEBSOCKET_INNERAPI = "$NETSTACK_DIR/frameworks/native/websocket_client"
22
23utils_include = [
24  "$SUBSYSTEM_DIR/netstack/utils/common_utils/include",
25  "$SUBSYSTEM_DIR/netstack/utils/log/include",
26  "$SUBSYSTEM_DIR/netstack/utils/napi_utils/include",
27  "$THIRD_PARTY_ROOT/libwebsockets/include",
28]
29
30common_external_deps = [
31  "c_utils:utils",
32  "eventhandler:libeventhandler",
33  "hilog:libhilog",
34]
35
36ohos_fuzztest("WebSocketInnerApiFuzzTest") {
37  module_out_path = fuzz_test_path
38  fuzz_config_file = "$NETSTACK_DIR/test/fuzztest/websocketinnerapi_fuzzer"
39  include_dirs = [
40    "$NETSTACK_DIR/utils/napi_utils/include",
41    "$WEBSOCKET_INNERAPI/include",
42  ]
43  include_dirs += utils_include
44
45  cflags = [
46    "-g",
47    "-O0",
48    "-Wno-unused-variable",
49    "-fno-omit-frame-pointer",
50  ]
51
52  sources = [
53    "$SUBSYSTEM_DIR/netstack/utils/common_utils/src/netstack_common_utils.cpp",
54    "websocket_inner_fuzzer.cpp",
55  ]
56
57  deps = [
58    "$NETSTACK_DIR/utils/napi_utils:napi_utils",
59    "$NETSTACK_INNERKITS_DIR/websocket_client:websocket_client",
60  ]
61
62  external_deps = common_external_deps
63}
64
65###############################################################################
66group("fuzztest") {
67  testonly = true
68
69  deps = [ ":WebSocketInnerApiFuzzTest" ]
70}
71###############################################################################
72