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/dsoftbus/sdk/bus_center/bus_center_sdk.gni") 19import("//foundation/communication/dsoftbus/sdk/discovery/disc_sdk.gni") 20import("//foundation/communication/dsoftbus/sdk/frame/frame_sdk.gni") 21import("//foundation/communication/dsoftbus/sdk/frame/frame_sdk.gni") 22import("//foundation/communication/dsoftbus/sdk/transmission/trans_sdk.gni") 23import("../../../../../dsoftbus.gni") 24common_client_src = bus_center_sdk_src + disc_sdk_src + 25 softbus_client_frame_src + trans_session_manager_sdk_src 26common_client_inc = bus_center_sdk_inc + disc_sdk_inc + 27 softbus_client_frame_inc + trans_session_manager_sdk_inc 28common_client_deps = bus_center_sdk_deps + trans_session_manager_sdk_deps 29 30common_client_deps += [ 31 "$dsoftbus_root_path/adapter:softbus_adapter", 32 "$dsoftbus_root_path/core/common:softbus_utils", 33] 34 35if (defined(ohos_lite)) { 36 if (dsoftbus_feature_build_shared_sdk == true) { 37 build_type = "shared_library" 38 } else { 39 build_type = "static_library" 40 } 41 if (ohos_kernel_type != "liteos_m") { 42 common_client_deps += 43 [ "//third_party/bounds_checking_function:libsec_shared" ] 44 } 45} else { 46 common_client_deps += 47 [ "//third_party/bounds_checking_function:libsec_shared" ] 48} 49 50config("dsoftbus_sdk_interface") { 51 include_dirs = [ 52 "$dsoftbus_root_path/interfaces/kits", 53 "$dsoftbus_root_path/interfaces/kits/bus_center", 54 "$dsoftbus_root_path/interfaces/kits/common", 55 "$dsoftbus_root_path/interfaces/kits/discovery", 56 "$dsoftbus_root_path/interfaces/kits/transport", 57 "$dsoftbus_root_path/sdk/transmission/session/cpp/include", 58 "$dsoftbus_root_path/interfaces/inner_kits/transport", 59 "$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include", 60 ] 61} 62 63ohos_static_library("softbus_client_static") { 64 sources = common_client_src 65 include_dirs = common_client_inc 66 deps = common_client_deps 67 all_dependent_configs = [ ":dsoftbus_sdk_interface" ] 68 defines = TRANS_SDK_DEFINES 69 70 if (defined(ohos_lite)) { 71 cflags_cc = [ "-stdc=c++14" ] 72 if (board_toolchain_type != "iccarm") { 73 configs -= [ "//build/lite/config:language_cpp" ] 74 cflags = [ "-fPIC" ] 75 cflags_cc += [ "-fPIC" ] 76 } else { 77 cflags = [ 78 "--diag_suppress", 79 "Pa153", 80 ] 81 } 82 ldflags = [ "-lstdc++" ] 83 } else { 84 cflags = [ "-fPIC" ] 85 cflags_cc = [ "-std=c++14" ] 86 if (is_standard_system) { 87 external_deps = [ 88 "c_utils:utils", 89 "hilog:libhilog", 90 "ipc:ipc_single", 91 ] 92 } 93 part_name = "dsoftbus" 94 subsystem_name = "communication" 95 } 96} 97 98##############################fuzztest########################################## 99ohos_fuzztest("SoftbusClientStubFuzzTest") { 100 module_out_path = "dsoftbus/sdk/frame" 101 fuzz_config_file = 102 "$dsoftbus_root_path/tests/sdk/frame/fuzztest/softbusclientstub_fuzzer" 103 include_dirs = [ 104 "../../../../../adapter/common/include", 105 "../../../../../core/common/include", 106 "../../../../../core/common/inner_communication", 107 "../../../../../interfaces/kits/common", 108 "../../../../../sdk/frame/standard/include", 109 "../../../../../sdk/frame/small/include", 110 "../../../../../sdk/frame/mini/include", 111 "../../../../../sdk/frame/common/include", 112 ] 113 cflags = [ 114 "-g", 115 "-O0", 116 "-Wno-unused-variable", 117 "-fno-omit-frame-pointer", 118 "-fstack-protector-strong", 119 ] 120 sources = [ "softbusclientstub_fuzzer.cpp" ] 121 deps = [ ":softbus_client_static" ] 122 123 external_deps = [ 124 "c_utils:utils", 125 "ipc:ipc_core", 126 "ipc:ipc_single", 127 ] 128} 129 130############################################################################### 131group("fuzztest") { 132 testonly = true 133 deps = [] 134 deps += [ 135 # deps file 136 ":SoftbusClientStubFuzzTest", 137 ] 138} 139############################################################################### 140