1# Copyright (c) 2021-2025 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 14import("//build/test.gni") 15 16module_output_path = "hisysevent/hisysevent/hisysevent_native" 17 18config("hisysevent_native_test_config") { 19 visibility = [ ":*" ] 20 21 include_dirs = [ "include" ] 22} 23 24declare_args() { 25 hiviewdfx_hitrace_enabaled_for_test = false 26 if (defined(global_parts_info) && 27 defined(global_parts_info.hiviewdfx_hitrace)) { 28 hiviewdfx_hitrace_enabaled_for_test = true 29 } 30} 31 32ohos_moduletest("HiSysEventAdapterNativeTest") { 33 module_out_path = module_output_path 34 35 sources = [ "hisysevent_adapter_native_test.cpp" ] 36 37 configs = [ ":hisysevent_native_test_config" ] 38 39 deps = [ 40 "../../../adapter/native/idl:sys_event_impl_client", 41 "../../../frameworks/native/util:hisysevent_util", 42 "../../../interfaces/native/innerkits/hisysevent:hisysevent_static_lib_for_tdd", 43 "../../../interfaces/native/innerkits/hisysevent_manager:hisyseventmanager_static_lib_for_tdd", 44 ] 45 46 if (is_standard_system) { 47 external_deps = [ 48 "c_utils:utils", 49 "hilog:libhilog", 50 "ipc:ipc_single", 51 "samgr:samgr_proxy", 52 ] 53 } else { 54 external_deps = [ 55 "c_utils:utils", 56 "hilog:libhilog", 57 "ipc:ipc_single", 58 "samgr:samgr_proxy", 59 ] 60 cflags_cc = [ "-D__HIVIEW_HAVE_HITRACE__" ] 61 } 62} 63 64ohos_moduletest("HiSysEventNativeTest") { 65 module_out_path = module_output_path 66 67 sources = [ "hisysevent_native_test.cpp" ] 68 69 configs = [ ":hisysevent_native_test_config" ] 70 71 deps = [ 72 "../../../adapter/native/idl:sys_event_impl_client", 73 "../../../interfaces/native/innerkits/hisysevent:hisysevent_static_lib_for_tdd", 74 "../../../interfaces/native/innerkits/hisysevent_manager:hisyseventmanager_static_lib_for_tdd", 75 ] 76 77 if (is_standard_system) { 78 external_deps = [ 79 "c_utils:utils", 80 "hilog:libhilog", 81 ] 82 } else { 83 external_deps = [ 84 "c_utils:utils", 85 "hilog:libhilog", 86 ] 87 cflags_cc = [ "-D__HIVIEW_HAVE_HITRACE__" ] 88 } 89} 90 91ohos_moduletest("HiSysEventCTest") { 92 module_out_path = module_output_path 93 94 sources = [ "hisysevent_c_test.cpp" ] 95 96 configs = [ ":hisysevent_native_test_config" ] 97 98 external_deps = [ 99 "hilog:libhilog", 100 "hisysevent:libhisysevent", 101 ] 102 103 if (build_public_version) { 104 external_deps += [ "bounds_checking_function:libsec_shared" ] 105 } else { 106 external_deps += [ "bounds_checking_function:libsec_static" ] 107 } 108} 109 110ohos_moduletest("HiSysEventManagerCTest") { 111 module_out_path = module_output_path 112 113 include_dirs = 114 [ "//base/hiviewdfx/hisysevent/adapter/native/idl/include/ret_code.h" ] 115 116 sources = [ "hisysevent_manager_c_test.cpp" ] 117 118 configs = [ ":hisysevent_native_test_config" ] 119 120 deps = [ 121 "../../../frameworks/native/util:hisysevent_util", 122 "../../../interfaces/native/innerkits/hisysevent_manager:hisyseventmanager_static_lib_for_tdd", 123 ] 124 125 external_deps = [ "hilog:libhilog" ] 126 127 if (build_public_version) { 128 external_deps += [ "bounds_checking_function:libsec_shared" ] 129 } else { 130 external_deps += [ "bounds_checking_function:libsec_static" ] 131 } 132} 133 134ohos_moduletest("HiSysEventDelayTest") { 135 module_out_path = module_output_path 136 137 include_dirs = 138 [ "//base/hiviewdfx/hisysevent/adapter/native/idl/include/ret_code.h" ] 139 140 sources = [ "hisysevent_delay_test.cpp" ] 141 142 configs = [ ":hisysevent_native_test_config" ] 143 144 deps = [ 145 "../../../frameworks/native/util:hisysevent_util", 146 "../../../interfaces/native/innerkits/hisysevent:hisysevent_static_lib_for_tdd", 147 ] 148 149 external_deps = [ 150 "c_utils:utils", 151 "hilog:libhilog", 152 ] 153 154 if (build_public_version) { 155 external_deps += [ "bounds_checking_function:libsec_shared" ] 156 } else { 157 external_deps += [ "bounds_checking_function:libsec_static" ] 158 } 159} 160 161ohos_moduletest("HiSysEventWroteResultCheckTest") { 162 module_out_path = module_output_path 163 164 include_dirs = 165 [ "//base/hiviewdfx/hisysevent/adapter/native/idl/include/ret_code.h" ] 166 167 sources = [ "hisysevent_wrote_result_check_test.cpp" ] 168 169 configs = [ ":hisysevent_native_test_config" ] 170 171 deps = [ 172 "../../../frameworks/native/util:hisysevent_util", 173 "../../../interfaces/native/innerkits/hisysevent:hisysevent_static_lib_for_tdd", 174 "../../../interfaces/native/innerkits/hisysevent_manager:hisyseventmanager_static_lib_for_tdd", 175 ] 176 177 external_deps = [ "hilog:libhilog" ] 178 179 defines = [] 180 if (hiviewdfx_hitrace_enabaled_for_test) { 181 external_deps += [ "hitrace:libhitracechain" ] 182 defines += [ "HIVIEWDFX_HITRACE_ENABLED_FOR_TEST" ] 183 } 184 185 if (build_public_version) { 186 external_deps += [ "bounds_checking_function:libsec_shared" ] 187 } else { 188 external_deps += [ "bounds_checking_function:libsec_static" ] 189 } 190} 191 192ohos_moduletest("HiSysEventEncodedTest") { 193 module_out_path = module_output_path 194 195 include_dirs = 196 [ "//base/hiviewdfx/hisysevent/adapter/native/idl/include/ret_code.h" ] 197 198 sources = [ "hisysevent_encoded_test.cpp" ] 199 200 configs = [ ":hisysevent_native_test_config" ] 201 202 deps = [ 203 "../../../frameworks/native/util:hisysevent_util", 204 "../../../interfaces/native/innerkits/hisysevent:hisysevent_static_lib_for_tdd", 205 ] 206 207 external_deps = [ "hilog:libhilog" ] 208 209 if (build_public_version) { 210 external_deps += [ "bounds_checking_function:libsec_shared" ] 211 } else { 212 external_deps += [ "bounds_checking_function:libsec_static" ] 213 } 214} 215 216ohos_moduletest("HiSysEventEasyTest") { 217 module_out_path = module_output_path 218 219 sources = [ "hisysevent_easy_test.cpp" ] 220 221 configs = [ ":hisysevent_native_test_config" ] 222 223 deps = [ 224 "../../../interfaces/native/innerkits/hisysevent_easy:libhisysevent_easy", 225 ] 226 227 external_deps = [ "hilog:libhilog" ] 228 229 if (build_public_version) { 230 external_deps += [ "bounds_checking_function:libsec_shared" ] 231 } else { 232 external_deps += [ "bounds_checking_function:libsec_static" ] 233 } 234} 235 236group("moduletest") { 237 testonly = true 238 deps = [] 239 240 deps += [ 241 ":HiSysEventAdapterNativeTest", 242 ":HiSysEventCTest", 243 ":HiSysEventDelayTest", 244 ":HiSysEventEasyTest", 245 ":HiSysEventEncodedTest", 246 ":HiSysEventManagerCTest", 247 ":HiSysEventNativeTest", 248 ":HiSysEventWroteResultCheckTest", 249 ] 250} 251