1# Copyright (C) 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/ohos.gni")
15import("//build/ohos_var.gni")
16import("//build/test.gni")
17
18module_output_path = "qosmanagertest/"
19
20config("test_config") {
21  include_dirs = [
22    "../include/",
23    "../common/include",
24    "../frameworks/concurrent_task_client/include",
25    "../interfaces/inner_api/",
26    "../interfaces/kits/",
27    "../services/include/",
28  ]
29
30  cflags = [
31    "-Wno-unused-variable",
32    "-Wno-unused-function",
33  ]
34
35  if (target_cpu == "arm64") {
36    defines = [ "ARM64_TEST" ]
37  }
38}
39
40ohos_unittest("concurrent_svc_intf_test") {
41  module_out_path = module_output_path
42
43  configs = [ ":test_config" ]
44
45  sources = [ "unittest/phone/concurrent_svc_intf_test.cpp" ]
46  deps = [ "../frameworks/concurrent_task_client:concurrent_task_client" ]
47  external_deps = [
48    "c_utils:utils",
49    "frame_aware_sched:rtg_interface",
50    "hilog:libhilog",
51    "ipc:ipc_single",
52    "safwk:system_ability_fwk",
53    "samgr:samgr_proxy",
54  ]
55
56  if (is_standard_system) {
57    external_deps += [ "googletest:gtest_main" ]
58  }
59
60  subsystem_name = "resourceschedule"
61  part_name = "qos_manager"
62}
63
64ohos_unittest("concurrent_task_client_test") {
65  module_out_path = module_output_path
66
67  configs = [ ":test_config" ]
68
69  sources = [ "unittest/phone/concurrent_task_client_test.cpp" ]
70  deps = [ "../frameworks/concurrent_task_client:concurrent_task_client" ]
71
72  external_deps = [
73    "frame_aware_sched:rtg_interface",
74    "hilog:libhilog",
75    "ipc:ipc_single",
76  ]
77
78  if (is_standard_system) {
79    external_deps += [ "googletest:gtest_main" ]
80  }
81
82  subsystem_name = "resourceschedule"
83  part_name = "qos_manager"
84}
85
86ohos_unittest("concurrent_task_controller_test") {
87  module_out_path = module_output_path
88
89  configs = [ ":test_config" ]
90
91  sources = [ "unittest/phone/concurrent_task_controller_test.cpp" ]
92  deps = [
93    "../etc/param:ffrt_etc",
94    "../frameworks/concurrent_task_client:concurrent_task_client",
95    "../services:concurrentsvc",
96  ]
97
98  external_deps = [
99    "c_utils:utils",
100    "frame_aware_sched:rtg_interface",
101    "hilog:libhilog",
102    "init:libbegetutil",
103    "jsoncpp:jsoncpp",
104    "safwk:system_ability_fwk",
105    "samgr:samgr_proxy",
106  ]
107
108  if (is_standard_system) {
109    external_deps += [ "googletest:gtest_main" ]
110  }
111
112  subsystem_name = "resourceschedule"
113  part_name = "qos_manager"
114}
115
116ohos_unittest("concurrent_task_service_ability_test") {
117  module_out_path = module_output_path
118
119  configs = [ ":test_config" ]
120
121  sources = [ "unittest/phone/concurrent_task_service_ability_test.cpp" ]
122  deps = [
123    "../frameworks/concurrent_task_client:concurrent_task_client",
124    "../services:concurrentsvc",
125  ]
126  external_deps = [
127    "c_utils:utils",
128    "frame_aware_sched:rtg_interface",
129    "hilog:libhilog",
130    "safwk:system_ability_fwk",
131    "samgr:samgr_proxy",
132  ]
133
134  if (is_standard_system) {
135    external_deps += [ "googletest:gtest_main" ]
136  }
137
138  subsystem_name = "resourceschedule"
139  part_name = "qos_manager"
140}
141
142ohos_unittest("qos_interface_test") {
143  module_out_path = module_output_path
144
145  configs = [ ":test_config" ]
146
147  sources = [ "unittest/phone/qos_interface_test.cpp" ]
148
149  deps = [
150    "../frameworks/concurrent_task_client:concurrent_task_client",
151    "../services:concurrentsvc",
152  ]
153  external_deps = [
154    "c_utils:utils",
155    "frame_aware_sched:rtg_interface",
156    "hilog:libhilog",
157    "safwk:system_ability_fwk",
158    "samgr:samgr_proxy",
159  ]
160
161  if (is_standard_system) {
162    external_deps += [ "googletest:gtest_main" ]
163  }
164
165  subsystem_name = "resourceschedule"
166  part_name = "qos_manager"
167}
168
169ohos_unittest("qos_policy_test") {
170  module_out_path = module_output_path
171
172  configs = [ ":test_config" ]
173
174  sources = [ "unittest/phone/qos_policy_test.cpp" ]
175  deps = [
176    "../frameworks/concurrent_task_client:concurrent_task_client",
177    "../services:concurrentsvc",
178  ]
179  external_deps = [
180    "c_utils:utils",
181    "frame_aware_sched:rtg_interface",
182    "hilog:libhilog",
183    "safwk:system_ability_fwk",
184    "samgr:samgr_proxy",
185  ]
186
187  if (is_standard_system) {
188    external_deps += [ "googletest:gtest_main" ]
189  }
190
191  subsystem_name = "resourceschedule"
192  part_name = "qos_manager"
193}
194
195ohos_unittest("concurrent_task_service_test") {
196  module_out_path = module_output_path
197
198  configs = [ ":test_config" ]
199
200  sources = [ "unittest/phone/concurrent_task_service_test.cpp" ]
201  deps = [
202    "../frameworks/concurrent_task_client:concurrent_task_client",
203    "../services:concurrentsvc",
204  ]
205  external_deps = [
206    "c_utils:utils",
207    "frame_aware_sched:rtg_interface",
208    "hilog:libhilog",
209    "safwk:system_ability_fwk",
210    "samgr:samgr_proxy",
211  ]
212
213  if (is_standard_system) {
214    external_deps += [ "googletest:gtest_main" ]
215  }
216
217  subsystem_name = "resourceschedule"
218  part_name = "qos_manager"
219}
220
221ohos_unittest("qos_test") {
222  module_out_path = module_output_path
223
224  configs = [ ":test_config" ]
225
226  sources = [ "unittest/phone/qos_test.cpp" ]
227
228  deps = [ "../qos:qos" ]
229  external_deps = [
230    "c_utils:utils",
231    "frame_aware_sched:rtg_interface",
232    "hilog:libhilog",
233  ]
234
235  if (is_standard_system) {
236    external_deps += [ "googletest:gtest_main" ]
237  }
238
239  subsystem_name = "resourceschedule"
240  part_name = "qos_manager"
241}
242
243ohos_unittest("qos_ndk_test") {
244  module_out_path = module_output_path
245
246  configs = [ ":test_config" ]
247
248  sources = [ "unittest/phone/qos_ndk_test.cpp" ]
249
250  deps = [
251    "../frameworks/native:qos_ndk",
252    "../qos:qos",
253  ]
254  external_deps = [
255    "c_utils:utils",
256    "frame_aware_sched:rtg_interface",
257    "hilog:libhilog",
258  ]
259
260  if (is_standard_system) {
261    external_deps += [ "googletest:gtest_main" ]
262  }
263
264  subsystem_name = "resourceschedule"
265  part_name = "qos_manager"
266}
267
268ohos_unittest("config_reader_test") {
269  module_out_path = module_output_path
270  configs = [ ":test_config" ]
271
272  sources = [ "unittest/phone/config_reader_test.cpp" ]
273  deps = [ "../services:concurrentsvc" ]
274
275  external_deps = [
276    "c_utils:utils",
277    "config_policy:configpolicy_util",
278    "frame_aware_sched:rtg_interface",
279    "hilog:libhilog",
280    "init:libbegetutil",
281    "libxml2:libxml2",
282  ]
283
284  subsystem_name = "resourceschedule"
285  part_name = "qos_manager"
286}
287
288group("concurrent_unittest") {
289  testonly = true
290  deps = []
291  if (!is_asan) {
292    deps += [
293      ":concurrent_svc_intf_test",
294      ":concurrent_task_client_test",
295      ":concurrent_task_controller_test",
296      ":concurrent_task_service_ability_test",
297      ":concurrent_task_service_test",
298      ":config_reader_test",
299      ":qos_interface_test",
300      ":qos_ndk_test",
301      ":qos_policy_test",
302      ":qos_test",
303    ]
304  }
305}
306