1209bc2fbSopenharmony_ci# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
2209bc2fbSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3209bc2fbSopenharmony_ci# you may not use this file except in compliance with the License.
4209bc2fbSopenharmony_ci# You may obtain a copy of the License at
5209bc2fbSopenharmony_ci#
6209bc2fbSopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
7209bc2fbSopenharmony_ci#
8209bc2fbSopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9209bc2fbSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10209bc2fbSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11209bc2fbSopenharmony_ci# See the License for the specific language governing permissions and
12209bc2fbSopenharmony_ci# limitations under the License.
13209bc2fbSopenharmony_ci
14209bc2fbSopenharmony_ciimport("//build/test.gni")
15209bc2fbSopenharmony_ci
16209bc2fbSopenharmony_cimodule_output_path = "hiviewdfx/hicollie"
17209bc2fbSopenharmony_cihicollie_part_path = "//base/hiviewdfx/hicollie"
18209bc2fbSopenharmony_ci
19209bc2fbSopenharmony_ci###############################################################################
20209bc2fbSopenharmony_ciconfig("module_private_config") {
21209bc2fbSopenharmony_ci  visibility = [ ":*" ]
22209bc2fbSopenharmony_ci  include_dirs = [
23209bc2fbSopenharmony_ci    ".",
24209bc2fbSopenharmony_ci    "${hicollie_part_path}/frameworks/native",
25209bc2fbSopenharmony_ci    "${hicollie_part_path}/frameworks/native/test",
26209bc2fbSopenharmony_ci    "${hicollie_part_path}/interfaces/native/innerkits/include/xcollie",
27209bc2fbSopenharmony_ci  ]
28209bc2fbSopenharmony_ci}
29209bc2fbSopenharmony_ci
30209bc2fbSopenharmony_ci##############################unittest##########################################
31209bc2fbSopenharmony_ciohos_unittest("XCollieUnitTest") {
32209bc2fbSopenharmony_ci  module_out_path = module_output_path
33209bc2fbSopenharmony_ci  sources = [ "xcollie_interface_test.cpp" ]
34209bc2fbSopenharmony_ci
35209bc2fbSopenharmony_ci  configs = [ ":module_private_config" ]
36209bc2fbSopenharmony_ci
37209bc2fbSopenharmony_ci  deps = [
38209bc2fbSopenharmony_ci    "//base/hiviewdfx/hicollie/frameworks/native:libhicollie_source",
39209bc2fbSopenharmony_ci    "//third_party/googletest:gtest_main",
40209bc2fbSopenharmony_ci  ]
41209bc2fbSopenharmony_ci  external_deps = [
42209bc2fbSopenharmony_ci    "c_utils:utils",
43209bc2fbSopenharmony_ci    "hilog:libhilog",
44209bc2fbSopenharmony_ci  ]
45209bc2fbSopenharmony_ci  defines = []
46209bc2fbSopenharmony_ci  if (defined(global_parts_info.hiviewdfx_hisysevent)) {
47209bc2fbSopenharmony_ci    external_deps += [ "hisysevent:libhisysevent" ]
48209bc2fbSopenharmony_ci    defines += [ "HISYSEVENT_ENABLE" ]
49209bc2fbSopenharmony_ci  }
50209bc2fbSopenharmony_ci}
51209bc2fbSopenharmony_ci
52209bc2fbSopenharmony_ciohos_unittest("WatchdogUnitTest") {
53209bc2fbSopenharmony_ci  module_out_path = module_output_path
54209bc2fbSopenharmony_ci  sources = [ "watchdog_interface_test.cpp" ]
55209bc2fbSopenharmony_ci
56209bc2fbSopenharmony_ci  configs = [ ":module_private_config" ]
57209bc2fbSopenharmony_ci
58209bc2fbSopenharmony_ci  deps = [
59209bc2fbSopenharmony_ci    "//base/hiviewdfx/hicollie/frameworks/native:libhicollie_source",
60209bc2fbSopenharmony_ci    "//third_party/googletest:gtest_main",
61209bc2fbSopenharmony_ci  ]
62209bc2fbSopenharmony_ci  external_deps = [
63209bc2fbSopenharmony_ci    "c_utils:utils",
64209bc2fbSopenharmony_ci    "ffrt:libffrt",
65209bc2fbSopenharmony_ci    "hilog:libhilog",
66209bc2fbSopenharmony_ci  ]
67209bc2fbSopenharmony_ci
68209bc2fbSopenharmony_ci  defines = []
69209bc2fbSopenharmony_ci  if (defined(global_parts_info) &&
70209bc2fbSopenharmony_ci      defined(global_parts_info.notification_eventhandler)) {
71209bc2fbSopenharmony_ci    external_deps += [ "eventhandler:libeventhandler" ]
72209bc2fbSopenharmony_ci  }
73209bc2fbSopenharmony_ci
74209bc2fbSopenharmony_ci  if (defined(global_parts_info.hiviewdfx_hisysevent)) {
75209bc2fbSopenharmony_ci    external_deps += [ "hisysevent:libhisysevent" ]
76209bc2fbSopenharmony_ci    defines += [ "HISYSEVENT_ENABLE" ]
77209bc2fbSopenharmony_ci  }
78209bc2fbSopenharmony_ci}
79209bc2fbSopenharmony_ci
80209bc2fbSopenharmony_ciohos_unittest("WatchdogInnerUnitTest") {
81209bc2fbSopenharmony_ci  module_out_path = module_output_path
82209bc2fbSopenharmony_ci  sources = [ "watchdog_inner_test.cpp" ]
83209bc2fbSopenharmony_ci
84209bc2fbSopenharmony_ci  configs = [ ":module_private_config" ]
85209bc2fbSopenharmony_ci
86209bc2fbSopenharmony_ci  deps = [
87209bc2fbSopenharmony_ci    "//base/hiviewdfx/hicollie/frameworks/native:libhicollie_source",
88209bc2fbSopenharmony_ci    "//third_party/googletest:gtest_main",
89209bc2fbSopenharmony_ci  ]
90209bc2fbSopenharmony_ci  external_deps = [
91209bc2fbSopenharmony_ci    "c_utils:utils",
92209bc2fbSopenharmony_ci    "ffrt:libffrt",
93209bc2fbSopenharmony_ci    "hilog:libhilog",
94209bc2fbSopenharmony_ci  ]
95209bc2fbSopenharmony_ci
96209bc2fbSopenharmony_ci  defines = []
97209bc2fbSopenharmony_ci  if (defined(global_parts_info) &&
98209bc2fbSopenharmony_ci      defined(global_parts_info.notification_eventhandler)) {
99209bc2fbSopenharmony_ci    external_deps += [ "eventhandler:libeventhandler" ]
100209bc2fbSopenharmony_ci  }
101209bc2fbSopenharmony_ci  if (defined(global_parts_info) &&
102209bc2fbSopenharmony_ci      defined(global_parts_info.hiviewdfx_hiview)) {
103209bc2fbSopenharmony_ci    external_deps += [ "hiview:libucollection_client" ]
104209bc2fbSopenharmony_ci    defines += [ "HIVIEW_ENABLE" ]
105209bc2fbSopenharmony_ci  }
106209bc2fbSopenharmony_ci  if (defined(global_parts_info.hiviewdfx_hisysevent)) {
107209bc2fbSopenharmony_ci    external_deps += [ "hisysevent:libhisysevent" ]
108209bc2fbSopenharmony_ci    defines += [ "HISYSEVENT_ENABLE" ]
109209bc2fbSopenharmony_ci  }
110209bc2fbSopenharmony_ci}
111209bc2fbSopenharmony_ci
112209bc2fbSopenharmony_ciohos_unittest("HandlerCheckerTest") {
113209bc2fbSopenharmony_ci  module_out_path = module_output_path
114209bc2fbSopenharmony_ci  sources = [ "handler_checker_test.cpp" ]
115209bc2fbSopenharmony_ci
116209bc2fbSopenharmony_ci  configs = [ ":module_private_config" ]
117209bc2fbSopenharmony_ci
118209bc2fbSopenharmony_ci  deps = [
119209bc2fbSopenharmony_ci    "//base/hiviewdfx/hicollie/frameworks/native:libhicollie_source",
120209bc2fbSopenharmony_ci    "//third_party/googletest:gtest_main",
121209bc2fbSopenharmony_ci  ]
122209bc2fbSopenharmony_ci  external_deps = [
123209bc2fbSopenharmony_ci    "c_utils:utils",
124209bc2fbSopenharmony_ci    "ffrt:libffrt",
125209bc2fbSopenharmony_ci    "hilog:libhilog",
126209bc2fbSopenharmony_ci  ]
127209bc2fbSopenharmony_ci
128209bc2fbSopenharmony_ci  defines = []
129209bc2fbSopenharmony_ci  if (defined(global_parts_info) &&
130209bc2fbSopenharmony_ci      defined(global_parts_info.notification_eventhandler)) {
131209bc2fbSopenharmony_ci    external_deps += [ "eventhandler:libeventhandler" ]
132209bc2fbSopenharmony_ci  }
133209bc2fbSopenharmony_ci  if (defined(global_parts_info.hiviewdfx_hisysevent)) {
134209bc2fbSopenharmony_ci    external_deps += [ "hisysevent:libhisysevent" ]
135209bc2fbSopenharmony_ci    defines += [ "HISYSEVENT_ENABLE" ]
136209bc2fbSopenharmony_ci  }
137209bc2fbSopenharmony_ci}
138209bc2fbSopenharmony_ci
139209bc2fbSopenharmony_ciohos_unittest("WatchdogTaskTest") {
140209bc2fbSopenharmony_ci  module_out_path = module_output_path
141209bc2fbSopenharmony_ci  sources = [ "watchdog_task_test.cpp" ]
142209bc2fbSopenharmony_ci
143209bc2fbSopenharmony_ci  configs = [ ":module_private_config" ]
144209bc2fbSopenharmony_ci
145209bc2fbSopenharmony_ci  deps = [
146209bc2fbSopenharmony_ci    "//base/hiviewdfx/hicollie/frameworks/native:libhicollie_source",
147209bc2fbSopenharmony_ci    "//third_party/googletest:gtest_main",
148209bc2fbSopenharmony_ci  ]
149209bc2fbSopenharmony_ci  external_deps = [
150209bc2fbSopenharmony_ci    "c_utils:utils",
151209bc2fbSopenharmony_ci    "ffrt:libffrt",
152209bc2fbSopenharmony_ci    "hilog:libhilog",
153209bc2fbSopenharmony_ci  ]
154209bc2fbSopenharmony_ci
155209bc2fbSopenharmony_ci  defines = []
156209bc2fbSopenharmony_ci  if (defined(global_parts_info) &&
157209bc2fbSopenharmony_ci      defined(global_parts_info.notification_eventhandler)) {
158209bc2fbSopenharmony_ci    external_deps += [ "eventhandler:libeventhandler" ]
159209bc2fbSopenharmony_ci  }
160209bc2fbSopenharmony_ci  if (defined(global_parts_info.hiviewdfx_hisysevent)) {
161209bc2fbSopenharmony_ci    external_deps += [ "hisysevent:libhisysevent" ]
162209bc2fbSopenharmony_ci    defines += [ "HISYSEVENT_ENABLE" ]
163209bc2fbSopenharmony_ci  }
164209bc2fbSopenharmony_ci}
165209bc2fbSopenharmony_ci
166209bc2fbSopenharmony_ciohos_unittest("ThreadSamplerTest") {
167209bc2fbSopenharmony_ci  module_out_path = module_output_path
168209bc2fbSopenharmony_ci  sources = [ "thread_sampler_test.cpp" ]
169209bc2fbSopenharmony_ci  configs = [ ":module_private_config" ]
170209bc2fbSopenharmony_ci  deps = [ "//third_party/googletest:gtest_main" ]
171209bc2fbSopenharmony_ci  external_deps = [
172209bc2fbSopenharmony_ci    "c_utils:utils",
173209bc2fbSopenharmony_ci    "faultloggerd:libasync_stack",
174209bc2fbSopenharmony_ci    "faultloggerd:libunwinder",
175209bc2fbSopenharmony_ci    "ffrt:libffrt",
176209bc2fbSopenharmony_ci    "hicollie:libhicollie",
177209bc2fbSopenharmony_ci    "hilog:libhilog",
178209bc2fbSopenharmony_ci  ]
179209bc2fbSopenharmony_ci  defines = []
180209bc2fbSopenharmony_ci  if (defined(global_parts_info.hiviewdfx_hisysevent)) {
181209bc2fbSopenharmony_ci    external_deps += [ "hisysevent:libhisysevent" ]
182209bc2fbSopenharmony_ci    defines += [ "HISYSEVENT_ENABLE" ]
183209bc2fbSopenharmony_ci  }
184209bc2fbSopenharmony_ci}
185209bc2fbSopenharmony_ci
186209bc2fbSopenharmony_ci###############################################################################
187209bc2fbSopenharmony_cigroup("unittest") {
188209bc2fbSopenharmony_ci  testonly = true
189209bc2fbSopenharmony_ci  deps = [
190209bc2fbSopenharmony_ci    # deps file
191209bc2fbSopenharmony_ci    ":HandlerCheckerTest",
192209bc2fbSopenharmony_ci    ":ThreadSamplerTest",
193209bc2fbSopenharmony_ci    ":WatchdogInnerUnitTest",
194209bc2fbSopenharmony_ci    ":WatchdogTaskTest",
195209bc2fbSopenharmony_ci    ":WatchdogUnitTest",
196209bc2fbSopenharmony_ci    ":XCollieUnitTest",
197209bc2fbSopenharmony_ci  ]
198209bc2fbSopenharmony_ci}
199209bc2fbSopenharmony_ci###############################################################################
200