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")
17import("../memmgr.gni")
18
19module_output_path = "memmgrtest/"
20
21memmgr_service_configs = [ "${memmgr_service_path}:memory_memmgr_config" ]
22
23memmgr_deps = [ "${memmgr_service_path}:memmgrservice" ]
24
25memmgr_external_deps = [
26  "c_utils:utils",
27  "eventhandler:libeventhandler",
28  "hilog:libhilog",
29  "ipc:ipc_core",
30  "libxml2:libxml2",
31  "memmgr:memmgrclient",
32  "os_account:os_account_innerkits",
33]
34
35ohos_unittest("reclaim_priority_manager_test") {
36  module_out_path = module_output_path
37  configs = memmgr_service_configs
38
39  sources = [ "unittest/phone/reclaim_priority_manager_test.cpp" ]
40
41  deps = memmgr_deps
42  if (is_standard_system) {
43    external_deps = memmgr_external_deps
44  }
45
46  part_name = "memmgr"
47  subsystem_name = "resourceschedule"
48}
49
50ohos_unittest("kernel_interface_test") {
51  module_out_path = module_output_path
52  configs = memmgr_service_configs
53
54  sources = [ "unittest/phone/kernel_interface_test.cpp" ]
55
56  deps = memmgr_deps
57  if (is_standard_system) {
58    external_deps = memmgr_external_deps
59  }
60
61  part_name = "memmgr"
62  subsystem_name = "resourceschedule"
63}
64
65ohos_unittest("memcg_test") {
66  module_out_path = module_output_path
67  configs = memmgr_service_configs
68
69  sources = [ "unittest/phone/memcg_test.cpp" ]
70
71  deps = memmgr_deps
72  if (is_standard_system) {
73    external_deps = memmgr_external_deps
74  }
75
76  part_name = "memmgr"
77  subsystem_name = "resourceschedule"
78}
79
80ohos_unittest("user_memcg_test") {
81  module_out_path = module_output_path
82  configs = memmgr_service_configs
83
84  sources = [ "unittest/phone/user_memcg_test.cpp" ]
85
86  deps = memmgr_deps
87  if (is_standard_system) {
88    external_deps = memmgr_external_deps
89  }
90
91  part_name = "memmgr"
92  subsystem_name = "resourceschedule"
93}
94
95ohos_unittest("memcg_mgr_test") {
96  module_out_path = module_output_path
97  configs = memmgr_service_configs
98
99  sources = [ "unittest/phone/memcg_mgr_test.cpp" ]
100
101  deps = memmgr_deps
102  if (is_standard_system) {
103    external_deps = memmgr_external_deps
104  }
105
106  part_name = "memmgr"
107  subsystem_name = "resourceschedule"
108}
109
110ohos_unittest("multi_account_manager_test") {
111  module_out_path = module_output_path
112  configs = memmgr_service_configs
113
114  sources = [ "unittest/phone/multi_account_manager_test.cpp" ]
115
116  deps = memmgr_deps
117  if (is_standard_system) {
118    external_deps = memmgr_external_deps
119  }
120
121  part_name = "memmgr"
122  subsystem_name = "resourceschedule"
123}
124
125ohos_unittest("nandlife_controller_test") {
126  module_out_path = module_output_path
127  configs = memmgr_service_configs
128
129  sources = [ "unittest/phone/nandlife_controller_test.cpp" ]
130
131  deps = memmgr_deps
132  if (is_standard_system) {
133    external_deps = memmgr_external_deps
134  }
135
136  part_name = "memmgr"
137  subsystem_name = "resourceschedule"
138}
139
140ohos_unittest("reclaim_strategy_manager_test") {
141  module_out_path = module_output_path
142  configs = memmgr_service_configs
143
144  sources = [ "unittest/phone/reclaim_strategy_manager_test.cpp" ]
145
146  deps = memmgr_deps
147  if (is_standard_system) {
148    external_deps = memmgr_external_deps
149  }
150
151  part_name = "memmgr"
152  subsystem_name = "resourceschedule"
153}
154
155ohos_unittest("innerkits_test") {
156  module_out_path = module_output_path
157  configs = memmgr_service_configs
158
159  sources = [ "unittest/phone/innerkits_test.cpp" ]
160
161  deps = memmgr_deps
162  if (is_standard_system) {
163    external_deps = memmgr_external_deps
164  }
165
166  part_name = "memmgr"
167  subsystem_name = "resourceschedule"
168}
169
170ohos_unittest("avail_buffer_manager_test") {
171  module_out_path = module_output_path
172  configs = memmgr_service_configs
173
174  sources = [ "unittest/phone/avail_buffer_manager_test.cpp" ]
175
176  deps = memmgr_deps
177  if (is_standard_system) {
178    external_deps = memmgr_external_deps
179  }
180
181  part_name = "memmgr"
182  subsystem_name = "resourceschedule"
183}
184
185ohos_unittest("memmgr_config_manager_test") {
186  module_out_path = module_output_path
187  configs = memmgr_service_configs
188
189  sources = [ "unittest/phone/memmgr_config_manager_test.cpp" ]
190
191  deps = memmgr_deps
192  if (is_standard_system) {
193    external_deps = memmgr_external_deps
194  }
195
196  part_name = "memmgr"
197  subsystem_name = "resourceschedule"
198}
199
200ohos_unittest("default_multi_account_strategy_test") {
201  module_out_path = module_output_path
202  configs = memmgr_service_configs
203
204  sources = [ "unittest/phone/default_multi_account_strategy_test.cpp" ]
205
206  deps = memmgr_deps
207  if (is_standard_system) {
208    external_deps = memmgr_external_deps
209  }
210
211  part_name = "memmgr"
212  subsystem_name = "resourceschedule"
213}
214
215ohos_unittest("oom_score_adj_utils_test") {
216  module_out_path = module_output_path
217  configs = memmgr_service_configs
218
219  sources = [ "unittest/phone/oom_score_adj_utils_test.cpp" ]
220
221  deps = memmgr_deps
222  if (is_standard_system) {
223    external_deps = memmgr_external_deps
224  }
225
226  part_name = "memmgr"
227  subsystem_name = "resourceschedule"
228}
229
230ohos_unittest("xml_helper_test") {
231  module_out_path = module_output_path
232  configs = memmgr_service_configs
233
234  sources = [ "unittest/phone/xml_helper_test.cpp" ]
235
236  deps = memmgr_deps
237  if (is_standard_system) {
238    external_deps = memmgr_external_deps
239  }
240
241  part_name = "memmgr"
242  subsystem_name = "resourceschedule"
243}
244
245ohos_unittest("system_memory_level_config_test") {
246  module_out_path = module_output_path
247  configs = memmgr_service_configs
248
249  sources = [ "unittest/phone/system_memory_level_config_test.cpp" ]
250
251  deps = memmgr_deps
252  if (is_standard_system) {
253    external_deps = memmgr_external_deps
254  }
255
256  part_name = "memmgr"
257  subsystem_name = "resourceschedule"
258}
259
260ohos_unittest("memory_level_manager_test") {
261  module_out_path = module_output_path
262  configs = memmgr_service_configs
263
264  sources = [ "unittest/phone/memory_level_manager_test.cpp" ]
265
266  deps = memmgr_deps
267  if (is_standard_system) {
268    external_deps = memmgr_external_deps
269  }
270
271  part_name = "memmgr"
272  subsystem_name = "resourceschedule"
273}
274
275ohos_unittest("low_memory_killer_test") {
276  module_out_path = module_output_path
277  configs = memmgr_service_configs
278
279  sources = [ "unittest/phone/low_memory_killer_test.cpp" ]
280
281  deps = memmgr_deps
282  if (is_standard_system) {
283    external_deps = memmgr_external_deps
284  }
285
286  part_name = "memmgr"
287  subsystem_name = "resourceschedule"
288}
289
290ohos_unittest("purgeable_memory_manager_test") {
291  module_out_path = module_output_path
292  configs = memmgr_service_configs
293
294  sources = [ "unittest/phone/purgeable_memory_manager_test.cpp" ]
295
296  deps = memmgr_deps
297  if (is_standard_system) {
298    external_deps = memmgr_external_deps
299  }
300
301  part_name = "memmgr"
302  subsystem_name = "resourceschedule"
303}
304
305group("memmgr_unittest") {
306  testonly = true
307  deps = [
308    ":avail_buffer_manager_test",
309    ":default_multi_account_strategy_test",
310    ":innerkits_test",
311    ":kernel_interface_test",
312    ":low_memory_killer_test",
313    ":memcg_mgr_test",
314    ":memcg_test",
315    ":memmgr_config_manager_test",
316    ":memory_level_manager_test",
317    ":multi_account_manager_test",
318    ":nandlife_controller_test",
319    ":oom_score_adj_utils_test",
320    ":purgeable_memory_manager_test",
321    ":reclaim_priority_manager_test",
322    ":system_memory_level_config_test",
323    ":user_memcg_test",
324    ":xml_helper_test",
325  ]
326  if (memmgr_hyperhold_memory) {
327    deps += [ ":reclaim_strategy_manager_test" ]
328  }
329}
330