153c3577eSopenharmony_ci# Copyright (c) 2021 Huawei Device Co., Ltd. 253c3577eSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 353c3577eSopenharmony_ci# you may not use this file except in compliance with the License. 453c3577eSopenharmony_ci# You may obtain a copy of the License at 553c3577eSopenharmony_ci# 653c3577eSopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 753c3577eSopenharmony_ci# 853c3577eSopenharmony_ci# Unless required by applicable law or agreed to in writing, software 953c3577eSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 1053c3577eSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1153c3577eSopenharmony_ci# See the License for the specific language governing permissions and 1253c3577eSopenharmony_ci# limitations under the License. 1353c3577eSopenharmony_ciimport("//build/test.gni") 1453c3577eSopenharmony_ciimport("//foundation/distributeddatamgr/datamgr_service/datamgr_service.gni") 1553c3577eSopenharmony_ci 1653c3577eSopenharmony_cimodule_output_path = "datamgr_service/distributeddataservice" 1753c3577eSopenharmony_ci 1853c3577eSopenharmony_ci############################################################################### 1953c3577eSopenharmony_ciconfig("module_private_config") { 2053c3577eSopenharmony_ci visibility = [ ":*" ] 2153c3577eSopenharmony_ci include_dirs = [ 2253c3577eSopenharmony_ci "${kv_store_path}/frameworks/innerkitsimpl/distributeddatasvc/include", 2353c3577eSopenharmony_ci "${kv_store_path}/frameworks/common", 2453c3577eSopenharmony_ci "${kv_store_path}/frameworks/innerkitsimpl/distributeddatafwk/include", 2553c3577eSopenharmony_ci "${kv_store_path}/frameworks/innerkitsimpl/distributeddatafwk/src", 2653c3577eSopenharmony_ci "${kv_store_path}/frameworks/innerkitsimpl/kvdb/include", 2753c3577eSopenharmony_ci "${kv_store_path}/interfaces/innerkits/distributeddata/include", 2853c3577eSopenharmony_ci "${data_service_path}/adapter/include/permission", 2953c3577eSopenharmony_ci "${data_service_path}/adapter/include/account", 3053c3577eSopenharmony_ci "${data_service_path}/adapter/include", 3153c3577eSopenharmony_ci "${data_service_path}/adapter/include/dfx", 3253c3577eSopenharmony_ci "${data_service_path}/adapter/include/broadcaster", 3353c3577eSopenharmony_ci "${data_service_path}/adapter/include/utils", 3453c3577eSopenharmony_ci "${data_service_path}/framework/include", 3553c3577eSopenharmony_ci "${data_service_path}/service/bootstrap/include", 3653c3577eSopenharmony_ci "${data_service_path}/service/common", 3753c3577eSopenharmony_ci "${data_service_path}/service/config/include", 3853c3577eSopenharmony_ci "${data_service_path}/service/crypto/include", 3953c3577eSopenharmony_ci "${data_service_path}/service/directory/include", 4053c3577eSopenharmony_ci "${data_service_path}/service/permission/include", 4153c3577eSopenharmony_ci "${data_service_path}/service/matrix/include", 4253c3577eSopenharmony_ci "${data_service_path}/service/waterversion", 4353c3577eSopenharmony_ci "${data_service_path}/app/src/session_manager", 4453c3577eSopenharmony_ci "${data_service_path}/service/kvdb", 4553c3577eSopenharmony_ci "${device_manager_path}/interfaces/inner_kits/native_cpp/include", 4653c3577eSopenharmony_ci "//commonlibrary/c_utils/base/include", 4753c3577eSopenharmony_ci "//utils/system/safwk/native/include", 4853c3577eSopenharmony_ci "../include", 4953c3577eSopenharmony_ci "../src", 5053c3577eSopenharmony_ci "../src/security", 5153c3577eSopenharmony_ci "unittest", 5253c3577eSopenharmony_ci "../src/installer", 5353c3577eSopenharmony_ci "../src/flowctrl_manager", 5453c3577eSopenharmony_ci "../../service/backup/include", 5553c3577eSopenharmony_ci "../../../../interfaces/innerkits/distributeddata", 5653c3577eSopenharmony_ci "../../service/dumper/include", 5753c3577eSopenharmony_ci "//third_party/json/single_include", 5853c3577eSopenharmony_ci ] 5953c3577eSopenharmony_ci 6053c3577eSopenharmony_ci if (datamgr_service_power) { 6153c3577eSopenharmony_ci include_dirs += 6253c3577eSopenharmony_ci [ "//base/powermgr/power_manager/interfaces/innerkits/native/include" ] 6353c3577eSopenharmony_ci } 6453c3577eSopenharmony_ci ldflags = [ "-Wl,--whole-archive" ] 6553c3577eSopenharmony_ci defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ] 6653c3577eSopenharmony_ci} 6753c3577eSopenharmony_ci 6853c3577eSopenharmony_ciohos_unittest("KvStoreDataServiceTest") { 6953c3577eSopenharmony_ci module_out_path = module_output_path 7053c3577eSopenharmony_ci sources = [ 7153c3577eSopenharmony_ci "${data_service_path}/service/common/xcollie.cpp", 7253c3577eSopenharmony_ci "../src/db_info_handle_impl.cpp", 7353c3577eSopenharmony_ci "../src/feature_stub_impl.cpp", 7453c3577eSopenharmony_ci "../src/kvstore_account_observer.cpp", 7553c3577eSopenharmony_ci "../src/kvstore_data_service.cpp", 7653c3577eSopenharmony_ci "../src/kvstore_data_service_stub.cpp", 7753c3577eSopenharmony_ci "../src/kvstore_device_listener.cpp", 7853c3577eSopenharmony_ci "../src/kvstore_meta_manager.cpp", 7953c3577eSopenharmony_ci "../src/security/security.cpp", 8053c3577eSopenharmony_ci "../src/security/sensitive.cpp", 8153c3577eSopenharmony_ci "../src/session_manager/route_head_handler_impl.cpp", 8253c3577eSopenharmony_ci "../src/session_manager/session_manager.cpp", 8353c3577eSopenharmony_ci "../src/session_manager/upgrade_manager.cpp", 8453c3577eSopenharmony_ci "../src/task_manager.cpp", 8553c3577eSopenharmony_ci "unittest/kvstore_data_service_test.cpp", 8653c3577eSopenharmony_ci ] 8753c3577eSopenharmony_ci 8853c3577eSopenharmony_ci configs = [ ":module_private_config" ] 8953c3577eSopenharmony_ci 9053c3577eSopenharmony_ci external_deps = [ 9153c3577eSopenharmony_ci "access_token:libaccesstoken_sdk", 9253c3577eSopenharmony_ci "c_utils:utils", 9353c3577eSopenharmony_ci "dataclassification:data_transit_mgr", 9453c3577eSopenharmony_ci "device_auth:deviceauth_sdk", 9553c3577eSopenharmony_ci "file_api:securitylabel", 9653c3577eSopenharmony_ci "hicollie:libhicollie", 9753c3577eSopenharmony_ci "hilog:libhilog", 9853c3577eSopenharmony_ci "hisysevent:libhisysevent", 9953c3577eSopenharmony_ci "hitrace:hitrace_meter", 10053c3577eSopenharmony_ci "hitrace:libhitracechain", 10153c3577eSopenharmony_ci "ipc:ipc_core", 10253c3577eSopenharmony_ci "memmgr:memmgrclient", 10353c3577eSopenharmony_ci "safwk:system_ability_fwk", 10453c3577eSopenharmony_ci "samgr:samgr_proxy", 10553c3577eSopenharmony_ci ] 10653c3577eSopenharmony_ci 10753c3577eSopenharmony_ci if (datamgr_service_power) { 10853c3577eSopenharmony_ci external_deps += [ 10953c3577eSopenharmony_ci "battery_manager:batterysrv_client", 11053c3577eSopenharmony_ci "power_manager:powermgr_client", 11153c3577eSopenharmony_ci ] 11253c3577eSopenharmony_ci } 11353c3577eSopenharmony_ci 11453c3577eSopenharmony_ci cflags = [ 11553c3577eSopenharmony_ci "-Dprivate=public", 11653c3577eSopenharmony_ci "-Dprotected=public", 11753c3577eSopenharmony_ci ] 11853c3577eSopenharmony_ci 11953c3577eSopenharmony_ci deps = [ 12053c3577eSopenharmony_ci "${data_service_path}/adapter:distributeddata_adapter", 12153c3577eSopenharmony_ci "${data_service_path}/adapter/broadcaster:distributeddata_broadcaster_static", 12253c3577eSopenharmony_ci "${data_service_path}/adapter/utils:distributeddata_utils_static", 12353c3577eSopenharmony_ci "${data_service_path}/app/src/checker:distributeddata_checker_static", 12453c3577eSopenharmony_ci "${data_service_path}/app/src/flowctrl_manager:distributeddata_flowctrl_static", 12553c3577eSopenharmony_ci "${data_service_path}/app/src/installer:distributeddata_installer_static", 12653c3577eSopenharmony_ci "${data_service_path}/framework:distributeddatasvcfwk", 12753c3577eSopenharmony_ci "${data_service_path}/service:distributeddatasvc", 12853c3577eSopenharmony_ci "${kv_store_path}/frameworks/libs/distributeddb:distributeddb", 12953c3577eSopenharmony_ci "${kv_store_path}/interfaces/innerkits/distributeddata:distributeddata_inner", 13053c3577eSopenharmony_ci "${kv_store_path}/interfaces/innerkits/distributeddatamgr:distributeddata_mgr", 13153c3577eSopenharmony_ci "//third_party/googletest:gtest_main", 13253c3577eSopenharmony_ci ] 13353c3577eSopenharmony_ci part_name = "datamgr_service" 13453c3577eSopenharmony_ci} 13553c3577eSopenharmony_ci 13653c3577eSopenharmony_ciohos_unittest("SessionManagerTest") { 13753c3577eSopenharmony_ci module_out_path = module_output_path 13853c3577eSopenharmony_ci 13953c3577eSopenharmony_ci sources = [ 14053c3577eSopenharmony_ci "../src/kvstore_meta_manager.cpp", 14153c3577eSopenharmony_ci "../src/session_manager/route_head_handler_impl.cpp", 14253c3577eSopenharmony_ci "../src/session_manager/session_manager.cpp", 14353c3577eSopenharmony_ci "../src/session_manager/upgrade_manager.cpp", 14453c3577eSopenharmony_ci "unittest/session_manager_test.cpp", 14553c3577eSopenharmony_ci ] 14653c3577eSopenharmony_ci 14753c3577eSopenharmony_ci sanitize = { 14853c3577eSopenharmony_ci cfi = true 14953c3577eSopenharmony_ci cfi_cross_dso = true 15053c3577eSopenharmony_ci debug = false 15153c3577eSopenharmony_ci } 15253c3577eSopenharmony_ci 15353c3577eSopenharmony_ci cflags_cc = [ "-DUT_TEST" ] 15453c3577eSopenharmony_ci configs = [ ":module_private_config" ] 15553c3577eSopenharmony_ci 15653c3577eSopenharmony_ci external_deps = [ 15753c3577eSopenharmony_ci "access_token:libaccesstoken_sdk", 15853c3577eSopenharmony_ci "access_token:libnativetoken", 15953c3577eSopenharmony_ci "access_token:libtoken_setproc", 16053c3577eSopenharmony_ci "c_utils:utils", 16153c3577eSopenharmony_ci "dataclassification:data_transit_mgr", 16253c3577eSopenharmony_ci "device_auth:deviceauth_sdk", 16353c3577eSopenharmony_ci "file_api:securitylabel", 16453c3577eSopenharmony_ci "hilog:libhilog", 16553c3577eSopenharmony_ci "hisysevent:libhisysevent", 16653c3577eSopenharmony_ci "ipc:ipc_core", 16753c3577eSopenharmony_ci "safwk:system_ability_fwk", 16853c3577eSopenharmony_ci "samgr:samgr_proxy", 16953c3577eSopenharmony_ci ] 17053c3577eSopenharmony_ci 17153c3577eSopenharmony_ci if (datamgr_service_power) { 17253c3577eSopenharmony_ci external_deps += [ 17353c3577eSopenharmony_ci "battery_manager:batterysrv_client", 17453c3577eSopenharmony_ci "power_manager:powermgr_client", 17553c3577eSopenharmony_ci ] 17653c3577eSopenharmony_ci } 17753c3577eSopenharmony_ci 17853c3577eSopenharmony_ci deps = [ 17953c3577eSopenharmony_ci "${kv_store_path}/interfaces/innerkits/distributeddatamgr:distributeddata_mgr", 18053c3577eSopenharmony_ci "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter", 18153c3577eSopenharmony_ci "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter/broadcaster:distributeddata_broadcaster_static", 18253c3577eSopenharmony_ci "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter/utils:distributeddata_utils_static", 18353c3577eSopenharmony_ci "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/app/src/checker:distributeddata_checker_static", 18453c3577eSopenharmony_ci "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/framework:distributeddatasvcfwk", 18553c3577eSopenharmony_ci "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service:distributeddatasvc", 18653c3577eSopenharmony_ci "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb:distributeddb", 18753c3577eSopenharmony_ci "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner", 18853c3577eSopenharmony_ci "//third_party/googletest:gtest_main", 18953c3577eSopenharmony_ci ] 19053c3577eSopenharmony_ci 19153c3577eSopenharmony_ci part_name = "datamgr_service" 19253c3577eSopenharmony_ci} 19353c3577eSopenharmony_ci 19453c3577eSopenharmony_ciohos_unittest("KvStoreFlowCtrlManagerTest") { 19553c3577eSopenharmony_ci module_out_path = module_output_path 19653c3577eSopenharmony_ci sources = [ "unittest/kvstore_flowctrl_manager_test.cpp" ] 19753c3577eSopenharmony_ci 19853c3577eSopenharmony_ci configs = [ ":module_private_config" ] 19953c3577eSopenharmony_ci 20053c3577eSopenharmony_ci external_deps = [ 20153c3577eSopenharmony_ci "access_token:libaccesstoken_sdk", 20253c3577eSopenharmony_ci "c_utils:utils", 20353c3577eSopenharmony_ci "dataclassification:data_transit_mgr", 20453c3577eSopenharmony_ci "device_auth:deviceauth_sdk", 20553c3577eSopenharmony_ci "file_api:securitylabel", 20653c3577eSopenharmony_ci "hilog:libhilog", 20753c3577eSopenharmony_ci "hisysevent:libhisysevent", 20853c3577eSopenharmony_ci "ipc:ipc_core", 20953c3577eSopenharmony_ci "safwk:system_ability_fwk", 21053c3577eSopenharmony_ci "samgr:samgr_proxy", 21153c3577eSopenharmony_ci ] 21253c3577eSopenharmony_ci 21353c3577eSopenharmony_ci if (datamgr_service_power) { 21453c3577eSopenharmony_ci external_deps += [ 21553c3577eSopenharmony_ci "battery_manager:batterysrv_client", 21653c3577eSopenharmony_ci "power_manager:powermgr_client", 21753c3577eSopenharmony_ci ] 21853c3577eSopenharmony_ci } 21953c3577eSopenharmony_ci 22053c3577eSopenharmony_ci deps = [ 22153c3577eSopenharmony_ci "${kv_store_path}/interfaces/innerkits/distributeddatamgr:distributeddata_mgr", 22253c3577eSopenharmony_ci "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter", 22353c3577eSopenharmony_ci "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/app/src/flowctrl_manager:distributeddata_flowctrl_static", 22453c3577eSopenharmony_ci "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/framework:distributeddatasvcfwk", 22553c3577eSopenharmony_ci "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service:distributeddatasvc", 22653c3577eSopenharmony_ci "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner", 22753c3577eSopenharmony_ci "//third_party/googletest:gtest_main", 22853c3577eSopenharmony_ci ] 22953c3577eSopenharmony_ci part_name = "datamgr_service" 23053c3577eSopenharmony_ci} 23153c3577eSopenharmony_ci 23253c3577eSopenharmony_ciohos_unittest("KvStoreDataServiceClearTest") { 23353c3577eSopenharmony_ci module_out_path = module_output_path 23453c3577eSopenharmony_ci sources = [ 23553c3577eSopenharmony_ci "${data_service_path}/app/src/db_info_handle_impl.cpp", 23653c3577eSopenharmony_ci "${data_service_path}/app/src/feature_stub_impl.cpp", 23753c3577eSopenharmony_ci "${data_service_path}/app/src/kvstore_account_observer.cpp", 23853c3577eSopenharmony_ci "${data_service_path}/app/src/kvstore_data_service.cpp", 23953c3577eSopenharmony_ci "${data_service_path}/app/src/kvstore_data_service_stub.cpp", 24053c3577eSopenharmony_ci "${data_service_path}/app/src/kvstore_device_listener.cpp", 24153c3577eSopenharmony_ci "${data_service_path}/app/src/kvstore_meta_manager.cpp", 24253c3577eSopenharmony_ci "${data_service_path}/app/src/security/security.cpp", 24353c3577eSopenharmony_ci "${data_service_path}/app/src/security/sensitive.cpp", 24453c3577eSopenharmony_ci "${data_service_path}/app/src/session_manager/route_head_handler_impl.cpp", 24553c3577eSopenharmony_ci "${data_service_path}/app/src/session_manager/session_manager.cpp", 24653c3577eSopenharmony_ci "${data_service_path}/app/src/session_manager/upgrade_manager.cpp", 24753c3577eSopenharmony_ci "${data_service_path}/app/src/task_manager.cpp", 24853c3577eSopenharmony_ci "${data_service_path}/service/common/xcollie.cpp", 24953c3577eSopenharmony_ci "unittest/kvstore_data_service_clear_test.cpp", 25053c3577eSopenharmony_ci ] 25153c3577eSopenharmony_ci 25253c3577eSopenharmony_ci sanitize = { 25353c3577eSopenharmony_ci cfi = true 25453c3577eSopenharmony_ci cfi_cross_dso = true 25553c3577eSopenharmony_ci debug = false 25653c3577eSopenharmony_ci } 25753c3577eSopenharmony_ci 25853c3577eSopenharmony_ci configs = [ ":module_private_config" ] 25953c3577eSopenharmony_ci 26053c3577eSopenharmony_ci external_deps = [ 26153c3577eSopenharmony_ci "access_token:libaccesstoken_sdk", 26253c3577eSopenharmony_ci "access_token:libnativetoken", 26353c3577eSopenharmony_ci "access_token:libtoken_setproc", 26453c3577eSopenharmony_ci "access_token:libtokenid_sdk", 26553c3577eSopenharmony_ci "c_utils:utils", 26653c3577eSopenharmony_ci "dataclassification:data_transit_mgr", 26753c3577eSopenharmony_ci "device_auth:deviceauth_sdk", 26853c3577eSopenharmony_ci "file_api:securitylabel", 26953c3577eSopenharmony_ci "hicollie:libhicollie", 27053c3577eSopenharmony_ci "hilog:libhilog", 27153c3577eSopenharmony_ci "hisysevent:libhisysevent", 27253c3577eSopenharmony_ci "hitrace:hitrace_meter", 27353c3577eSopenharmony_ci "hitrace:libhitracechain", 27453c3577eSopenharmony_ci "ipc:ipc_core", 27553c3577eSopenharmony_ci "kv_store:distributeddata_inner", 27653c3577eSopenharmony_ci "kv_store:distributeddata_mgr", 27753c3577eSopenharmony_ci "kv_store:distributeddb", 27853c3577eSopenharmony_ci "memmgr:memmgrclient", 27953c3577eSopenharmony_ci "safwk:system_ability_fwk", 28053c3577eSopenharmony_ci "samgr:samgr_proxy", 28153c3577eSopenharmony_ci ] 28253c3577eSopenharmony_ci 28353c3577eSopenharmony_ci if (datamgr_service_power) { 28453c3577eSopenharmony_ci external_deps += [ 28553c3577eSopenharmony_ci "battery_manager:batterysrv_client", 28653c3577eSopenharmony_ci "power_manager:powermgr_client", 28753c3577eSopenharmony_ci ] 28853c3577eSopenharmony_ci } 28953c3577eSopenharmony_ci 29053c3577eSopenharmony_ci deps = [ 29153c3577eSopenharmony_ci "${data_service_path}/adapter:distributeddata_adapter", 29253c3577eSopenharmony_ci "${data_service_path}/adapter/broadcaster:distributeddata_broadcaster_static", 29353c3577eSopenharmony_ci "${data_service_path}/adapter/utils:distributeddata_utils_static", 29453c3577eSopenharmony_ci "${data_service_path}/app/src/checker:distributeddata_checker_static", 29553c3577eSopenharmony_ci "${data_service_path}/app/src/flowctrl_manager:distributeddata_flowctrl_static", 29653c3577eSopenharmony_ci "${data_service_path}/app/src/installer:distributeddata_installer_static", 29753c3577eSopenharmony_ci "${data_service_path}/framework:distributeddatasvcfwk", 29853c3577eSopenharmony_ci "${data_service_path}/service:distributeddatasvc", 29953c3577eSopenharmony_ci "//third_party/googletest:gtest_main", 30053c3577eSopenharmony_ci ] 30153c3577eSopenharmony_ci 30253c3577eSopenharmony_ci part_name = "datamgr_service" 30353c3577eSopenharmony_ci} 30453c3577eSopenharmony_ci 30553c3577eSopenharmony_ci############################################################################### 30653c3577eSopenharmony_ci 30753c3577eSopenharmony_cigroup("unittest") { 30853c3577eSopenharmony_ci testonly = true 30953c3577eSopenharmony_ci deps = [] 31053c3577eSopenharmony_ci 31153c3577eSopenharmony_ci deps += [ 31253c3577eSopenharmony_ci ":KvStoreDataServiceClearTest", 31353c3577eSopenharmony_ci ":KvStoreDataServiceTest", 31453c3577eSopenharmony_ci ":KvStoreFlowCtrlManagerTest", 31553c3577eSopenharmony_ci ":SessionManagerTest", 31653c3577eSopenharmony_ci ] 31753c3577eSopenharmony_ci} 31853c3577eSopenharmony_ci 31953c3577eSopenharmony_ci############################################################################### 32053c3577eSopenharmony_cigroup("moduletest") { 32153c3577eSopenharmony_ci testonly = true 32253c3577eSopenharmony_ci deps = [ 32353c3577eSopenharmony_ci "//third_party/googletest:gmock", 32453c3577eSopenharmony_ci "//third_party/googletest:gtest_main", 32553c3577eSopenharmony_ci "//third_party/sqlite:sqlite", 32653c3577eSopenharmony_ci ] 32753c3577eSopenharmony_ci 32853c3577eSopenharmony_ci deps += [ 32953c3577eSopenharmony_ci #":DistributedDataAccountEventModuleTest", 33053c3577eSopenharmony_ci #":DistributedDataFlowCtrlManagerTest", 33153c3577eSopenharmony_ci ] 33253c3577eSopenharmony_ci} 33353c3577eSopenharmony_ci############################################################################### 334