1# Copyright (c) 2021 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/test.gni")
14import("//foundation/distributeddatamgr/relational_store/relational_store.gni")
15
16module_output_path = "relational_store/native_rdb"
17
18###############################################################################
19config("module_private_config") {
20  visibility = [ ":*" ]
21
22  include_dirs = [
23    "${relational_store_common_path}/include",
24    "${relational_store_native_path}/rdb/include",
25    "${relational_store_innerapi_path}/rdb/include",
26    "${relational_store_native_path}/dfx/include",
27    "${relational_store_native_path}/rdb/src",
28    "${relational_store_innerapi_path}/appdatafwk/include",
29    "${relational_store_native_path}/rdb_device_manager_adapter/include",
30    "${relational_store_base_path}/mock/include",
31    "//commonlibrary/c_utils/base/include",
32    "${common_tool_path}/",
33    "${kvstore_interface_path}",
34  ]
35
36  defines = [ "RELATIONAL_STORE" ]
37
38  if (relational_store_rdb_support_icu) {
39    include_dirs += [
40      "//third_party/icu/icu4c/source/i18n",
41      "//third_party/icu/icu4c/source/common",
42    ]
43  }
44}
45
46ohos_unittest("NativeRdbMultiThreadTest") {
47  module_out_path = module_output_path
48
49  sources = [
50    "unittest/common.cpp",
51    "unittest/multiThread/rdb_connection_test.cpp",
52  ]
53
54  configs = [ ":module_private_config" ]
55
56  external_deps = [
57    "ability_base:zuri",
58    "ability_runtime:dataobs_manager",
59    "c_utils:utils",
60    "hilog:libhilog",
61    "huks:libhukssdk",
62    "ipc:ipc_core",
63    "kv_store:distributeddb",
64  ]
65
66  deps = [
67    "${relational_store_innerapi_path}/rdb:native_rdb",
68    "//third_party/googletest:gtest_main",
69    "//third_party/icu/icu4c:shared_icui18n",
70    "//third_party/icu/icu4c:shared_icuuc",
71    "//third_party/sqlite:sqlite",
72  ]
73}
74
75ohos_unittest("NativeRdbTest") {
76  module_out_path = module_output_path
77
78  sources = [
79    "unittest/cache_result_set_test.cpp",
80    "unittest/common.cpp",
81    "unittest/rdb_attach_test.cpp",
82    "unittest/rdb_bigint_test.cpp",
83    "unittest/rdb_delete_test.cpp",
84    "unittest/rdb_distributed_test.cpp",
85    "unittest/rdb_double_write_test.cpp",
86    "unittest/rdb_encrypt_decrypt_test.cpp",
87    "unittest/rdb_execute_test.cpp",
88    "unittest/rdb_get_store_test.cpp",
89    "unittest/rdb_helper_test.cpp",
90    "unittest/rdb_insert_test.cpp",
91    "unittest/rdb_open_callback_test.cpp",
92    "unittest/rdb_predicates_join_b_test.cpp",
93    "unittest/rdb_predicates_join_test.cpp",
94    "unittest/rdb_predicates_test.cpp",
95    "unittest/rdb_read_only_test.cpp",
96    "unittest/rdb_security_manager_test.cpp",
97    "unittest/rdb_sql_utils_test.cpp",
98    "unittest/rdb_sqlite_shared_result_set_test.cpp",
99    "unittest/rdb_step_result_get_row_test.cpp",
100    "unittest/rdb_step_result_set_test.cpp",
101    "unittest/rdb_store_backup_restore_test.cpp",
102    "unittest/rdb_store_concurrent_test.cpp",
103    "unittest/rdb_store_config_test.cpp",
104    "unittest/rdb_store_impl_test.cpp",
105    "unittest/rdb_store_interface_test.cpp",
106    "unittest/rdb_store_rekey_test.cpp",
107    "unittest/rdb_store_subscribe_test.cpp",
108    "unittest/rdb_trans_db_test.cpp",
109    "unittest/rdb_transaction_test.cpp",
110    "unittest/rdb_update_test.cpp",
111    "unittest/rdb_upgrade_test.cpp",
112    "unittest/rdb_utils_test.cpp",
113    "unittest/rdb_value_bucket_test.cpp",
114    "unittest/rdb_wal_limit_test.cpp",
115    "unittest/sqlite_utils_test.cpp",
116    "unittest/transaction_test.cpp",
117    "unittest/value_object_test.cpp",
118  ]
119
120  sources += [
121    "${relational_store_native_path}/rdb/src/abs_shared_result_set.cpp",
122    "${relational_store_native_path}/rdb/src/rdb_manager_impl.cpp",
123    "${relational_store_native_path}/rdb/src/rdb_notifier_stub.cpp",
124    "${relational_store_native_path}/rdb/src/rdb_service_proxy.cpp",
125    "${relational_store_native_path}/rdb/src/rdb_types_util.cpp",
126    "${relational_store_native_path}/rdb/src/result_set_proxy.cpp",
127    "${relational_store_native_path}/rdb/src/share_block.cpp",
128    "${relational_store_native_path}/rdb/src/shared_block_serializer_info.cpp",
129    "../../../frameworks/native/rdb/mock/src/rdb_fault_hiview_reporter.cpp",
130    "../../../frameworks/native/rdb/src/base_transaction.cpp",
131    "../../../frameworks/native/rdb/src/connection.cpp",
132    "../../../frameworks/native/rdb/src/connection_pool.cpp",
133    "../../../frameworks/native/rdb/src/grd_api_manager.cpp",
134    "../../../frameworks/native/rdb/src/raw_data_parser.cpp",
135    "../../../frameworks/native/rdb/src/rd_connection.cpp",
136    "../../../frameworks/native/rdb/src/rd_statement.cpp",
137    "../../../frameworks/native/rdb/src/rd_utils.cpp",
138    "../../../frameworks/native/rdb/src/rdb_local_db_observer.cpp",
139    "../../../frameworks/native/rdb/src/rdb_security_manager.cpp",
140    "../../../frameworks/native/rdb/src/rdb_sql_statistic.cpp",
141    "../../../frameworks/native/rdb/src/sqlite_connection.cpp",
142    "../../../frameworks/native/rdb/src/sqlite_global_config.cpp",
143    "../../../frameworks/native/rdb/src/sqlite_shared_result_set.cpp",
144    "../../../frameworks/native/rdb/src/sqlite_sql_builder.cpp",
145    "../../../frameworks/native/rdb/src/sqlite_statement.cpp",
146    "../../../frameworks/native/rdb/src/sqlite_utils.cpp",
147    "../../../frameworks/native/rdb/src/step_result_set.cpp",
148    "../../../frameworks/native/rdb/src/string_utils.cpp",
149    "../../../frameworks/native/rdb/src/task_executor.cpp",
150    "../../../frameworks/native/rdb/src/trans_db.cpp",
151  ]
152
153  configs = [ ":module_private_config" ]
154
155  external_deps = [
156    "ability_base:zuri",
157    "ability_runtime:dataobs_manager",
158    "c_utils:utils",
159    "hilog:libhilog",
160    "huks:libhukssdk",
161    "ipc:ipc_core",
162    "kv_store:distributeddb",
163    "samgr:samgr_proxy",
164  ]
165
166  deps = [
167    "${relational_store_innerapi_path}/rdb:native_rdb",
168    "//third_party/googletest:gtest_main",
169    "//third_party/icu/icu4c:shared_icui18n",
170    "//third_party/icu/icu4c:shared_icuuc",
171    "//third_party/sqlite:sqlite",
172  ]
173}
174
175###############################################################################
176group("unittest") {
177  testonly = true
178
179  deps = [
180    ":NativeRdbMultiThreadTest",
181    ":NativeRdbTest",
182  ]
183}
184
185###############################################################################
186
187group("fuzztest") {
188  testonly = true
189  deps = []
190  deps += [
191    "fuzztest/rdbimpl_fuzzer:fuzztest",
192    "fuzztest/rdbstore_fuzzer:fuzztest",
193  ]
194}
195
196###############################################################################
197
198group("distributedtest") {
199  testonly = true
200  deps = []
201  deps += [ "distributedtest/rdb_store_impl_test:distributedtest" ]
202}
203###############################################################################
204