# Copyright (c) 2022 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_var.gni") import("//build/test.gni") import("//foundation/distributeddatamgr/datamgr_service/datamgr_service.gni") module_output_path = "datamgr_service/distributeddatafwk" ############################################################################### config("module_private_config") { visibility = [ ":*" ] include_dirs = [ "${device_manager_path}/interfaces/inner_kits/native_cpp/include", "../include/", "../../service/bootstrap/include/", "../../service/common/", "../../service/rdb/", "../../../../../relational_store/interfaces/inner_api/rdb/include", "../../../../../relational_store/interfaces/inner_api/common_type/include", "${kv_store_distributeddb_path}/interfaces/include", "${kv_store_distributeddb_path}/include", "${kv_store_path}/frameworks/innerkitsimpl/distributeddatasvc/include", "${kv_store_path}/frameworks/innerkitsimpl/distributeddatafwk/include", "${kv_store_common_path}", "${kv_store_path}/frameworks/innerkitsimpl/distributeddatafwk/src", "${kv_store_path}/frameworks/innerkitsimpl/kvdb/include", "${kv_store_path}/interfaces/innerkits/distributeddata/include", "${data_service_path}/adapter/include", "${data_service_path}/framework/include", "${data_service_path}/service/config/include", "${data_service_path}/app/src", "${data_service_path}/adapter/include/account", "${data_service_path}/app/src/security", "${data_service_path}/service/crypto/include", "${data_service_path}/service/matrix/include", "${data_service_path}/service/waterversion", "//third_party/json/single_include", ] ldflags = [ "-Wl,--whole-archive" ] defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ] } ohos_unittest("CheckerManagerTest") { module_out_path = module_output_path sources = [ "checker_manager_test.cpp" ] configs = [ ":module_private_config" ] external_deps = [ "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "c_utils:utils", "hilog:libhilog", "ipc:ipc_core", ] deps = [ "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter", "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/app/src/checker:distributeddata_checker_static", "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/framework:distributeddatasvcfwk", "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service:distributeddatasvc", "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner", "//third_party/googletest:gtest_main", "//third_party/openssl:libcrypto_shared", ] } ohos_unittest("EventCenterTest") { module_out_path = module_output_path sources = [ "event_center_test.cpp" ] configs = [ ":module_private_config" ] external_deps = [ "c_utils:utils", "hilog:libhilog", "ipc:ipc_core", ] deps = [ "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter", "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/framework:distributeddatasvcfwk", "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner", "//third_party/googletest:gtest_main", ] } ohos_unittest("SerializableTest") { module_out_path = module_output_path sources = [ "serializable_test.cpp" ] configs = [ ":module_private_config" ] external_deps = [ "ability_base:base", "ability_base:want", "c_utils:utils", "hilog:libhilog", "ipc:ipc_core", ] deps = [ "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter", "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/framework:distributeddatasvcfwk", "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner", "//third_party/googletest:gtest_main", "//third_party/openssl:libcrypto_shared", ] } ohos_unittest("ServiceUtilsTest") { module_out_path = module_output_path sources = [ "utils_test.cpp" ] configs = [ ":module_private_config" ] cflags = [ "-Dprivate=public", "-Dprotected=public", ] external_deps = [ "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "c_utils:utils", "hilog:libhilog", "ipc:ipc_core", ] deps = [ "${data_service_path}/framework:distributeddatasvcfwk", "//third_party/googletest:gtest_main", ] } ohos_unittest("StoreTest") { module_out_path = module_output_path include_dirs = [ "${data_service_path}/service/test/mock" ] sources = [ "${data_service_path}/framework/metadata/store_meta_data.cpp", "${data_service_path}/framework/store/auto_cache.cpp", "${data_service_path}/service/rdb/rdb_query.cpp", "${data_service_path}/service/test/mock/general_store_mock.cpp", "store_test.cpp", ] configs = [ ":module_private_config" ] cflags = [ "-Dprivate=public", "-Dprotected=public", ] external_deps = [ "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "c_utils:utils", "hilog:libhilog", "ipc:ipc_core", "kv_store:distributeddata_inner", "kv_store:distributeddb", "relational_store:native_rdb", ] deps = [ "${data_service_path}/framework:distributeddatasvcfwk", "${data_service_path}/service:distributeddatasvc", "//third_party/googletest:gtest_main", ] } ohos_unittest("AssetLoaderTest") { module_out_path = module_output_path sources = [ "asset_loader_test.cpp" ] configs = [ ":module_private_config" ] deps = [ "${data_service_path}/framework:distributeddatasvcfwk" ] } ohos_unittest("BackupRuleManagerTest") { module_out_path = module_output_path sources = [ "backup_rule_manager_test.cpp" ] configs = [ ":module_private_config" ] deps = [ "${data_service_path}/framework:distributeddatasvcfwk" ] } ohos_unittest("BindEventTest") { module_out_path = module_output_path sources = [ "bind_event_test.cpp" ] configs = [ ":module_private_config" ] deps = [ "${data_service_path}/framework:distributeddatasvcfwk" ] } ohos_unittest("CloudInfoTest") { module_out_path = module_output_path sources = [ "cloud_test.cpp" ] configs = [ ":module_private_config" ] deps = [ "${data_service_path}/framework:distributeddatasvcfwk" ] } ohos_unittest("ConstantTest") { module_out_path = module_output_path sources = [ "constant_test.cpp" ] configs = [ ":module_private_config" ] deps = [ "${data_service_path}/framework:distributeddatasvcfwk" ] } ohos_unittest("CryptoTest") { module_out_path = module_output_path sources = [ "crypto_test.cpp" ] configs = [ ":module_private_config" ] deps = [ "${data_service_path}/framework:distributeddatasvcfwk" ] } ohos_unittest("EventTest") { module_out_path = module_output_path sources = [ "event_test.cpp" ] configs = [ ":module_private_config" ] deps = [ "${data_service_path}/framework:distributeddatasvcfwk" ] } ohos_unittest("FeatureTest") { module_out_path = module_output_path sources = [ "feature_test.cpp" ] configs = [ ":module_private_config" ] deps = [ "${data_service_path}/framework:distributeddatasvcfwk", "${kv_store_path}/interfaces/innerkits/distributeddata:distributeddata_inner", ] } ohos_unittest("MetaDataManagerTest") { module_out_path = module_output_path sources = [ "meta_data_manager_test.cpp" ] configs = [ ":module_private_config" ] external_deps = [ "c_utils:utils", "hilog:libhilog", "ipc:ipc_core", ] deps = [ "${data_service_path}/framework:distributeddatasvcfwk", "${data_service_path}/service:distributeddatasvc", "//third_party/googletest:gtest_main", ] } ohos_unittest("GeneralStoreTest") { module_out_path = module_output_path sources = [ "general_store_test.cpp" ] configs = [ ":module_private_config" ] deps = [ "${data_service_path}/framework:distributeddatasvcfwk" ] } ohos_unittest("SubscriptionTest") { module_out_path = module_output_path sources = [ "subscription_test.cpp" ] configs = [ ":module_private_config" ] deps = [ "${data_service_path}/framework:distributeddatasvcfwk" ] } ohos_unittest("StoreMetaDataLocalTest") { module_out_path = module_output_path sources = [ "store_meta_data_local_test.cpp" ] configs = [ ":module_private_config" ] deps = [ "${data_service_path}/framework:distributeddatasvcfwk" ] } ohos_unittest("ServiceMetaDataTest") { module_out_path = module_output_path sources = [ "${data_service_path}/app/src/kvstore_meta_manager.cpp", "meta_data_test.cpp", ] sanitize = { cfi = true cfi_cross_dso = true debug = false } configs = [ ":module_private_config" ] include_dirs = [ "${device_manager_path}/interfaces/inner_kits/native_cpp/include", "../include/", "../../service/bootstrap/include/", "../../service/common/", "../../service/rdb/", "../../../../../relational_store/interfaces/inner_api/rdb/include", "../../../../../relational_store/interfaces/inner_api/common_type/include", "${kv_store_distributeddb_path}/interfaces/include", "${kv_store_distributeddb_path}/include", "${kv_store_path}/frameworks/innerkitsimpl/distributeddatasvc/include", "${kv_store_path}/frameworks/innerkitsimpl/distributeddatafwk/include", "${kv_store_common_path}", "${kv_store_path}/frameworks/innerkitsimpl/distributeddatafwk/src", "${kv_store_path}/frameworks/innerkitsimpl/kvdb/include", "${kv_store_path}/interfaces/innerkits/distributeddata/include", "${data_service_path}/adapter/include", "${data_service_path}/framework/include", "${data_service_path}/service/config/include", "${data_service_path}/app/src", "${data_service_path}/adapter/include/account", "${data_service_path}/app/src/security", "${data_service_path}/service/crypto/include", "${data_service_path}/service/matrix/include", "${data_service_path}/service/waterversion", "${data_service_path}/service/kvdb", "//third_party/json/single_include", ] external_deps = [ "c_utils:utils", "dataclassification:data_transit_mgr", "device_auth:deviceauth_sdk", "hilog:libhilog", "hisysevent:libhisysevent", "hitrace:hitrace_meter", "hitrace:libhitracechain", "ipc:ipc_core", "kv_store:distributeddata_inner", "kv_store:distributeddata_mgr", "kv_store:distributeddb", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] deps = [ "${data_service_path}/adapter:distributeddata_adapter", "${data_service_path}/adapter/broadcaster:distributeddata_broadcaster_static", "${data_service_path}/adapter/utils:distributeddata_utils_static", "${data_service_path}/app/src/checker:distributeddata_checker_static", "${data_service_path}/framework:distributeddatasvcfwk", "${data_service_path}/service:distributeddatasvc", "${kv_store_distributeddb_path}:distributeddb", "${kv_store_path}/interfaces/innerkits/distributeddata:distributeddata_inner", "${kv_store_path}/interfaces/innerkits/distributeddatamgr:distributeddata_mgr", "//third_party/googletest:gtest_main", "//third_party/openssl:libcrypto_shared", ] } ############################################################################### group("unittest") { testonly = true deps = [] deps += [ ":AssetLoaderTest", ":BackupRuleManagerTest", ":BindEventTest", ":CheckerManagerTest", ":CloudInfoTest", ":ConstantTest", ":CryptoTest", ":EventCenterTest", ":EventTest", ":FeatureTest", ":GeneralStoreTest", ":MetaDataManagerTest", ":SerializableTest", ":ServiceMetaDataTest", ":ServiceUtilsTest", ":StoreMetaDataLocalTest", ":StoreTest", ":SubscriptionTest", ] } ###############################################################################