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