# Copyright (c) 2021-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//build/ohos.gni") import("//build/ohos_var.gni") import("//build/test.gni") import("//foundation/ability/dmsfwk/dmsfwk.gni") import("../../../dmsfwk.gni") module_output_path = "dmsfwk/distributedschedsvrtest" distributed_service = "//foundation/ability/dmsfwk/services" dsched_configs = [ "${distributed_service}/dtbschedmgr:distributed_sched_config" ] config("test_config") { visibility = [ ":*" ] include_dirs = [ "${distributed_service}/dtbschedmgr/include", "${distributed_service}/dtbschedmgr/include/continue", "${distributed_service}/dtbschedmgr/include/continue/state", "${distributed_service}/dtbschedmgr/include/continue/state/source_state", "${distributed_service}/dtbschedmgr/include/continue/state/sink_state", "${distributed_service}/dtbschedmgr/include/distributedWant", "${distributed_service}/dtbschedmgr/include/softbus_adapter/transport", "${distributed_service}/dtbschedmgr/test/unittest", "${dms_path}/common/include", "${dms_path}/interfaces/innerkits/distributed_event/include", "${dms_path}/interfaces/innerkits/tests", ] } dsched_external_deps = [ "ability_base:base", "ability_base:want", "ability_base:zuri", "ability_runtime:ability_manager", "ability_runtime:app_manager", "ability_runtime:dataobs_manager", "ability_runtime:mission_info", "access_token:libaccesstoken_sdk", "access_token:libnativetoken_shared", "access_token:libtokensetproc_shared", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "cJSON:cjson", "c_utils:utils", "data_share:datashare_consumer", "device_auth:deviceauth_sdk", "device_info_manager:distributed_device_profile_common", "device_info_manager:distributed_device_profile_sdk", "device_manager:devicemanagersdk", "device_security_level:dslm_sdk", "distributed_bundle_framework:dbms_fwk", "dmsfwk:continuation_manager", "dsoftbus:softbus_client", "eventhandler:libeventhandler", "ffrt:libffrt", "hilog:libhilog", "hisysevent:libhisysevent", "hitrace:hitrace_meter", "hitrace:libhitracechain", "init:libbegetutil", "ipc:ipc_core", "kv_store:distributeddata_inner", "safwk:system_ability_fwk", "samgr:samgr_proxy", "window_manager:libwsutils", "window_manager:scene_session", "window_manager:session_manager_lite", ] if (os_account_part) { dsched_external_deps += [ "os_account:os_account_innerkits" ] } if (dmsfwk_report_memmgr) { dsched_external_deps += [ "memmgr:memmgrclient" ] } if (dmsfwk_report_memmgr_plugins) { dsched_external_deps += [ "memmgr_override:memmgrclient" ] } if (dmsfwk_standard_form_share) { dsched_external_deps += [ "form_fwk:form_manager" ] } if (dmsfwk_mission_manager) { dsched_external_deps += [ "image_framework:image_native" ] } if (efficiency_manager_service_enable) { dsched_external_deps += [ "resource_schedule_service:ressched_client" ] } if (dmsfwk_ces_listener) { dsched_external_deps += [ "common_event_service:cesfwk_innerkits" ] } if (dmsfwk_mmi_listener) { dsched_external_deps += [ "input:libmmi-client" ] } dsched_public_deps = [ "${distributed_service}/dtbschedmgr:distributedschedsvr", "${dms_path}/common:distributed_sched_utils", ] dtbschedmgr_sources = [ "unittest/distributed_sched_test_util.cpp" ] distributed_event_sources = [ "${dms_path}/interfaces/innerkits/distributed_event/src/dms_client.cpp", "${dms_path}/interfaces/innerkits/distributed_event/src/dms_handler.cpp", "${dms_path}/interfaces/innerkits/distributed_event/src/dms_listener_stub.cpp", "${dms_path}/interfaces/innerkits/distributed_event/src/dms_sa_client.cpp", ] ohos_unittest("distributedschedsvrtest") { module_out_path = module_output_path sources = [ "unittest/continue_scene_session_handler_test.cpp", "unittest/distributed_sched_adapter_test.cpp", "unittest/distributed_sched_service_first_test.cpp", "unittest/distributed_sched_service_second_test.cpp", "unittest/distributed_sched_stub_test.cpp", "unittest/dms_callback_task_test.cpp", "unittest/dms_token_callback_test.cpp", "unittest/mock_distributed_sched.cpp", "unittest/mock_remote_stub.cpp", ] sources += dtbschedmgr_sources configs = [ ":test_config", "${distributed_service}/dtbschedmgr/test/resource:coverage_flags", ] configs += dsched_configs if (is_standard_system) { external_deps = dsched_external_deps public_deps = dsched_public_deps } if (dmsfwk_report_memmgr || dmsfwk_report_memmgr_plugins) { defines = [ "SUPPORT_DISTRIBUTEDCOMPONENT_TO_MEMMGR" ] } part_name = "dmsfwk" subsystem_name = "ability" } ohos_unittest("distributedcalltest") { sanitize = { cfi = true cfi_cross_dso = true debug = false } module_out_path = module_output_path sources = [ "unittest/app_state_observer_test.cpp", "unittest/distributed_sched_call_test.cpp", ] configs = [ ":test_config", "${distributed_service}/dtbschedmgr/test/resource:coverage_flags", ] configs += dsched_configs if (is_standard_system) { external_deps = dsched_external_deps public_deps = dsched_public_deps } part_name = "dmsfwk" subsystem_name = "ability" } ohos_unittest("dmsfreeinstallcbtest") { sanitize = { cfi = true cfi_cross_dso = true debug = false } module_out_path = module_output_path sources = [ "unittest/dms_free_install_callback_test.cpp", "unittest/mock_remote_stub.cpp", ] configs = [ ":test_config", "${distributed_service}/dtbschedmgr/test/resource:coverage_flags", ] configs += dsched_configs if (is_standard_system) { external_deps = dsched_external_deps public_deps = dsched_public_deps } part_name = "dmsfwk" subsystem_name = "ability" } ohos_unittest("dschedcontinuetest") { sanitize = { cfi = true cfi_cross_dso = true debug = false } module_out_path = module_output_path sources = [ "unittest/distributed_sched_continuation_test.cpp", "unittest/dms_version_manager_test.cpp", "unittest/mock_distributed_sched.cpp", "unittest/mock_remote_stub.cpp", ] sources += dtbschedmgr_sources configs = [ ":test_config", "${distributed_service}/dtbschedmgr/test/resource:coverage_flags", ] configs += dsched_configs if (is_standard_system) { external_deps = dsched_external_deps public_deps = dsched_public_deps } if (dmsfwk_mission_manager) { defines = [ "SUPPORT_DISTRIBUTED_MISSION_MANAGER" ] } if (dmsfwk_standard_form_share) { defines += [ "SUPPORT_DISTRIBUTED_FORM_SHARE" ] } part_name = "dmsfwk" subsystem_name = "ability" } ohos_unittest("dschedconnecttest") { sanitize = { cfi = true cfi_cross_dso = true debug = false } module_out_path = module_output_path sources = [ "unittest/distributed_sched_connect_test.cpp", "unittest/mock_remote_stub.cpp", ] sources += dtbschedmgr_sources configs = [ ":test_config", "${distributed_service}/dtbschedmgr/test/resource:coverage_flags", ] configs += dsched_configs if (is_standard_system) { external_deps = dsched_external_deps public_deps = dsched_public_deps } part_name = "dmsfwk" subsystem_name = "ability" } ohos_unittest("dschedpermissiontest") { sanitize = { cfi = true cfi_cross_dso = true debug = false } module_out_path = module_output_path sources = [ "unittest/distributed_sched_permission_test.cpp" ] sources += dtbschedmgr_sources configs = [ ":test_config", "${distributed_service}/dtbschedmgr/test/resource:coverage_flags", ] configs += dsched_configs if (is_standard_system) { external_deps = dsched_external_deps public_deps = dsched_public_deps } if (token_sync_enable) { cflags_cc = [ "-DTOKEN_SYNC_ENABLE" ] } part_name = "dmsfwk" subsystem_name = "ability" } ohos_unittest("dschedmissionmanagertest") { sanitize = { cfi = true cfi_cross_dso = true debug = false } module_out_path = module_output_path cflags = [ "-Dprivate=public" ] sources = [ "unittest/mission/distributed_bm_storage_test.cpp", "unittest/mission/distributed_data_storage_test.cpp", "unittest/mission/distributed_mission_info_test.cpp", "unittest/mission/dms_continue_manager_test.cpp", "unittest/mission/dms_mission_manager_test.cpp", "unittest/mission/dsched_sync_e2e_test.cpp", "unittest/mission/mission_info_converter_test.cpp", "unittest/mission/snapshot_test.cpp", "unittest/mock_remote_stub.cpp", ] sources += dtbschedmgr_sources configs = [ ":test_config", "${distributed_service}/dtbschedmgr/test/resource:coverage_flags", ] configs += dsched_configs if (is_standard_system) { external_deps = dsched_external_deps external_deps += [ "config_policy:configpolicy_util" ] public_deps = dsched_public_deps } part_name = "dmsfwk" subsystem_name = "ability" } ohos_unittest("bundlemanagerinternaltest") { sanitize = { cfi = true cfi_cross_dso = true debug = false } module_out_path = module_output_path sources = [ "unittest/bundle_manager_internal_test.cpp" ] sources += dtbschedmgr_sources configs = [ ":test_config", "${distributed_service}/dtbschedmgr/test/resource:coverage_flags", ] configs += dsched_configs if (is_standard_system) { external_deps = dsched_external_deps public_deps = dsched_public_deps } part_name = "dmsfwk" subsystem_name = "ability" } ohos_unittest("softbusadaptertest") { module_out_path = module_output_path cflags = [ "-Dprivate=public" ] sources = [ "unittest/softbus_adapter/softbus_transport_test.cpp" ] if (!dmsfwk_softbus_adapter_common) { sources += [ "unittest/softbus_adapter/mock_softbus_adapter.cpp", "unittest/softbus_adapter/softbus_adapter_test.cpp", ] } else { sources += [ "unittest/softbus_adapter/softbus_adapter_common_test.cpp" ] } configs = [ ":test_config", "${dms_path}/services/dtbschedmgr/test/resource:coverage_flags", ] configs += dsched_configs if (is_standard_system) { external_deps = dsched_external_deps public_deps = dsched_public_deps } external_deps += [ "googletest:gmock" ] part_name = "dmsfwk" subsystem_name = "ability" } ohos_unittest("hisyseventreporttest") { sanitize = { cfi = true cfi_cross_dso = true debug = false } module_out_path = module_output_path sources = [ "unittest/dms_hisysevent_report_test.cpp" ] configs = [ ":test_config", "${distributed_service}/dtbschedmgr/test/resource:coverage_flags", ] configs += dsched_configs deps = [] if (is_standard_system) { external_deps = dsched_external_deps public_deps = dsched_public_deps } part_name = "dmsfwk" subsystem_name = "ability" } ohos_unittest("distributeduidtest") { module_out_path = module_output_path sources = [ "unittest/distributed_sched_uid_test.cpp" ] sources += dtbschedmgr_sources configs = [ ":test_config", "${distributed_service}/dtbschedmgr/test/resource:coverage_flags", ] configs += dsched_configs if (is_standard_system) { external_deps = dsched_external_deps public_deps = dsched_public_deps } part_name = "dmsfwk" subsystem_name = "ability" } ohos_unittest("distributedwanttest") { sanitize = { blocklist = "./cfi_blocklist.txt" cfi = true cfi_cross_dso = true debug = false } module_out_path = module_output_path sources = [ "unittest/distributedWant/distributed_operation_test.cpp", "unittest/distributedWant/distributed_want_params_test.cpp", "unittest/distributedWant/distributed_want_params_wrapper_test.cpp", "unittest/distributedWant/distributed_want_test.cpp", ] configs = [ ":test_config", "${distributed_service}/dtbschedmgr/test/resource:coverage_flags", ] configs += dsched_configs if (is_standard_system) { external_deps = dsched_external_deps public_deps = dsched_public_deps } part_name = "dmsfwk" subsystem_name = "ability" } ohos_unittest("dmsbasetest") { sanitize = { cfi = true cfi_cross_dso = true debug = false } module_out_path = module_output_path cflags = [ "-Dprivate=public" ] sources = [ "unittest/deviceManager/dms_device_info_test.cpp", "unittest/dfx/distributed_radar_test.cpp", "unittest/dfx/distributed_sched_dumper_test.cpp", "unittest/dfx/distributed_ue_test.cpp", "unittest/dfx/dms_continue_time_dumper_test.cpp", "unittest/dfx/dms_hisysevent_report_test.cpp", ] sources += dtbschedmgr_sources configs = [ ":test_config", "./resource:coverage_flags", ] deps = [] configs += dsched_configs if (is_standard_system) { external_deps = dsched_external_deps public_deps = dsched_public_deps } part_name = "dmsfwk" subsystem_name = "ability" } ohos_unittest("dschedswitchstatustest") { sanitize = { cfi = true cfi_cross_dso = true debug = false } module_out_path = module_output_path sources = [ "unittest/switch_status_dependency_test.cpp" ] configs = [ ":test_config", "${dms_path}/services/dtbschedmgr/test/resource:coverage_flags", ] configs += dsched_configs deps = [] if (is_standard_system) { external_deps = dsched_external_deps public_deps = dsched_public_deps } part_name = "dmsfwk" subsystem_name = "ability" } ohos_unittest("dschedcontinuestatetest") { sanitize = { cfi = true cfi_cross_dso = true debug = false } module_out_path = module_output_path cflags = [ "-Dprivate=public" ] sources = [ "unittest/continue/dsched_continue_manager_test.cpp", "unittest/continue/dsched_continue_state_test.cpp", "unittest/continue/dsched_continue_test.cpp", "unittest/mock_distributed_sched.cpp", ] sources += dtbschedmgr_sources configs = [ ":test_config", "${dms_path}/services/dtbschedmgr/test/resource:coverage_flags", ] configs += dsched_configs deps = [] if (is_standard_system) { external_deps = dsched_external_deps public_deps = dsched_public_deps } part_name = "dmsfwk" subsystem_name = "ability" } ohos_unittest("distributedeventtest") { sanitize = { cfi = true cfi_cross_dso = true debug = false } module_out_path = module_output_path cflags = [ "-Dprivate=public" ] sources = [ "unittest/distributed_event/dms_client_test.cpp", "unittest/distributed_event/dms_handler_test.cpp", "unittest/distributed_event/dms_listener_stub_test.cpp", "unittest/distributed_event/dms_sa_cilent_test.cpp", ] sources += dtbschedmgr_sources sources += distributed_event_sources configs = [ ":test_config", "${dms_path}/services/dtbschedmgr/test/resource:coverage_flags", ] configs += dsched_configs deps = [] if (is_standard_system) { external_deps = dsched_external_deps public_deps = dsched_public_deps } part_name = "dmsfwk" subsystem_name = "ability" } ohos_unittest("distributedadaptertest") { module_out_path = module_output_path cflags = [ "-Dprivate=public" ] sources = [ "unittest/dms_network_adapter_test.cpp", "unittest/dtbschedmgr_device_info_storage_test.cpp", ] if (dmsfwk_mmi_listener) { sources += [ "unittest/adapter/mmi_adapter_test.cpp" ] } sources += dtbschedmgr_sources configs = [ ":test_config", "${dms_path}/services/dtbschedmgr/test/resource:coverage_flags", ] configs += dsched_configs deps = [] if (is_standard_system) { external_deps = dsched_external_deps public_deps = dsched_public_deps } part_name = "dmsfwk" subsystem_name = "ability" } group("unittest") { testonly = true deps = [ ":bundlemanagerinternaltest", ":distributedadaptertest", ":distributedcalltest", ":distributedeventtest", ":distributedschedsvrtest", ":distributeduidtest", ":distributedwanttest", ":dmsbasetest", ":dmsfreeinstallcbtest", ":dschedconnecttest", ":dschedcontinuestatetest", ":dschedcontinuetest", ":dschedswitchstatustest", ":hisyseventreporttest", ":softbusadaptertest", "${dms_path}/common/test/unittest:distributed_sched_utils_test", ] if (dmsfwk_mission_manager) { deps += [ ":dschedmissionmanagertest", ":dschedpermissiontest", ] } }