1# Copyright (c) 2021-2022 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") 15import("//base/hiviewdfx/hicollie/hicollie.gni") 16 17module_output_path = "hicollie/hicollie" 18hicollie_part_path = "//base/hiviewdfx/hicollie" 19 20############################################################################### 21config("module_private_config") { 22 visibility = [ ":*" ] 23 include_dirs = [ 24 ".", 25 "${hicollie_part_path}/frameworks/native", 26 "${hicollie_part_path}/frameworks/native/test", 27 "${hicollie_part_path}/interfaces/native/innerkits/include/xcollie", 28 ] 29} 30 31##############################unittest########################################## 32ohos_unittest("XCollieUnitTest") { 33 module_out_path = module_output_path 34 sources = [ "xcollie_interface_test.cpp" ] 35 36 configs = [ ":module_private_config" ] 37 38 deps = [ "//base/hiviewdfx/hicollie/frameworks/native:libhicollie_source" ] 39 40 external_deps = [ 41 "c_utils:utils", 42 "googletest:gtest_main", 43 "hilog:libhilog", 44 ] 45 defines = [] 46 if (defined(global_parts_info.hiviewdfx_hisysevent)) { 47 external_deps += [ "hisysevent:libhisysevent" ] 48 defines += [ "HISYSEVENT_ENABLE" ] 49 } 50} 51 52##############################unittest########################################## 53ohos_unittest("IpcFullUnitTest") { 54 module_out_path = module_output_path 55 sources = [ "ipc_full_test.cpp" ] 56 57 configs = [ ":module_private_config" ] 58 59 deps = [ "//base/hiviewdfx/hicollie/frameworks/native:libhicollie_source" ] 60 61 external_deps = [ 62 "c_utils:utils", 63 "googletest:gtest_main", 64 "hilog:libhilog", 65 ] 66 defines = [] 67 if (defined(global_parts_info.hiviewdfx_hisysevent)) { 68 external_deps += [ "hisysevent:libhisysevent" ] 69 defines += [ "HISYSEVENT_ENABLE" ] 70 } 71} 72 73ohos_unittest("WatchdogUnitTest") { 74 module_out_path = module_output_path 75 sources = [ "watchdog_interface_test.cpp" ] 76 77 configs = [ ":module_private_config" ] 78 79 deps = [ "//base/hiviewdfx/hicollie/frameworks/native:libhicollie_source" ] 80 81 external_deps = [ 82 "c_utils:utils", 83 "ffrt:libffrt", 84 "googletest:gtest_main", 85 "hilog:libhilog", 86 ] 87 88 defines = [] 89 if (defined(global_parts_info) && 90 defined(global_parts_info.notification_eventhandler)) { 91 external_deps += [ "eventhandler:libeventhandler" ] 92 } 93 94 if (defined(global_parts_info.hiviewdfx_hisysevent)) { 95 external_deps += [ "hisysevent:libhisysevent" ] 96 defines += [ "HISYSEVENT_ENABLE" ] 97 } 98} 99 100ohos_unittest("WatchdogInnerUnitTest") { 101 module_out_path = module_output_path 102 sources = [ 103 "watchdog_inner_test.cpp", 104 "watchdog_inner_util_test.cpp", 105 ] 106 107 configs = [ ":module_private_config" ] 108 109 deps = [ "//base/hiviewdfx/hicollie/frameworks/native:libhicollie_source" ] 110 111 external_deps = [ 112 "c_utils:utils", 113 "ffrt:libffrt", 114 "googletest:gtest_main", 115 "hilog:libhilog", 116 "init:libbegetutil", 117 ] 118 119 defines = [] 120 if (defined(global_parts_info) && 121 defined(global_parts_info.notification_eventhandler)) { 122 external_deps += [ "eventhandler:libeventhandler" ] 123 } 124 if (defined(global_parts_info) && 125 defined(global_parts_info.hiviewdfx_hiview)) { 126 external_deps += [ "hiview:libucollection_client" ] 127 defines += [ "HIVIEW_ENABLE" ] 128 } 129 if (defined(global_parts_info.hiviewdfx_hisysevent)) { 130 external_deps += [ "hisysevent:libhisysevent" ] 131 defines += [ "HISYSEVENT_ENABLE" ] 132 } 133} 134 135ohos_unittest("WatchdogInnerTaskTest") { 136 module_out_path = module_output_path 137 sources = [ 138 "watchdog_inner_task_test.cpp", 139 "watchdog_inner_util_test.cpp", 140 ] 141 142 configs = [ ":module_private_config" ] 143 144 deps = [ "//base/hiviewdfx/hicollie/frameworks/native:libhicollie_source" ] 145 146 external_deps = [ 147 "c_utils:utils", 148 "ffrt:libffrt", 149 "googletest:gtest_main", 150 "hilog:libhilog", 151 "init:libbegetutil", 152 ] 153 154 defines = [] 155 if (defined(global_parts_info) && 156 defined(global_parts_info.notification_eventhandler)) { 157 external_deps += [ "eventhandler:libeventhandler" ] 158 } 159 if (defined(global_parts_info) && 160 defined(global_parts_info.hiviewdfx_hiview)) { 161 external_deps += [ "hiview:libucollection_client" ] 162 defines += [ "HIVIEW_ENABLE" ] 163 } 164 if (defined(global_parts_info.hiviewdfx_hisysevent)) { 165 external_deps += [ "hisysevent:libhisysevent" ] 166 defines += [ "HISYSEVENT_ENABLE" ] 167 } 168} 169 170ohos_unittest("HandlerCheckerTest") { 171 module_out_path = module_output_path 172 sources = [ "handler_checker_test.cpp" ] 173 174 configs = [ ":module_private_config" ] 175 176 deps = [ "//base/hiviewdfx/hicollie/frameworks/native:libhicollie_source" ] 177 178 external_deps = [ 179 "c_utils:utils", 180 "ffrt:libffrt", 181 "googletest:gtest_main", 182 "hilog:libhilog", 183 ] 184 185 defines = [] 186 if (defined(global_parts_info) && 187 defined(global_parts_info.notification_eventhandler)) { 188 external_deps += [ "eventhandler:libeventhandler" ] 189 } 190 if (defined(global_parts_info.hiviewdfx_hisysevent)) { 191 external_deps += [ "hisysevent:libhisysevent" ] 192 defines += [ "HISYSEVENT_ENABLE" ] 193 } 194} 195 196ohos_unittest("WatchdogTaskTest") { 197 module_out_path = module_output_path 198 sources = [ "watchdog_task_test.cpp" ] 199 200 configs = [ ":module_private_config" ] 201 202 deps = [ "//base/hiviewdfx/hicollie/frameworks/native:libhicollie_source" ] 203 204 external_deps = [ 205 "c_utils:utils", 206 "ffrt:libffrt", 207 "googletest:gtest_main", 208 "hilog:libhilog", 209 ] 210 211 defines = [] 212 if (hicollie_suspend_check_enable) { 213 defines += [ "SUSPEND_CHECK_ENABLE" ] 214 } 215 if (defined(global_parts_info) && 216 defined(global_parts_info.notification_eventhandler)) { 217 external_deps += [ "eventhandler:libeventhandler" ] 218 } 219 if (defined(global_parts_info.hiviewdfx_hisysevent)) { 220 external_deps += [ "hisysevent:libhisysevent" ] 221 defines += [ "HISYSEVENT_ENABLE" ] 222 } 223} 224 225ohos_unittest("ThreadSamplerTest") { 226 module_out_path = module_output_path 227 sources = [ "thread_sampler_test.cpp" ] 228 configs = [ ":module_private_config" ] 229 deps = [] 230 external_deps = [ 231 "c_utils:utils", 232 "faultloggerd:libasync_stack", 233 "faultloggerd:libunwinder", 234 "ffrt:libffrt", 235 "googletest:gtest_main", 236 "hicollie:libhicollie", 237 "hilog:libhilog", 238 ] 239 defines = [] 240 if (defined(global_parts_info.hiviewdfx_hisysevent)) { 241 external_deps += [ "hisysevent:libhisysevent" ] 242 defines += [ "HISYSEVENT_ENABLE" ] 243 } 244} 245 246############################################################################### 247group("unittest") { 248 testonly = true 249 deps = [ 250 # deps file 251 ":HandlerCheckerTest", 252 ":ThreadSamplerTest", 253 ":WatchdogInnerTaskTest", 254 ":WatchdogInnerUnitTest", 255 ":WatchdogTaskTest", 256 ":WatchdogUnitTest", 257 ":XCollieUnitTest", 258 ":IpcFullUnitTest" 259 ] 260} 261############################################################################### 262