11e934351Sopenharmony_ci# Copyright (c) 2023 Huawei Device Co., Ltd.
21e934351Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
31e934351Sopenharmony_ci# you may not use this file except in compliance with the License.
41e934351Sopenharmony_ci# You may obtain a copy of the License at
51e934351Sopenharmony_ci#
61e934351Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
71e934351Sopenharmony_ci#
81e934351Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
91e934351Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
101e934351Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
111e934351Sopenharmony_ci# See the License for the specific language governing permissions and
121e934351Sopenharmony_ci# limitations under the License.
131e934351Sopenharmony_ci
141e934351Sopenharmony_ci#####################hydra-fuzz###################
151e934351Sopenharmony_ciimport("//build/config/features.gni")
161e934351Sopenharmony_ciimport("//build/ohos.gni")
171e934351Sopenharmony_ciimport("//build/test.gni")
181e934351Sopenharmony_ciimport("//foundation/communication/netstack/netstack_config.gni")
191e934351Sopenharmony_ci
201e934351Sopenharmony_ci##############################fuzztest##########################################
211e934351Sopenharmony_ciWEBSOCKET_INNERAPI = "$NETSTACK_DIR/frameworks/native/websocket_client"
221e934351Sopenharmony_ci
231e934351Sopenharmony_ciutils_include = [
241e934351Sopenharmony_ci  "$SUBSYSTEM_DIR/netstack/utils/common_utils/include",
251e934351Sopenharmony_ci  "$SUBSYSTEM_DIR/netstack/utils/log/include",
261e934351Sopenharmony_ci  "$SUBSYSTEM_DIR/netstack/utils/napi_utils/include",
271e934351Sopenharmony_ci  "$THIRD_PARTY_ROOT/libwebsockets/include",
281e934351Sopenharmony_ci]
291e934351Sopenharmony_ci
301e934351Sopenharmony_cicommon_external_deps = [
311e934351Sopenharmony_ci  "c_utils:utils",
321e934351Sopenharmony_ci  "eventhandler:libeventhandler",
331e934351Sopenharmony_ci  "hilog:libhilog",
341e934351Sopenharmony_ci]
351e934351Sopenharmony_ci
361e934351Sopenharmony_ciohos_fuzztest("WebSocketInnerApiFuzzTest") {
371e934351Sopenharmony_ci  module_out_path = fuzz_test_path
381e934351Sopenharmony_ci  fuzz_config_file = "$NETSTACK_DIR/test/fuzztest/websocketinnerapi_fuzzer"
391e934351Sopenharmony_ci  include_dirs = [
401e934351Sopenharmony_ci    "$NETSTACK_DIR/utils/napi_utils/include",
411e934351Sopenharmony_ci    "$WEBSOCKET_INNERAPI/include",
421e934351Sopenharmony_ci  ]
431e934351Sopenharmony_ci  include_dirs += utils_include
441e934351Sopenharmony_ci
451e934351Sopenharmony_ci  cflags = [
461e934351Sopenharmony_ci    "-g",
471e934351Sopenharmony_ci    "-O0",
481e934351Sopenharmony_ci    "-Wno-unused-variable",
491e934351Sopenharmony_ci    "-fno-omit-frame-pointer",
501e934351Sopenharmony_ci  ]
511e934351Sopenharmony_ci
521e934351Sopenharmony_ci  sources = [
531e934351Sopenharmony_ci    "$SUBSYSTEM_DIR/netstack/utils/common_utils/src/netstack_common_utils.cpp",
541e934351Sopenharmony_ci    "websocket_inner_fuzzer.cpp",
551e934351Sopenharmony_ci  ]
561e934351Sopenharmony_ci
571e934351Sopenharmony_ci  deps = [
581e934351Sopenharmony_ci    "$NETSTACK_DIR/utils/napi_utils:napi_utils",
591e934351Sopenharmony_ci    "$NETSTACK_INNERKITS_DIR/websocket_client:websocket_client",
601e934351Sopenharmony_ci  ]
611e934351Sopenharmony_ci
621e934351Sopenharmony_ci  external_deps = common_external_deps
631e934351Sopenharmony_ci}
641e934351Sopenharmony_ci
651e934351Sopenharmony_ci###############################################################################
661e934351Sopenharmony_cigroup("fuzztest") {
671e934351Sopenharmony_ci  testonly = true
681e934351Sopenharmony_ci
691e934351Sopenharmony_ci  deps = [ ":WebSocketInnerApiFuzzTest" ]
701e934351Sopenharmony_ci}
711e934351Sopenharmony_ci###############################################################################
72