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 "hisysevent:libhisysevent", 45 ] 46} 47 48ohos_unittest("WatchdogUnitTest") { 49 module_out_path = module_output_path 50 sources = [ "watchdog_interface_test.cpp" ] 51 52 configs = [ ":module_private_config" ] 53 54 deps = [ 55 "//base/hiviewdfx/hicollie/frameworks/native:libhicollie_source", 56 "//third_party/googletest:gtest_main", 57 ] 58 external_deps = [ 59 "c_utils:utils", 60 "ffrt:libffrt", 61 "hilog:libhilog", 62 "hisysevent:libhisysevent", 63 ] 64 65 defines = [] 66 if (defined(global_parts_info) && 67 defined(global_parts_info.notification_eventhandler)) { 68 external_deps += [ "eventhandler:libeventhandler" ] 69 } 70} 71 72ohos_unittest("WatchdogInnerUnitTest") { 73 module_out_path = module_output_path 74 sources = [ "watchdog_inner_test.cpp" ] 75 76 configs = [ ":module_private_config" ] 77 78 deps = [ 79 "//base/hiviewdfx/hicollie/frameworks/native:libhicollie_source", 80 "//third_party/googletest:gtest_main", 81 ] 82 external_deps = [ 83 "c_utils:utils", 84 "ffrt:libffrt", 85 "hilog:libhilog", 86 "hisysevent:libhisysevent", 87 ] 88 89 defines = [] 90 if (defined(global_parts_info) && 91 defined(global_parts_info.notification_eventhandler)) { 92 external_deps += [ "eventhandler:libeventhandler" ] 93 } 94 if (defined(global_parts_info) && 95 defined(global_parts_info.hiviewdfx_hiview)) { 96 external_deps += [ "hiview:libucollection_client" ] 97 defines += [ "HIVIEW_ENABLE" ] 98 } 99} 100 101ohos_unittest("HandlerCheckerTest") { 102 module_out_path = module_output_path 103 sources = [ "handler_checker_test.cpp" ] 104 105 configs = [ ":module_private_config" ] 106 107 deps = [ 108 "//base/hiviewdfx/hicollie/frameworks/native:libhicollie_source", 109 "//third_party/googletest:gtest_main", 110 ] 111 external_deps = [ 112 "c_utils:utils", 113 "ffrt:libffrt", 114 "hilog:libhilog", 115 "hisysevent:libhisysevent", 116 ] 117 118 defines = [] 119 if (defined(global_parts_info) && 120 defined(global_parts_info.notification_eventhandler)) { 121 external_deps += [ "eventhandler:libeventhandler" ] 122 } 123} 124 125ohos_unittest("WatchdogTaskTest") { 126 module_out_path = module_output_path 127 sources = [ "watchdog_task_test.cpp" ] 128 129 configs = [ ":module_private_config" ] 130 131 deps = [ 132 "//base/hiviewdfx/hicollie/frameworks/native:libhicollie_source", 133 "//third_party/googletest:gtest_main", 134 ] 135 external_deps = [ 136 "c_utils:utils", 137 "ffrt:libffrt", 138 "hilog:libhilog", 139 "hisysevent:libhisysevent", 140 ] 141 142 defines = [] 143 if (defined(global_parts_info) && 144 defined(global_parts_info.notification_eventhandler)) { 145 external_deps += [ "eventhandler:libeventhandler" ] 146 } 147} 148 149ohos_unittest("ThreadSamplerTest") { 150 module_out_path = module_output_path 151 sources = [ "thread_sampler_test.cpp" ] 152 configs = [ ":module_private_config" ] 153 deps = [ "//third_party/googletest:gtest_main" ] 154 external_deps = [ 155 "c_utils:utils", 156 "faultloggerd:libasync_stack", 157 "faultloggerd:libunwinder", 158 "ffrt:libffrt", 159 "hicollie:libhicollie", 160 "hilog:libhilog", 161 "hisysevent:libhisysevent", 162 ] 163} 164 165############################################################################### 166group("unittest") { 167 testonly = true 168 deps = [ 169 # deps file 170 ":HandlerCheckerTest", 171 ":ThreadSamplerTest", 172 ":WatchdogInnerUnitTest", 173 ":WatchdogTaskTest", 174 ":WatchdogUnitTest", 175 ":XCollieUnitTest", 176 ] 177} 178############################################################################### 179