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