• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022-2025 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")
15import("../../ressched.gni")
16
17group("unittest") {
18  testonly = true
19  deps = [
20    ":resschedfwk_test",
21    ":resschedservice_mock_test",
22    ":resschedservice_test",
23    ":suspendbaseclient_test",
24    ":suspend_manager_base_observer_test",
25  ]
26}
27
28module_output_path =
29    "resource_schedule_service/resource_schedule_service/ressched"
30
31ohos_unittest("resschedservice_test") {
32  module_out_path = module_output_path
33  resource_config_file = "${ressched_test}/resource/resschedfwk/ohos_test.xml"
34  cflags = [
35    "-Dprivate=public",
36    "-Dprotected=public",
37  ]
38  include_dirs = [
39    "./include",
40    "${ressched_common}/include",
41    "${ressched_interfaces}/innerkits/ressched_client/include",
42  ]
43
44  sources = [
45    "src/event_listener_mgr_test.cpp",
46    "src/oobe_datashare_utils_test.cpp",
47    "src/oobe_mgr_test.cpp",
48    "src/res_sched_client_test.cpp",
49    "src/res_sched_service_test.cpp",
50    "src/scene_recognize_test.cpp",
51  ]
52
53  deps = [ "${ressched_services}:resschedsvc_static" ]
54
55  external_deps = [
56    "ability_base:zuri",
57    "ability_runtime:ability_manager",
58    "access_token:libaccesstoken_sdk",
59    "access_token:libnativetoken",
60    "access_token:libtoken_setproc",
61    "cJSON:cjson",
62    "c_utils:utils",
63    "data_share:datashare_consumer",
64    "ffrt:libffrt",
65    "hilog:libhilog",
66    "ipc:ipc_single",
67    "selinux_adapter:librestorecon",
68    "window_manager:libdm",
69  ]
70
71  sanitize = {
72    cfi = true
73    cfi_cross_dso = true
74    debug = false
75  }
76  defines = []
77
78  if (resource_schedule_service_with_ext_res_enable) {
79    defines += [ "RESOURCE_SCHEDULE_SERVICE_WITH_EXT_RES_ENABLE" ]
80  }
81  if (resource_schedule_service_system_load_level_debug_feature_enable_for_2d) {
82    defines += [ "SET_SYSTEM_LOAD_LEVEL_2D_ENABLE" ]
83  }
84  branch_protector_ret = "pac_ret"
85}
86
87ohos_unittest("suspendbaseclient_test") {
88  module_out_path = module_output_path
89  resource_config_file = "${ressched_test}/resource/resschedfwk/ohos_test.xml"
90  cflags = [
91    "-Dprivate=public",
92    "-Dprotected=public",
93  ]
94  include_dirs = [
95    "${ressched_interfaces}/innerkits/suspend_manager_base_client/include",
96  ]
97
98  deps = [
99    "${ressched_client}:suspend_manager_base_client",
100    "${ressched_services}:resschedsvc_static",
101  ]
102
103  sources = [
104    "src/suspend_manager_base_client_test.cpp",
105  ]
106
107  external_deps = [
108    "ability_base:zuri",
109    "ability_runtime:ability_manager",
110    "access_token:libaccesstoken_sdk",
111    "access_token:libnativetoken",
112    "access_token:libtoken_setproc",
113    "cJSON:cjson_static",
114    "c_utils:utils",
115    "hilog:libhilog",
116    "ipc:ipc_single",
117    "selinux_adapter:librestorecon",
118    "samgr:samgr_proxy",
119  ]
120
121  sanitize = {
122    cfi = true
123    cfi_cross_dso = true
124    debug = false
125  }
126  branch_protector_ret = "pac_ret"
127}
128
129ohos_unittest("resschedservice_mock_test") {
130  module_out_path = module_output_path
131  resource_config_file = "${ressched_test}/resource/resschedfwk/ohos_test.xml"
132  cflags = [
133    "-Dprivate=public",
134    "-Dprotected=public",
135  ]
136  include_dirs = [
137    "./include",
138    "${ressched_common}/include",
139    "${ressched_interfaces}/innerkits/ressched_client/include",
140  ]
141
142  sources = [
143    "src/res_sched_service_mock_test.cpp",
144    "src/res_sched_mgr_test.cpp"
145  ]
146
147  deps = [ "${ressched_services}:resschedsvc_static" ]
148
149  external_deps = [
150    "ability_base:zuri",
151    "ability_runtime:ability_manager",
152    "access_token:libaccesstoken_sdk",
153    "access_token:libnativetoken",
154    "access_token:libtoken_setproc",
155    "cJSON:cjson",
156    "c_utils:utils",
157    "data_share:datashare_consumer",
158    "ffrt:libffrt",
159    "hilog:libhilog",
160    "ipc:ipc_single",
161    "selinux_adapter:librestorecon",
162    "window_manager:libdm",
163  ]
164
165  sanitize = {
166    cfi = true
167    cfi_cross_dso = true
168    debug = false
169  }
170  branch_protector_ret = "pac_ret"
171}
172
173ohos_unittest("resschedfwk_test") {
174  module_out_path = module_output_path
175  resource_config_file = "${ressched_test}/resource/resschedfwk/ohos_test.xml"
176  cflags = [
177    "-Dprivate=public",
178    "-Dprotected=public",
179  ]
180  include_dirs = [
181    "include",
182    "${ressched_common}/include",
183    "${ressched_interfaces}/innerkits/ressched_client/include",
184    "${ressched_plugins}/socperf_plugin/include",
185  ]
186
187  sources = [
188    "src/batch_log_printer_test.cpp",
189    "src/config_reader_test.cpp",
190    "src/notifier_mgr_test.cpp",
191    "src/plugin_mgr_test.cpp",
192    "src/plugin_switch_test.cpp",
193    "src/slide_recognize_test.cpp",
194  ]
195
196  deps = [
197    "${ressched_plugins}/socperf_plugin:socperf_plugin_static",
198    "${ressched_services}:resschedsvc_static",
199  ]
200
201  external_deps = [
202    "ability_runtime:ability_manager",
203    "cJSON:cjson",
204    "c_utils:utils",
205    "eventhandler:libeventhandler",
206    "ffrt:libffrt",
207    "hilog:libhilog",
208    "ipc:ipc_single",
209    "selinux_adapter:librestorecon",
210  ]
211
212  defines = []
213
214  if (ressched_with_resourceschedule_soc_perf_enable) {
215    external_deps += [ "soc_perf:socperf_client" ]
216    defines += [ "RESSCHED_RESOURCESCHEDULE_SOC_PERF_ENABLE" ]
217  }
218
219  if (resource_schedule_service_with_ffrt_enable) {
220    defines += [ "RESOURCE_SCHEDULE_SERVICE_WITH_FFRT_ENABLE" ]
221  }
222
223  sanitize = {
224    cfi = true
225    cfi_cross_dso = true
226    debug = false
227  }
228  branch_protector_ret = "pac_ret"
229}
230
231ohos_unittest("suspend_manager_base_observer_test") {
232  module_out_path = module_output_path
233  cflags = [
234    "-Dprivate=public",
235    "-Dprotected=public",
236  ]
237  include_dirs = [
238    "include",
239    "${ressched_common}/include",
240    "${ressched_interfaces}/innerkits/ressched_client/include",
241  ]
242
243  sources = [
244    "src/suspend_manager_base_observer_test.cpp",
245  ]
246
247  deps = [
248    "${ressched_services}:resschedsvc_static",
249    "${ressched_client}:suspend_manager_base_client",
250  ]
251
252  external_deps = [
253    "c_utils:utils",
254    "hilog:libhilog",
255    "ipc:ipc_single",
256    "googletest:gtest_main",
257    "googletest:gmock_main",
258    "access_token:libaccesstoken_sdk",
259    "access_token:libtoken_setproc",
260    "json:nlohmann_json_static",
261    "ffrt:libffrt",
262    "eventhandler:libeventhandler",
263  ]
264
265  defines = []
266
267  sanitize = {
268    cfi = true
269    cfi_cross_dso = true
270    debug = false
271  }
272  branch_protector_ret = "pac_ret"
273}
274