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") 15 16module_output_path = "hiviewdfx/hicollie" 17hicollie_part_path = "//base/hiviewdfx/hicollie" 18 19############################################################################### 20config("module_private_config") { 21 visibility = [ ":*" ] 22 include_dirs = [ 23 ".", 24 "${hicollie_part_path}/frameworks/native", 25 "${hicollie_part_path}/frameworks/native/test", 26 "${hicollie_part_path}/interfaces/native/innerkits/include/xcollie", 27 ] 28} 29 30##############################unittest########################################## 31ohos_unittest("XCollieUnitTest") { 32 module_out_path = module_output_path 33 sources = [ "xcollie_interface_test.cpp" ] 34 35 configs = [ ":module_private_config" ] 36 37 deps = [ 38 "//base/hiviewdfx/hicollie/frameworks/native:libhicollie_source", 39 "//third_party/googletest:gtest_main", 40 ] 41 external_deps = [ 42 "c_utils:utils", 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 52ohos_unittest("WatchdogUnitTest") { 53 module_out_path = module_output_path 54 sources = [ "watchdog_interface_test.cpp" ] 55 56 configs = [ ":module_private_config" ] 57 58 deps = [ 59 "//base/hiviewdfx/hicollie/frameworks/native:libhicollie_source", 60 "//third_party/googletest:gtest_main", 61 ] 62 external_deps = [ 63 "c_utils:utils", 64 "ffrt:libffrt", 65 "hilog:libhilog", 66 ] 67 68 defines = [] 69 if (defined(global_parts_info) && 70 defined(global_parts_info.notification_eventhandler)) { 71 external_deps += [ "eventhandler:libeventhandler" ] 72 } 73 74 if (defined(global_parts_info.hiviewdfx_hisysevent)) { 75 external_deps += [ "hisysevent:libhisysevent" ] 76 defines += [ "HISYSEVENT_ENABLE" ] 77 } 78} 79 80ohos_unittest("WatchdogInnerUnitTest") { 81 module_out_path = module_output_path 82 sources = [ 83 "watchdog_inner_test.cpp", 84 "watchdog_inner_util_test.cpp", 85 ] 86 87 configs = [ ":module_private_config" ] 88 89 deps = [ 90 "//base/hiviewdfx/hicollie/frameworks/native:libhicollie_source", 91 "//third_party/googletest:gtest_main", 92 ] 93 external_deps = [ 94 "c_utils:utils", 95 "ffrt:libffrt", 96 "hilog:libhilog", 97 "init:libbegetutil", 98 ] 99 100 defines = [] 101 if (defined(global_parts_info) && 102 defined(global_parts_info.notification_eventhandler)) { 103 external_deps += [ "eventhandler:libeventhandler" ] 104 } 105 if (defined(global_parts_info) && 106 defined(global_parts_info.hiviewdfx_hiview)) { 107 external_deps += [ "hiview:libucollection_client" ] 108 defines += [ "HIVIEW_ENABLE" ] 109 } 110 if (defined(global_parts_info.hiviewdfx_hisysevent)) { 111 external_deps += [ "hisysevent:libhisysevent" ] 112 defines += [ "HISYSEVENT_ENABLE" ] 113 } 114} 115 116ohos_unittest("HandlerCheckerTest") { 117 module_out_path = module_output_path 118 sources = [ "handler_checker_test.cpp" ] 119 120 configs = [ ":module_private_config" ] 121 122 deps = [ 123 "//base/hiviewdfx/hicollie/frameworks/native:libhicollie_source", 124 "//third_party/googletest:gtest_main", 125 ] 126 external_deps = [ 127 "c_utils:utils", 128 "ffrt:libffrt", 129 "hilog:libhilog", 130 ] 131 132 defines = [] 133 if (defined(global_parts_info) && 134 defined(global_parts_info.notification_eventhandler)) { 135 external_deps += [ "eventhandler:libeventhandler" ] 136 } 137 if (defined(global_parts_info.hiviewdfx_hisysevent)) { 138 external_deps += [ "hisysevent:libhisysevent" ] 139 defines += [ "HISYSEVENT_ENABLE" ] 140 } 141} 142 143ohos_unittest("WatchdogTaskTest") { 144 module_out_path = module_output_path 145 sources = [ "watchdog_task_test.cpp" ] 146 147 configs = [ ":module_private_config" ] 148 149 deps = [ 150 "//base/hiviewdfx/hicollie/frameworks/native:libhicollie_source", 151 "//third_party/googletest:gtest_main", 152 ] 153 external_deps = [ 154 "c_utils:utils", 155 "ffrt:libffrt", 156 "hilog:libhilog", 157 ] 158 159 defines = [] 160 if (defined(global_parts_info) && 161 defined(global_parts_info.notification_eventhandler)) { 162 external_deps += [ "eventhandler:libeventhandler" ] 163 } 164 if (defined(global_parts_info.hiviewdfx_hisysevent)) { 165 external_deps += [ "hisysevent:libhisysevent" ] 166 defines += [ "HISYSEVENT_ENABLE" ] 167 } 168} 169 170ohos_unittest("ThreadSamplerTest") { 171 module_out_path = module_output_path 172 sources = [ "thread_sampler_test.cpp" ] 173 configs = [ ":module_private_config" ] 174 deps = [ "//third_party/googletest:gtest_main" ] 175 external_deps = [ 176 "c_utils:utils", 177 "faultloggerd:libasync_stack", 178 "faultloggerd:libunwinder", 179 "ffrt:libffrt", 180 "hicollie:libhicollie", 181 "hilog:libhilog", 182 ] 183 defines = [] 184 if (defined(global_parts_info.hiviewdfx_hisysevent)) { 185 external_deps += [ "hisysevent:libhisysevent" ] 186 defines += [ "HISYSEVENT_ENABLE" ] 187 } 188} 189 190############################################################################### 191group("unittest") { 192 testonly = true 193 deps = [ 194 # deps file 195 ":HandlerCheckerTest", 196 ":ThreadSamplerTest", 197 ":WatchdogInnerUnitTest", 198 ":WatchdogTaskTest", 199 ":WatchdogUnitTest", 200 ":XCollieUnitTest", 201 ] 202} 203############################################################################### 204