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 = [ "watchdog_inner_test.cpp" ] 83 84 configs = [ ":module_private_config" ] 85 86 deps = [ 87 "//base/hiviewdfx/hicollie/frameworks/native:libhicollie_source", 88 "//third_party/googletest:gtest_main", 89 ] 90 external_deps = [ 91 "c_utils:utils", 92 "ffrt:libffrt", 93 "hilog:libhilog", 94 ] 95 96 defines = [] 97 if (defined(global_parts_info) && 98 defined(global_parts_info.notification_eventhandler)) { 99 external_deps += [ "eventhandler:libeventhandler" ] 100 } 101 if (defined(global_parts_info) && 102 defined(global_parts_info.hiviewdfx_hiview)) { 103 external_deps += [ "hiview:libucollection_client" ] 104 defines += [ "HIVIEW_ENABLE" ] 105 } 106 if (defined(global_parts_info.hiviewdfx_hisysevent)) { 107 external_deps += [ "hisysevent:libhisysevent" ] 108 defines += [ "HISYSEVENT_ENABLE" ] 109 } 110} 111 112ohos_unittest("HandlerCheckerTest") { 113 module_out_path = module_output_path 114 sources = [ "handler_checker_test.cpp" ] 115 116 configs = [ ":module_private_config" ] 117 118 deps = [ 119 "//base/hiviewdfx/hicollie/frameworks/native:libhicollie_source", 120 "//third_party/googletest:gtest_main", 121 ] 122 external_deps = [ 123 "c_utils:utils", 124 "ffrt:libffrt", 125 "hilog:libhilog", 126 ] 127 128 defines = [] 129 if (defined(global_parts_info) && 130 defined(global_parts_info.notification_eventhandler)) { 131 external_deps += [ "eventhandler:libeventhandler" ] 132 } 133 if (defined(global_parts_info.hiviewdfx_hisysevent)) { 134 external_deps += [ "hisysevent:libhisysevent" ] 135 defines += [ "HISYSEVENT_ENABLE" ] 136 } 137} 138 139ohos_unittest("WatchdogTaskTest") { 140 module_out_path = module_output_path 141 sources = [ "watchdog_task_test.cpp" ] 142 143 configs = [ ":module_private_config" ] 144 145 deps = [ 146 "//base/hiviewdfx/hicollie/frameworks/native:libhicollie_source", 147 "//third_party/googletest:gtest_main", 148 ] 149 external_deps = [ 150 "c_utils:utils", 151 "ffrt:libffrt", 152 "hilog:libhilog", 153 ] 154 155 defines = [] 156 if (defined(global_parts_info) && 157 defined(global_parts_info.notification_eventhandler)) { 158 external_deps += [ "eventhandler:libeventhandler" ] 159 } 160 if (defined(global_parts_info.hiviewdfx_hisysevent)) { 161 external_deps += [ "hisysevent:libhisysevent" ] 162 defines += [ "HISYSEVENT_ENABLE" ] 163 } 164} 165 166ohos_unittest("ThreadSamplerTest") { 167 module_out_path = module_output_path 168 sources = [ "thread_sampler_test.cpp" ] 169 configs = [ ":module_private_config" ] 170 deps = [ "//third_party/googletest:gtest_main" ] 171 external_deps = [ 172 "c_utils:utils", 173 "faultloggerd:libasync_stack", 174 "faultloggerd:libunwinder", 175 "ffrt:libffrt", 176 "hicollie:libhicollie", 177 "hilog:libhilog", 178 ] 179 defines = [] 180 if (defined(global_parts_info.hiviewdfx_hisysevent)) { 181 external_deps += [ "hisysevent:libhisysevent" ] 182 defines += [ "HISYSEVENT_ENABLE" ] 183 } 184} 185 186############################################################################### 187group("unittest") { 188 testonly = true 189 deps = [ 190 # deps file 191 ":HandlerCheckerTest", 192 ":ThreadSamplerTest", 193 ":WatchdogInnerUnitTest", 194 ":WatchdogTaskTest", 195 ":WatchdogUnitTest", 196 ":XCollieUnitTest", 197 ] 198} 199############################################################################### 200