1# Copyright (c) 2021-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 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 "../../../adapter/native/idl:sys_event_service_gen_src_client", 42 "../../../frameworks/native/util:hisysevent_util", 43 "../../../interfaces/native/innerkits/hisysevent:hisysevent_static_lib_for_tdd", 44 "../../../interfaces/native/innerkits/hisysevent_manager:hisyseventmanager_static_lib_for_tdd", 45 ] 46 47 if (is_standard_system) { 48 external_deps = [ 49 "c_utils:utils", 50 "hilog:libhilog", 51 "ipc:ipc_single", 52 "samgr:samgr_proxy", 53 ] 54 } else { 55 external_deps = [ 56 "c_utils:utils", 57 "hilog:libhilog", 58 "ipc:ipc_single", 59 "samgr:samgr_proxy", 60 ] 61 cflags_cc = [ "-D__HIVIEW_HAVE_HITRACE__" ] 62 } 63} 64 65ohos_moduletest("HiSysEventNativeTest") { 66 module_out_path = module_output_path 67 68 sources = [ "hisysevent_native_test.cpp" ] 69 70 configs = [ ":hisysevent_native_test_config" ] 71 72 deps = [ 73 "../../../adapter/native/idl:sys_event_impl_client", 74 "../../../adapter/native/idl:sys_event_service_gen_src_client", 75 "../../../interfaces/native/innerkits/hisysevent:hisysevent_static_lib_for_tdd", 76 "../../../interfaces/native/innerkits/hisysevent_manager:hisyseventmanager_static_lib_for_tdd", 77 ] 78 79 if (is_standard_system) { 80 external_deps = [ 81 "c_utils:utils", 82 "hilog:libhilog", 83 ] 84 } else { 85 external_deps = [ 86 "c_utils:utils", 87 "hilog:libhilog", 88 ] 89 cflags_cc = [ "-D__HIVIEW_HAVE_HITRACE__" ] 90 } 91} 92 93ohos_moduletest("HiSysEventCTest") { 94 module_out_path = module_output_path 95 96 sources = [ "hisysevent_c_test.cpp" ] 97 98 configs = [ ":hisysevent_native_test_config" ] 99 100 external_deps = [ 101 "hilog:libhilog", 102 "hisysevent:libhisysevent", 103 ] 104 105 if (build_public_version) { 106 external_deps += [ "bounds_checking_function:libsec_shared" ] 107 } else { 108 external_deps += [ "bounds_checking_function:libsec_static" ] 109 } 110} 111 112ohos_moduletest("HiSysEventManagerCTest") { 113 module_out_path = module_output_path 114 115 include_dirs = 116 [ "//base/hiviewdfx/hisysevent/adapter/native/idl/include/ret_code.h" ] 117 118 sources = [ "hisysevent_manager_c_test.cpp" ] 119 120 configs = [ ":hisysevent_native_test_config" ] 121 122 deps = [ 123 "../../../frameworks/native/util:hisysevent_util", 124 "../../../interfaces/native/innerkits/hisysevent_manager:hisyseventmanager_static_lib_for_tdd", 125 ] 126 127 external_deps = [ "hilog:libhilog" ] 128 129 if (build_public_version) { 130 external_deps += [ "bounds_checking_function:libsec_shared" ] 131 } else { 132 external_deps += [ "bounds_checking_function:libsec_static" ] 133 } 134} 135 136ohos_moduletest("HiSysEventDelayTest") { 137 module_out_path = module_output_path 138 139 include_dirs = 140 [ "//base/hiviewdfx/hisysevent/adapter/native/idl/include/ret_code.h" ] 141 142 sources = [ "hisysevent_delay_test.cpp" ] 143 144 configs = [ ":hisysevent_native_test_config" ] 145 146 deps = [ 147 "../../../frameworks/native/util:hisysevent_util", 148 "../../../interfaces/native/innerkits/hisysevent:hisysevent_static_lib_for_tdd", 149 ] 150 151 external_deps = [ "hilog:libhilog" ] 152 153 if (build_public_version) { 154 external_deps += [ "bounds_checking_function:libsec_shared" ] 155 } else { 156 external_deps += [ "bounds_checking_function:libsec_static" ] 157 } 158} 159 160ohos_moduletest("HiSysEventWroteResultCheckTest") { 161 module_out_path = module_output_path 162 163 include_dirs = 164 [ "//base/hiviewdfx/hisysevent/adapter/native/idl/include/ret_code.h" ] 165 166 sources = [ "hisysevent_wrote_result_check_test.cpp" ] 167 168 configs = [ ":hisysevent_native_test_config" ] 169 170 deps = [ 171 "../../../frameworks/native/util:hisysevent_util", 172 "../../../interfaces/native/innerkits/hisysevent:hisysevent_static_lib_for_tdd", 173 "../../../interfaces/native/innerkits/hisysevent_manager:hisyseventmanager_static_lib_for_tdd", 174 ] 175 176 external_deps = [ "hilog:libhilog" ] 177 178 defines = [] 179 if (hiviewdfx_hitrace_enabaled_for_test) { 180 external_deps += [ "hitrace:libhitracechain" ] 181 defines += [ "HIVIEWDFX_HITRACE_ENABLED_FOR_TEST" ] 182 } 183 184 if (build_public_version) { 185 external_deps += [ "bounds_checking_function:libsec_shared" ] 186 } else { 187 external_deps += [ "bounds_checking_function:libsec_static" ] 188 } 189} 190 191ohos_moduletest("HiSysEventEncodedTest") { 192 module_out_path = module_output_path 193 194 include_dirs = 195 [ "//base/hiviewdfx/hisysevent/adapter/native/idl/include/ret_code.h" ] 196 197 sources = [ "hisysevent_encoded_test.cpp" ] 198 199 configs = [ ":hisysevent_native_test_config" ] 200 201 deps = [ 202 "../../../frameworks/native/util:hisysevent_util", 203 "../../../interfaces/native/innerkits/hisysevent:hisysevent_static_lib_for_tdd", 204 ] 205 206 external_deps = [ "hilog:libhilog" ] 207 208 if (build_public_version) { 209 external_deps += [ "bounds_checking_function:libsec_shared" ] 210 } else { 211 external_deps += [ "bounds_checking_function:libsec_static" ] 212 } 213} 214 215group("moduletest") { 216 testonly = true 217 deps = [] 218 219 deps += [ 220 ":HiSysEventAdapterNativeTest", 221 ":HiSysEventCTest", 222 ":HiSysEventDelayTest", 223 ":HiSysEventEncodedTest", 224 ":HiSysEventManagerCTest", 225 ":HiSysEventNativeTest", 226 ":HiSysEventWroteResultCheckTest", 227 ] 228} 229