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