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_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 = [ "hilog:libhilog" ] 150 151 if (build_public_version) { 152 external_deps += [ "bounds_checking_function:libsec_shared" ] 153 } else { 154 external_deps += [ "bounds_checking_function:libsec_static" ] 155 } 156} 157 158ohos_moduletest("HiSysEventWroteResultCheckTest") { 159 module_out_path = module_output_path 160 161 include_dirs = 162 [ "//base/hiviewdfx/hisysevent/adapter/native/idl/include/ret_code.h" ] 163 164 sources = [ "hisysevent_wrote_result_check_test.cpp" ] 165 166 configs = [ ":hisysevent_native_test_config" ] 167 168 deps = [ 169 "../../../frameworks/native/util:hisysevent_util", 170 "../../../interfaces/native/innerkits/hisysevent:hisysevent_static_lib_for_tdd", 171 "../../../interfaces/native/innerkits/hisysevent_manager:hisyseventmanager_static_lib_for_tdd", 172 ] 173 174 external_deps = [ "hilog:libhilog" ] 175 176 defines = [] 177 if (hiviewdfx_hitrace_enabaled_for_test) { 178 external_deps += [ "hitrace:libhitracechain" ] 179 defines += [ "HIVIEWDFX_HITRACE_ENABLED_FOR_TEST" ] 180 } 181 182 if (build_public_version) { 183 external_deps += [ "bounds_checking_function:libsec_shared" ] 184 } else { 185 external_deps += [ "bounds_checking_function:libsec_static" ] 186 } 187} 188 189ohos_moduletest("HiSysEventEncodedTest") { 190 module_out_path = module_output_path 191 192 include_dirs = 193 [ "//base/hiviewdfx/hisysevent/adapter/native/idl/include/ret_code.h" ] 194 195 sources = [ "hisysevent_encoded_test.cpp" ] 196 197 configs = [ ":hisysevent_native_test_config" ] 198 199 deps = [ 200 "../../../frameworks/native/util:hisysevent_util", 201 "../../../interfaces/native/innerkits/hisysevent:hisysevent_static_lib_for_tdd", 202 ] 203 204 external_deps = [ "hilog:libhilog" ] 205 206 if (build_public_version) { 207 external_deps += [ "bounds_checking_function:libsec_shared" ] 208 } else { 209 external_deps += [ "bounds_checking_function:libsec_static" ] 210 } 211} 212 213ohos_moduletest("HiSysEventEasyTest") { 214 module_out_path = module_output_path 215 216 sources = [ "hisysevent_easy_test.cpp" ] 217 218 configs = [ ":hisysevent_native_test_config" ] 219 220 deps = [ 221 "../../../interfaces/native/innerkits/hisysevent_easy:libhisysevent_easy", 222 ] 223 224 external_deps = [ "hilog:libhilog" ] 225 226 if (build_public_version) { 227 external_deps += [ "bounds_checking_function:libsec_shared" ] 228 } else { 229 external_deps += [ "bounds_checking_function:libsec_static" ] 230 } 231} 232 233group("moduletest") { 234 testonly = true 235 deps = [] 236 237 deps += [ 238 ":HiSysEventAdapterNativeTest", 239 ":HiSysEventCTest", 240 ":HiSysEventDelayTest", 241 ":HiSysEventEasyTest", 242 ":HiSysEventEncodedTest", 243 ":HiSysEventManagerCTest", 244 ":HiSysEventNativeTest", 245 ":HiSysEventWroteResultCheckTest", 246 ] 247} 248