• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022-2023 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    ":comp_sched_plugin_test",
21    ":resschedclient_test",
22    ":resschedfwk_test",
23    ":resschedservice_test",
24  ]
25}
26
27module_output_path = "resource_schedule_service/ressched"
28
29ohos_unittest("comp_sched_plugin_test") {
30  module_out_path = module_output_path
31
32  include_dirs = [
33    "${ressched_plugins}/component_sched_plugin/include",
34    "${ressched_common}/include",
35    "${ressched_interfaces}/innerkits/ressched_client/include",
36    "${ressched_services}/resschedmgr/resschedfwk/include",
37    "${ressched_services}/resschedmgr/pluginbase/include",
38  ]
39
40  sources = [ "src/component_sched_plugin_test.cpp" ]
41
42  deps = [
43    "${ressched_plugins}/component_sched_plugin:component_sched_plugin",
44    "//third_party/googletest:gtest_main",
45  ]
46
47  external_deps = [
48    "c_utils:utils",
49    "eventhandler:libeventhandler",
50    "ffrt:libffrt",
51    "hilog:libhilog",
52    "hisysevent:libhisysevent",
53    "init:libbegetutil",
54    "resource_schedule_service:resschedsvc",
55  ]
56}
57
58ohos_unittest("resschedservice_test") {
59  module_out_path = module_output_path
60  include_dirs = [
61    "${ressched_common}/include",
62    "${ressched_interfaces}/innerkits/ressched_client/include",
63  ]
64
65  sources = [ "src/res_sched_service_test.cpp" ]
66
67  deps = [
68    "${ressched_services}:resschedsvc_static",
69    "//third_party/googletest:gtest_main",
70  ]
71
72  external_deps = [
73    "access_token:libaccesstoken_sdk",
74    "access_token:libnativetoken",
75    "access_token:libtoken_setproc",
76    "c_utils:utils",
77    "ffrt:libffrt",
78    "ipc:ipc_single",
79  ]
80
81  sanitize = {
82    cfi = true
83    cfi_cross_dso = true
84    debug = false
85  }
86  branch_protector_ret = "pac_ret"
87}
88
89ohos_unittest("resschedclient_test") {
90  module_out_path = module_output_path
91  include_dirs = [
92    "${ressched_common}/include",
93    "${ressched_interfaces}/innerkits/ressched_client/include",
94  ]
95
96  sources = [ "src/res_sched_client_test.cpp" ]
97
98  deps = [
99    "${ressched_services}:resschedsvc_static",
100    "//third_party/googletest:gtest_main",
101  ]
102
103  external_deps = [
104    "access_token:libaccesstoken_sdk",
105    "access_token:libnativetoken",
106    "access_token:libtoken_setproc",
107    "c_utils:utils",
108    "ffrt:libffrt",
109    "ipc:ipc_single",
110  ]
111}
112
113ohos_unittest("resschedfwk_test") {
114  module_out_path = module_output_path
115  resource_config_file = "${ressched_test}/resource/resschedfwk/ohos_test.xml"
116  include_dirs = [
117    "include",
118    "${ressched_common}/include",
119    "${ressched_interfaces}/innerkits/ressched_client/include",
120    "${ressched_plugins}/socperf_plugin/include",
121  ]
122
123  sources = [
124    "src/config_reader_test.cpp",
125    "src/plugin_mgr_test.cpp",
126    "src/plugin_switch_test.cpp",
127    "src/res_sched_mgr_test.cpp",
128  ]
129
130  deps = [
131    "${ressched_plugins}/socperf_plugin:socperf_plugin",
132    "${ressched_services}:resschedsvc_static",
133    "//third_party/googletest:gtest_main",
134  ]
135
136  external_deps = [
137    "c_utils:utils",
138    "eventhandler:libeventhandler",
139    "ffrt:libffrt",
140    "hilog:libhilog",
141    "ipc:ipc_single",
142  ]
143
144  defines = []
145
146  if (ressched_with_resourceschedule_soc_perf_enable) {
147    external_deps += [ "soc_perf:socperf_client" ]
148    defines += [ "RESSCHED_RESOURCESCHEDULE_SOC_PERF_ENABLE" ]
149  }
150}
151