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/ohos.gni") 17import("//build/test.gni") 18import("//foundation/communication/netstack/netstack_config.gni") 19 20##############################fuzztest########################################## 21NETSTACK_NAPI_ROOT = "$SUBSYSTEM_DIR/netstack/frameworks/js/napi/" 22 23utils_include = [ 24 "$SUBSYSTEM_DIR/netstack/utils/common_utils/include", 25 "$SUBSYSTEM_DIR/netstack/utils/log/include", 26] 27 28common_external_deps = [ 29 "c_utils:utils", 30 "curl:curl_shared", 31 "hilog:libhilog", 32] 33 34ohos_fuzztest("HttpFuzzTest") { 35 module_out_path = fuzz_test_path 36 fuzz_config_file = "$NETSTACK_DIR/test/fuzztest/http_fuzzer" 37 include_dirs = [ 38 "$NETSTACK_INNERKITS_DIR/http_client/include", 39 "$NETSTACK_DIR/utils/napi_utils/include", 40 "$NETSTACK_NAPI_ROOT/http/constant/include", 41 "$NETSTACK_NAPI_ROOT/http/options/include", 42 "$NETSTACK_NAPI_ROOT/http/http_exec/include", 43 ] 44 include_dirs += utils_include 45 46 cflags = [ 47 "-g", 48 "-O0", 49 "-Wno-unused-variable", 50 "-fno-omit-frame-pointer", 51 "-flto", 52 "-fsanitize=cfi", 53 "-fsanitize-cfi-cross-dso", 54 "-fvisibility=hidden", 55 ] 56 57 ldflags = [ 58 "-flto", 59 "-fsanitize=cfi", 60 "-fsanitize-cfi-cross-dso", 61 ] 62 63 sources = [ 64 "$NETSTACK_NAPI_ROOT/http/constant/src/constant.cpp", 65 "$NETSTACK_NAPI_ROOT/http/options/src/http_request_options.cpp", 66 "$SUBSYSTEM_DIR/netstack/utils/common_utils/src/netstack_common_utils.cpp", 67 "http_fuzzer.cpp", 68 ] 69 70 deps = [ 71 "$NETSTACK_DIR/utils/napi_utils:napi_utils", 72 "$NETSTACK_INNERKITS_DIR/http_client:http_client", 73 ] 74 75 external_deps = common_external_deps 76 external_deps += [ "napi:ace_napi" ] 77} 78 79############################################################################### 80group("fuzztest") { 81 testonly = true 82 83 deps = [ ":HttpFuzzTest" ] 84} 85############################################################################### 86