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. 13import("//build/ohos_var.gni") 14import("//build/test.gni") 15import("//foundation/distributeddatamgr/datamgr_service/datamgr_service.gni") 16 17module_output_path = "datamgr_service/datamgr_service/distributeddatafwk" 18 19############################################################################### 20config("module_private_config") { 21 visibility = [ ":*" ] 22 23 include_dirs = [ 24 "${device_manager_path}/interfaces/inner_kits/native_cpp/include", 25 "../include/", 26 "../../service/bootstrap/include/", 27 "../../service/common/", 28 "../../service/rdb/", 29 "../../../../../relational_store/interfaces/inner_api/rdb/include", 30 "../../../../../relational_store/interfaces/inner_api/common_type/include", 31 "${kv_store_distributeddb_path}/interfaces/include", 32 "${kv_store_distributeddb_path}/include", 33 "${kv_store_path}/frameworks/innerkitsimpl/distributeddatasvc/include", 34 "${kv_store_path}/frameworks/innerkitsimpl/distributeddatafwk/include", 35 "${kv_store_common_path}", 36 "${kv_store_path}/frameworks/innerkitsimpl/distributeddatafwk/src", 37 "${kv_store_path}/frameworks/innerkitsimpl/kvdb/include", 38 "${kv_store_path}/interfaces/innerkits/distributeddata/include", 39 "${data_service_path}/adapter/include", 40 "${data_service_path}/framework/include", 41 "${data_service_path}/service/config/include", 42 "${data_service_path}/app/src", 43 "${data_service_path}/adapter/include/account", 44 "${data_service_path}/app/src/security", 45 "${data_service_path}/service/crypto/include", 46 "${data_service_path}/service/matrix/include", 47 "//third_party/json/single_include", 48 ] 49 cflags = [ "-Werror" ] 50 ldflags = [ "-Wl,--whole-archive" ] 51 defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ] 52} 53 54ohos_unittest("CheckerManagerTest") { 55 module_out_path = module_output_path 56 sources = [ "checker_manager_test.cpp" ] 57 58 configs = [ ":module_private_config" ] 59 60 external_deps = [ 61 "access_token:libaccesstoken_sdk", 62 "access_token:libnativetoken", 63 "c_utils:utils", 64 "hilog:libhilog", 65 "ipc:ipc_core", 66 ] 67 68 deps = [ 69 "${data_service_path}/app/src/checker:distributeddata_checker", 70 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/framework:distributeddatasvcfwk", 71 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service:distributeddatasvc", 72 "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner", 73 "//third_party/googletest:gtest_main", 74 "//third_party/openssl:libcrypto_shared", 75 ] 76} 77 78ohos_unittest("EventCenterTest") { 79 module_out_path = module_output_path 80 sources = [ "event_center_test.cpp" ] 81 82 configs = [ ":module_private_config" ] 83 84 external_deps = [ 85 "c_utils:utils", 86 "hilog:libhilog", 87 "ipc:ipc_core", 88 ] 89 90 deps = [ 91 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/framework:distributeddatasvcfwk", 92 "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner", 93 "//third_party/googletest:gtest_main", 94 ] 95} 96 97ohos_unittest("SerializableTest") { 98 module_out_path = module_output_path 99 100 sources = [ "serializable_test.cpp" ] 101 102 configs = [ ":module_private_config" ] 103 104 external_deps = [ 105 "ability_base:base", 106 "ability_base:want", 107 "c_utils:utils", 108 "hilog:libhilog", 109 "ipc:ipc_core", 110 ] 111 112 deps = [ 113 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/framework:distributeddatasvcfwk", 114 "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner", 115 "//third_party/googletest:gtest_main", 116 "//third_party/openssl:libcrypto_shared", 117 ] 118} 119 120ohos_unittest("ServiceUtilsTest") { 121 module_out_path = module_output_path 122 123 sources = [ "utils_test.cpp" ] 124 125 configs = [ ":module_private_config" ] 126 127 cflags = [ 128 "-Dprivate=public", 129 "-Dprotected=public", 130 ] 131 132 external_deps = [ 133 "access_token:libaccesstoken_sdk", 134 "access_token:libnativetoken", 135 "c_utils:utils", 136 "hilog:libhilog", 137 "ipc:ipc_core", 138 ] 139 140 deps = [ 141 "${data_service_path}/framework:distributeddatasvcfwk", 142 "//third_party/googletest:gtest_main", 143 ] 144} 145 146ohos_unittest("StoreTest") { 147 module_out_path = module_output_path 148 149 include_dirs = [ 150 "${data_service_path}/service/test/mock", 151 "${data_service_path}/framework/include/screen", 152 ] 153 154 sources = [ 155 "${data_service_path}/framework/metadata/store_meta_data.cpp", 156 "${data_service_path}/framework/store/auto_cache.cpp", 157 "${data_service_path}/service/rdb/rdb_query.cpp", 158 "store_test.cpp", 159 ] 160 161 configs = [ ":module_private_config" ] 162 163 cflags = [ 164 "-Dprivate=public", 165 "-Dprotected=public", 166 ] 167 168 external_deps = [ 169 "access_token:libaccesstoken_sdk", 170 "access_token:libnativetoken", 171 "c_utils:utils", 172 "common_event_service:cesfwk_innerkits", 173 "hilog:libhilog", 174 "ipc:ipc_core", 175 "kv_store:distributeddata_inner", 176 "kv_store:distributeddb", 177 "relational_store:native_rdb", 178 ] 179 180 deps = [ 181 "${data_service_path}/adapter/account:distributeddata_account", 182 "${data_service_path}/framework:distributeddatasvcfwk", 183 "${data_service_path}/service:distributeddatasvc", 184 "${data_service_path}/service/common:distributeddata_common", 185 "${data_service_path}/service/test/mock:distributeddata_mock_static", 186 "//third_party/googletest:gtest_main", 187 ] 188} 189 190ohos_unittest("AssetLoaderTest") { 191 module_out_path = module_output_path 192 sources = [ "asset_loader_test.cpp" ] 193 configs = [ ":module_private_config" ] 194 deps = [ "${data_service_path}/framework:distributeddatasvcfwk" ] 195} 196 197ohos_unittest("BackupRuleManagerTest") { 198 module_out_path = module_output_path 199 sources = [ "backup_rule_manager_test.cpp" ] 200 configs = [ ":module_private_config" ] 201 deps = [ "${data_service_path}/framework:distributeddatasvcfwk" ] 202} 203 204ohos_unittest("BindEventTest") { 205 module_out_path = module_output_path 206 sources = [ "bind_event_test.cpp" ] 207 configs = [ ":module_private_config" ] 208 deps = [ "${data_service_path}/framework:distributeddatasvcfwk" ] 209} 210 211ohos_unittest("CloudInfoTest") { 212 module_out_path = module_output_path 213 sources = [ "cloud_test.cpp" ] 214 configs = [ ":module_private_config" ] 215 deps = [ "${data_service_path}/framework:distributeddatasvcfwk" ] 216} 217 218ohos_unittest("EventTest") { 219 module_out_path = module_output_path 220 sources = [ "event_test.cpp" ] 221 configs = [ ":module_private_config" ] 222 deps = [ "${data_service_path}/framework:distributeddatasvcfwk" ] 223} 224 225ohos_unittest("GeneralStoreTest") { 226 module_out_path = module_output_path 227 sources = [ "general_store_test.cpp" ] 228 configs = [ ":module_private_config" ] 229 deps = [ "${data_service_path}/framework:distributeddatasvcfwk" ] 230} 231 232ohos_unittest("SubscriptionTest") { 233 module_out_path = module_output_path 234 sources = [ "subscription_test.cpp" ] 235 configs = [ ":module_private_config" ] 236 deps = [ "${data_service_path}/framework:distributeddatasvcfwk" ] 237} 238 239ohos_unittest("FeatureTest") { 240 module_out_path = module_output_path 241 sources = [ "feature_test.cpp" ] 242 configs = [ ":module_private_config" ] 243 deps = [ 244 "${data_service_path}/framework:distributeddatasvcfwk", 245 "${kv_store_path}/interfaces/innerkits/distributeddata:distributeddata_inner", 246 ] 247} 248 249ohos_unittest("MetaDataManagerTest") { 250 module_out_path = module_output_path 251 252 sources = [ "meta_data_manager_test.cpp" ] 253 254 configs = [ ":module_private_config" ] 255 256 external_deps = [ 257 "c_utils:utils", 258 "hilog:libhilog", 259 "ipc:ipc_core", 260 ] 261 262 deps = [ 263 "${data_service_path}/framework:distributeddatasvcfwk", 264 "${data_service_path}/service:distributeddatasvc", 265 "//third_party/googletest:gtest_main", 266 ] 267} 268 269ohos_unittest("StoreMetaDataLocalTest") { 270 module_out_path = module_output_path 271 sources = [ "store_meta_data_local_test.cpp" ] 272 configs = [ ":module_private_config" ] 273 deps = [ "${data_service_path}/framework:distributeddatasvcfwk" ] 274} 275 276ohos_unittest("ConstantTest") { 277 module_out_path = module_output_path 278 sources = [ "constant_test.cpp" ] 279 configs = [ ":module_private_config" ] 280 deps = [ "${data_service_path}/framework:distributeddatasvcfwk" ] 281} 282 283ohos_unittest("CryptoTest") { 284 module_out_path = module_output_path 285 sources = [ "crypto_test.cpp" ] 286 configs = [ ":module_private_config" ] 287 deps = [ "${data_service_path}/framework:distributeddatasvcfwk" ] 288} 289 290ohos_unittest("ServiceMetaDataTest") { 291 module_out_path = module_output_path 292 293 sources = [ 294 "${data_service_path}/app/src/kvstore_meta_manager.cpp", 295 "meta_data_test.cpp", 296 ] 297 298 sanitize = { 299 cfi = true 300 cfi_cross_dso = true 301 debug = false 302 } 303 304 configs = [ ":module_private_config" ] 305 306 include_dirs = [ 307 "${device_manager_path}/interfaces/inner_kits/native_cpp/include", 308 "../include/", 309 "../../service/bootstrap/include/", 310 "../../service/common/", 311 "../../service/rdb/", 312 "../../../../../relational_store/interfaces/inner_api/rdb/include", 313 "../../../../../relational_store/interfaces/inner_api/common_type/include", 314 "${kv_store_distributeddb_path}/interfaces/include", 315 "${kv_store_distributeddb_path}/include", 316 "${kv_store_path}/frameworks/innerkitsimpl/distributeddatasvc/include", 317 "${kv_store_path}/frameworks/innerkitsimpl/distributeddatafwk/include", 318 "${kv_store_common_path}", 319 "${kv_store_path}/frameworks/innerkitsimpl/distributeddatafwk/src", 320 "${kv_store_path}/frameworks/innerkitsimpl/kvdb/include", 321 "${kv_store_path}/interfaces/innerkits/distributeddata/include", 322 "${data_service_path}/adapter/include", 323 "${data_service_path}/framework/include", 324 "${data_service_path}/service/config/include", 325 "${data_service_path}/app/src", 326 "${data_service_path}/adapter/include/account", 327 "${data_service_path}/app/src/security", 328 "${data_service_path}/service/crypto/include", 329 "${data_service_path}/service/matrix/include", 330 "${data_service_path}/service/kvdb", 331 "//third_party/json/single_include", 332 "${data_service_path}/adapter/include/communicator", 333 ] 334 335 external_deps = [ 336 "c_utils:utils", 337 "dataclassification:data_transit_mgr", 338 "device_auth:deviceauth_sdk", 339 "hilog:libhilog", 340 "hisysevent:libhisysevent", 341 "hitrace:hitrace_meter", 342 "hitrace:libhitracechain", 343 "ipc:ipc_core", 344 "kv_store:distributeddata_inner", 345 "kv_store:distributeddata_mgr", 346 "kv_store:distributeddb", 347 "safwk:system_ability_fwk", 348 "samgr:samgr_proxy", 349 ] 350 351 deps = [ 352 "${data_service_path}/adapter/account:distributeddata_account", 353 "${data_service_path}/adapter/communicator:distributeddata_communicator", 354 "${data_service_path}/adapter/utils:distributeddata_utils", 355 "${data_service_path}/app/src/checker:distributeddata_checker", 356 "${data_service_path}/framework:distributeddatasvcfwk", 357 "${data_service_path}/service/kvdb:distributeddata_kvdb", 358 "${kv_store_distributeddb_path}:distributeddb", 359 "${kv_store_path}/interfaces/innerkits/distributeddata:distributeddata_inner", 360 "${kv_store_path}/interfaces/innerkits/distributeddatamgr:distributeddata_mgr", 361 "//third_party/googletest:gtest_main", 362 "//third_party/openssl:libcrypto_shared", 363 ] 364} 365 366############################################################################### 367group("unittest") { 368 testonly = true 369 370 deps = [] 371 372 deps += [ 373 ":AssetLoaderTest", 374 ":BackupRuleManagerTest", 375 ":BindEventTest", 376 ":CheckerManagerTest", 377 ":CloudInfoTest", 378 ":ConstantTest", 379 ":CryptoTest", 380 ":EventCenterTest", 381 ":EventTest", 382 ":FeatureTest", 383 ":GeneralStoreTest", 384 ":MetaDataManagerTest", 385 ":SerializableTest", 386 ":ServiceMetaDataTest", 387 ":ServiceUtilsTest", 388 ":StoreMetaDataLocalTest", 389 ":StoreTest", 390 ":SubscriptionTest", 391 ] 392} 393############################################################################### 394