1# Copyright (C) 2023-2024 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/filemanagement/dfs_service/distributedfile.gni")
15
16ohos_unittest("cloud_pref_impl_test") {
17  module_out_path = "filemanagement/dfs_service"
18
19  sources = [
20    "../../../../../distributeddatamgr/preferences/frameworks/native/src/preferences_value.cpp",
21    "../../../utils/preference/src/cloud_pref_impl.cpp",
22    "../../mock/preference_helper_mock.cpp",
23    "./preference/cloud_pref_impl_test.cpp",
24  ]
25
26  include_dirs = [
27    "${services_path}/cloudsyncservice/include/ipc",
28    "${distributedfile_path}/test/unittests/cloudsync_api/cloudsync_impl/include",
29    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include",
30    "${distributedfile_path}/utils/dentry/include",
31    "${distributedfile_path}/utils/log/include",
32    "${distributedfile_path}/utils/preference/include",
33    "../../../../../distributeddatamgr/preferences/interfaces/inner_api/include",
34    "../../../../../distributeddatamgr/preferences/frameworks/native/include",
35  ]
36
37  deps = [
38    "${utils_path}:libdistributedfileutils",
39    "//third_party/googletest:gmock_main",
40    "//third_party/googletest:gtest_main",
41  ]
42
43  external_deps = [
44    "c_utils:utils",
45    "dfs_service:cloudsync_kit_inner",
46    "hilog:libhilog",
47    "ipc:ipc_single",
48  ]
49
50  defines = [ "private=public" ]
51
52  defines += [
53    "LOG_DOMAIN=0xD004307",
54    "LOG_TAG=\"UTILS\"",
55  ]
56
57  use_exceptions = true
58}
59
60ohos_unittest("utils_directory_test") {
61  branch_protector_ret = "pac_ret"
62  sanitize = {
63    integer_overflow = true
64    cfi = true
65    cfi_cross_dso = true
66    debug = false
67    blocklist = "${distributedfile_path}/cfi_blocklist.txt"
68  }
69
70  module_out_path = "filemanagement/dfs_service"
71
72  sources = [ "./system/utils_directory_test.cpp" ]
73
74  include_dirs = [
75    "${utils_path}/system/include",
76    "${utils_path}/log/include",
77    "//foundation/multimedia/image_framework/mock/native/include/log/",
78  ]
79
80  deps = [
81    "${utils_path}:libdistributedfileutils",
82    "//third_party/googletest:gmock_main",
83    "//third_party/googletest:gtest_main",
84  ]
85
86  external_deps = [
87    "c_utils:utils",
88    "hilog:libhilog",
89    "json:nlohmann_json_static",
90  ]
91
92  defines = [ "private=public" ]
93  defines += [
94    "LOG_DOMAIN=0xD004307",
95    "LOG_TAG=\"CLOUDSYNC_SA\"",
96  ]
97  use_exceptions = true
98}
99
100ohos_unittest("cloud_file_utils_test") {
101  module_out_path = "filemanagement/dfs_service"
102
103  sources = [ "./cloud_disk/cloud_file_utils_test.cpp" ]
104
105  include_dirs = [
106    "${utils_path}/cloud_disk/include",
107    "${utils_path}/log/include",
108    "//foundation/multimedia/image_framework/mock/native/include/log/",
109  ]
110
111  deps = [
112    "${utils_path}:libdistributedfiledentry",
113    "${utils_path}:libdistributedfileutils",
114    "//third_party/googletest:gmock_main",
115    "//third_party/googletest:gtest_main",
116  ]
117
118  external_deps = [
119    "c_utils:utils",
120    "hilog:libhilog",
121  ]
122
123  defines = [ "private=public" ]
124  defines += [
125    "LOG_DOMAIN=0xD004307",
126    "LOG_TAG=\"CLOUDSYNC_SA\"",
127  ]
128  use_exceptions = true
129}
130
131ohos_unittest("plugin_loader_test") {
132  module_out_path = "filemanagement/dfs_service"
133
134  sources = [ "./load/plugin_loader_test.cpp" ]
135
136  include_dirs = [
137    "${utils_path}/load/include",
138    "${utils_path}/load/src",
139  ]
140
141  deps = [
142    "${utils_path}:libdistributedfileutils",
143    "${utils_path}:libdistributedfileutils_lite",
144    "//third_party/googletest:gmock_main",
145    "//third_party/googletest:gtest_main",
146  ]
147
148  external_deps = [
149    "c_utils:utils",
150    "hilog:libhilog",
151  ]
152
153  defines = [ "private=public" ]
154  defines += [
155    "LOG_DOMAIN=0xD004307",
156    "LOG_TAG=\"UTILS\"",
157  ]
158
159  use_exceptions = true
160}
161
162group("utils_test") {
163  testonly = true
164
165  deps = [
166    ":cloud_file_utils_test",
167    ":cloud_pref_impl_test",
168    ":plugin_loader_test",
169    ":utils_directory_test",
170  ]
171}
172