1# Copyright (c) 2021-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/ohos.gni") 15import("//build/ohos_var.gni") 16import("//build/test.gni") 17import("//foundation/ability/dmsfwk/dmsfwk.gni") 18import("../../../dmsfwk.gni") 19 20module_output_path = "dmsfwk/distributedschedsvrtest" 21 22distributed_service = "//foundation/ability/dmsfwk/services" 23 24dsched_configs = 25 [ "${distributed_service}/dtbschedmgr:distributed_sched_config" ] 26 27config("test_config") { 28 visibility = [ ":*" ] 29 include_dirs = [ 30 "//foundation/ability/dmsfwk/utils/native/include", 31 "//foundation/ability/dmsfwk/services/dtbschedmgr/test/unittest", 32 "${distributed_service}/dtbschedmgr/include/distributedWant", 33 ] 34} 35 36dsched_external_deps = [ 37 "ability_base:base", 38 "ability_base:want", 39 "ability_base:zuri", 40 "ability_runtime:ability_manager", 41 "ability_runtime:app_manager", 42 "ability_runtime:mission_info", 43 "access_token:libaccesstoken_sdk", 44 "access_token:libnativetoken", 45 "access_token:libtoken_setproc", 46 "bundle_framework:appexecfwk_base", 47 "bundle_framework:appexecfwk_core", 48 "c_utils:utils", 49 "device_auth:deviceauth_sdk", 50 "device_info_manager:distributed_device_profile_client", 51 "device_manager:devicemanagersdk", 52 "device_security_level:dslm_sdk", 53 "distributed_bundle_framework:dbms_fwk", 54 "dmsfwk:continuation_manager", 55 "eventhandler:libeventhandler", 56 "ffrt:libffrt", 57 "hilog:libhilog", 58 "hisysevent:libhisysevent", 59 "hitrace:hitrace_meter", 60 "hitrace:libhitracechain", 61 "init:libbegetutil", 62 "ipc:ipc_core", 63 "kv_store:distributeddata_inner", 64 "os_account:os_account_innerkits", 65 "safwk:system_ability_fwk", 66 "samgr:samgr_proxy", 67] 68 69if (dmsfwk_report_memmgr) { 70 dsched_external_deps += [ "memmgr:memmgrclient" ] 71} 72 73if (dmsfwk_report_memmgr_plugins) { 74 dsched_external_deps += [ "memmgr_plugin:memmgrclient" ] 75} 76 77if (dmsfwk_standard_form_share) { 78 dsched_external_deps += [ "form_fwk:form_manager" ] 79} 80 81if (dmsfwk_mission_manager) { 82 dsched_external_deps += [ "image_framework:image_native" ] 83} 84 85if (efficiency_manager_service_enable) { 86 dsched_external_deps += [ "efficiency_manager:suspend_manager_client" ] 87} 88 89dsched_public_deps = [ 90 "//third_party/googletest:gmock_main", 91 "//third_party/googletest:gtest_main", 92 "//third_party/libxml2:libxml2", 93] 94 95dtbschedmgr_sources = [ 96 "${distributed_service}/dtbschedmgr/src/ability_connection_wrapper_proxy.cpp", 97 "${distributed_service}/dtbschedmgr/src/ability_connection_wrapper_stub.cpp", 98 "${distributed_service}/dtbschedmgr/src/adapter/dnetwork_adapter.cpp", 99 "${distributed_service}/dtbschedmgr/src/app_state_observer.cpp", 100 "${distributed_service}/dtbschedmgr/src/bundle/bundle_manager_callback_stub.cpp", 101 "${distributed_service}/dtbschedmgr/src/bundle/bundle_manager_internal.cpp", 102 "${distributed_service}/dtbschedmgr/src/connect_death_recipient.cpp", 103 "${distributed_service}/dtbschedmgr/src/deviceManager/dms_device_info.cpp", 104 "${distributed_service}/dtbschedmgr/src/dfx/dms_hisysevent_report.cpp", 105 "${distributed_service}/dtbschedmgr/src/dfx/dms_hitrace_chain.cpp", 106 "${distributed_service}/dtbschedmgr/src/distributedWant/distributed_operation.cpp", 107 "${distributed_service}/dtbschedmgr/src/distributedWant/distributed_operation_builder.cpp", 108 "${distributed_service}/dtbschedmgr/src/distributedWant/distributed_want.cpp", 109 "${distributed_service}/dtbschedmgr/src/distributedWant/distributed_want_params.cpp", 110 "${distributed_service}/dtbschedmgr/src/distributedWant/distributed_want_params_wrapper.cpp", 111 "${distributed_service}/dtbschedmgr/src/distributed_device_node_listener.cpp", 112 "${distributed_service}/dtbschedmgr/src/distributed_sched_adapter.cpp", 113 "${distributed_service}/dtbschedmgr/src/distributed_sched_continuation.cpp", 114 "${distributed_service}/dtbschedmgr/src/distributed_sched_dumper.cpp", 115 "${distributed_service}/dtbschedmgr/src/distributed_sched_permission.cpp", 116 "${distributed_service}/dtbschedmgr/src/distributed_sched_proxy.cpp", 117 "${distributed_service}/dtbschedmgr/src/distributed_sched_service.cpp", 118 "${distributed_service}/dtbschedmgr/src/distributed_sched_stub.cpp", 119 "${distributed_service}/dtbschedmgr/src/dms_callback_task.cpp", 120 "${distributed_service}/dtbschedmgr/src/dms_free_install_callback.cpp", 121 "${distributed_service}/dtbschedmgr/src/dms_free_install_callback_proxy.cpp", 122 "${distributed_service}/dtbschedmgr/src/dms_free_install_callback_stub.cpp", 123 "${distributed_service}/dtbschedmgr/src/dms_token_callback.cpp", 124 "${distributed_service}/dtbschedmgr/src/dms_version_manager.cpp", 125 "${distributed_service}/dtbschedmgr/src/dtbschedmgr_device_info_storage.cpp", 126 "${distributed_service}/dtbschedmgr/src/softbus_adapter/softbus_adapter_common.cpp", 127 "unittest/distributed_sched_util.cpp", 128] 129 130if (dmsfwk_mission_manager) { 131 dtbschedmgr_sources += [ 132 "${distributed_service}/dtbschedmgr/src/mission/distributed_data_change_listener.cpp", 133 "${distributed_service}/dtbschedmgr/src/mission/distributed_data_storage.cpp", 134 "${distributed_service}/dtbschedmgr/src/mission/distributed_mission_broadcast_listener.cpp", 135 "${distributed_service}/dtbschedmgr/src/mission/distributed_mission_change_listener.cpp", 136 "${distributed_service}/dtbschedmgr/src/mission/distributed_mission_died_listener.cpp", 137 "${distributed_service}/dtbschedmgr/src/mission/distributed_mission_focused_listener.cpp", 138 "${distributed_service}/dtbschedmgr/src/mission/distributed_mission_info.cpp", 139 "${distributed_service}/dtbschedmgr/src/mission/distributed_sched_continue_manager.cpp", 140 "${distributed_service}/dtbschedmgr/src/mission/distributed_sched_mission_manager.cpp", 141 "${distributed_service}/dtbschedmgr/src/mission/kvstore_death_recipient.cpp", 142 "${distributed_service}/dtbschedmgr/src/mission/mission_changed_notify.cpp", 143 "${distributed_service}/dtbschedmgr/src/mission/mission_info_converter.cpp", 144 "${distributed_service}/dtbschedmgr/src/mission/snapshot.cpp", 145 "${distributed_service}/dtbschedmgr/src/mission/snapshot_converter.cpp", 146 ] 147} 148 149if (dmsfwk_standard_form_share) { 150 dtbschedmgr_sources += 151 [ "${distributed_service}/dtbschedmgr/src/form_mgr_death_recipient.cpp" ] 152} 153 154ohos_unittest("distributedschedsvrtest") { 155 module_out_path = module_output_path 156 157 deps = [ 158 "${dms_path}/test/sceneProject/unittest/bundle_dependencies/bmsThirdBundle:bmsThirdBundle", 159 "${dms_path}/test/sceneProject/unittest/ohos_test:copy_ohos_test", 160 ] 161 162 sources = [ 163 "unittest/distributed_sched_adapter_test.cpp", 164 "unittest/distributed_sched_dumper_test.cpp", 165 "unittest/distributed_sched_service_test.cpp", 166 "unittest/distributed_sched_stub_test.cpp", 167 "unittest/dms_callback_task_test.cpp", 168 "unittest/dms_token_callback_test.cpp", 169 "unittest/mock_distributed_sched.cpp", 170 "unittest/mock_remote_stub.cpp", 171 ] 172 sources += dtbschedmgr_sources 173 configs = [ 174 ":test_config", 175 "//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags", 176 ] 177 configs += dsched_configs 178 if (is_standard_system) { 179 external_deps = dsched_external_deps 180 public_deps = dsched_public_deps 181 } 182 183 if (dmsfwk_report_memmgr || dmsfwk_report_memmgr_plugins) { 184 defines = [ "SUPPORT_DISTRIBUTEDCOMPONENT_TO_MEMMGR" ] 185 } 186 187 part_name = "dmsfwk" 188 subsystem_name = "ability" 189} 190 191ohos_unittest("distributedcalltest") { 192 module_out_path = module_output_path 193 194 sources = [ 195 "unittest/app_state_observer_test.cpp", 196 "unittest/distributed_sched_call_test.cpp", 197 ] 198 sources += dtbschedmgr_sources 199 configs = [ 200 ":test_config", 201 "//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags", 202 ] 203 configs += dsched_configs 204 if (is_standard_system) { 205 external_deps = dsched_external_deps 206 public_deps = dsched_public_deps 207 } 208 part_name = "dmsfwk" 209 subsystem_name = "ability" 210} 211 212ohos_unittest("dmsfreeinstallcbtest") { 213 module_out_path = module_output_path 214 215 sources = [ 216 "unittest/dms_free_install_callback_test.cpp", 217 "unittest/mock_remote_stub.cpp", 218 ] 219 sources += dtbschedmgr_sources 220 configs = [ 221 ":test_config", 222 "//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags", 223 ] 224 configs += dsched_configs 225 if (is_standard_system) { 226 external_deps = dsched_external_deps 227 public_deps = dsched_public_deps 228 } 229 part_name = "dmsfwk" 230 subsystem_name = "ability" 231} 232 233ohos_unittest("dschedcontinuetest") { 234 module_out_path = module_output_path 235 sources = [ 236 "unittest/distributed_sched_continuation_test.cpp", 237 "unittest/dms_version_manager_test.cpp", 238 "unittest/mock_distributed_sched.cpp", 239 "unittest/mock_remote_stub.cpp", 240 ] 241 sources += dtbschedmgr_sources 242 configs = [ 243 ":test_config", 244 "//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags", 245 ] 246 configs += dsched_configs 247 if (is_standard_system) { 248 external_deps = dsched_external_deps 249 public_deps = dsched_public_deps 250 } 251 252 deps = [ 253 "${dms_path}/test/sceneProject/unittest/bundle_dependencies/bmsThirdBundle:bmsThirdBundle", 254 "${dms_path}/test/sceneProject/unittest/ohos_test:copy_ohos_test", 255 ] 256 257 if (dmsfwk_mission_manager) { 258 defines = [ "SUPPORT_DISTRIBUTED_MISSION_MANAGER" ] 259 } 260 261 if (dmsfwk_standard_form_share) { 262 defines += [ "SUPPORT_DISTRIBUTED_FORM_SHARE" ] 263 } 264 265 part_name = "dmsfwk" 266 subsystem_name = "ability" 267} 268 269ohos_unittest("dschedconnecttest") { 270 module_out_path = module_output_path 271 272 sources = [ 273 "unittest/distributed_sched_connect_test.cpp", 274 "unittest/mock_remote_stub.cpp", 275 ] 276 sources += dtbschedmgr_sources 277 configs = [ 278 ":test_config", 279 "//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags", 280 ] 281 configs += dsched_configs 282 if (is_standard_system) { 283 external_deps = dsched_external_deps 284 public_deps = dsched_public_deps 285 } 286 part_name = "dmsfwk" 287 subsystem_name = "ability" 288} 289 290ohos_unittest("dschedpermissiontest") { 291 module_out_path = module_output_path 292 293 sources = [ "unittest/distributed_sched_permission_test.cpp" ] 294 sources += dtbschedmgr_sources 295 configs = [ 296 ":test_config", 297 "//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags", 298 ] 299 configs += dsched_configs 300 if (is_standard_system) { 301 external_deps = dsched_external_deps 302 public_deps = dsched_public_deps 303 } 304 if (token_sync_enable) { 305 cflags_cc = [ "-DTOKEN_SYNC_ENABLE" ] 306 } 307 part_name = "dmsfwk" 308 subsystem_name = "ability" 309} 310 311ohos_unittest("dschedmissionmanagertest") { 312 module_out_path = module_output_path 313 sources = [ 314 "unittest/mission/distributed_data_storage_test.cpp", 315 "unittest/mission/distributed_mission_info_test.cpp", 316 "unittest/mission/dms_continue_manager_test.cpp", 317 "unittest/mission/dms_mission_manager_test.cpp", 318 "unittest/mission/mission_info_converter_test.cpp", 319 "unittest/mission/snapshot_test.cpp", 320 "unittest/mock_remote_stub.cpp", 321 ] 322 sources += dtbschedmgr_sources 323 configs = [ 324 ":test_config", 325 "//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags", 326 ] 327 configs += dsched_configs 328 deps = [ "${distributed_service}/dtbschedmgr:distributedschedsvr" ] 329 if (is_standard_system) { 330 external_deps = dsched_external_deps 331 public_deps = dsched_public_deps 332 } 333 part_name = "dmsfwk" 334 subsystem_name = "ability" 335} 336 337ohos_unittest("bundlemanagerinternaltest") { 338 module_out_path = module_output_path 339 sources = [ "unittest/bundle_manager_internal_test.cpp" ] 340 sources += dtbschedmgr_sources 341 configs = [ 342 ":test_config", 343 "//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags", 344 ] 345 configs += dsched_configs 346 deps = [ 347 "${distributed_service}/dtbschedmgr:distributedschedsvr", 348 "${dms_path}/test/sceneProject/unittest/bundle_dependencies/bmsThirdBundle:bmsThirdBundle", 349 "${dms_path}/test/sceneProject/unittest/ohos_test:copy_ohos_test", 350 ] 351 if (is_standard_system) { 352 external_deps = dsched_external_deps 353 public_deps = dsched_public_deps 354 } 355 part_name = "dmsfwk" 356 subsystem_name = "ability" 357} 358 359ohos_unittest("softbusadaptertest") { 360 module_out_path = module_output_path 361 sources = [ "unittest/softbus_adapter/softbus_adapter_test.cpp" ] 362 sources += dtbschedmgr_sources 363 configs = [ 364 ":test_config", 365 "${dms_path}/services/dtbschedmgr/test/resource:coverage_flags", 366 ] 367 configs += dsched_configs 368 deps = [ 369 "${distributed_service}/dtbschedmgr:distributedschedsvr", 370 "${dms_path}/test/sceneProject/unittest/bundle_dependencies/bmsThirdBundle:bmsThirdBundle", 371 "${dms_path}/test/sceneProject/unittest/ohos_test:copy_ohos_test", 372 ] 373 if (is_standard_system) { 374 external_deps = dsched_external_deps 375 public_deps = dsched_public_deps 376 } 377 part_name = "dmsfwk" 378 subsystem_name = "ability" 379} 380 381ohos_unittest("hisyseventreporttest") { 382 module_out_path = module_output_path 383 sources = [ "unittest/dms_hisysevent_report_test.cpp" ] 384 sources += dtbschedmgr_sources 385 configs = [ 386 ":test_config", 387 "//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags", 388 ] 389 configs += dsched_configs 390 deps = [ "${distributed_service}/dtbschedmgr:distributedschedsvr" ] 391 if (is_standard_system) { 392 external_deps = dsched_external_deps 393 public_deps = dsched_public_deps 394 } 395 part_name = "dmsfwk" 396 subsystem_name = "ability" 397} 398 399ohos_unittest("distributeduidtest") { 400 module_out_path = module_output_path 401 402 sources = [ "unittest/distributed_sched_uid_test.cpp" ] 403 sources += dtbschedmgr_sources 404 configs = [ 405 ":test_config", 406 "//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags", 407 ] 408 configs += dsched_configs 409 if (is_standard_system) { 410 external_deps = dsched_external_deps 411 public_deps = dsched_public_deps 412 } 413 part_name = "dmsfwk" 414 subsystem_name = "ability" 415} 416 417ohos_unittest("distributedwanttest") { 418 module_out_path = module_output_path 419 420 sources = [ 421 "unittest/distributedWant/distributed_operation_test.cpp", 422 "unittest/distributedWant/distributed_want_params_test.cpp", 423 "unittest/distributedWant/distributed_want_params_wrapper_test.cpp", 424 "unittest/distributedWant/distributed_want_test.cpp", 425 ] 426 sources += dtbschedmgr_sources 427 configs = [ 428 ":test_config", 429 "${distributed_service}/dtbschedmgr/test/resource:coverage_flags", 430 ] 431 configs += dsched_configs 432 if (is_standard_system) { 433 external_deps = dsched_external_deps 434 public_deps = dsched_public_deps 435 } 436 part_name = "dmsfwk" 437 subsystem_name = "ability" 438} 439 440ohos_unittest("dmsbasetest") { 441 module_out_path = module_output_path 442 sources = [ 443 "unittest/deviceManager/dms_device_info_test.cpp", 444 "unittest/dfx/dms_hisysevent_report_test.cpp", 445 "unittest/dms_network_adapter_test.cpp", 446 "unittest/dtbschedmgr_device_info_storage_test.cpp", 447 ] 448 sources += dtbschedmgr_sources 449 configs = [ 450 ":test_config", 451 "./resource:coverage_flags", 452 ] 453 configs += dsched_configs 454 if (is_standard_system) { 455 external_deps = dsched_external_deps 456 public_deps = dsched_public_deps 457 } 458 part_name = "dmsfwk" 459 subsystem_name = "ability" 460} 461 462group("unittest") { 463 testonly = true 464 deps = [ 465 ":bundlemanagerinternaltest", 466 ":distributedcalltest", 467 ":distributedschedsvrtest", 468 ":distributeduidtest", 469 ":distributedwanttest", 470 ":dmsbasetest", 471 ":dmsfreeinstallcbtest", 472 ":dschedconnecttest", 473 ":dschedcontinuetest", 474 ":softbusadaptertest", 475 ] 476 if (dmsfwk_mission_manager) { 477 deps += [ 478 ":dschedmissionmanagertest", 479 ":dschedpermissiontest", 480 ] 481 } 482} 483