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