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.
13
14import("//build/test.gni")
15import("//foundation/filemanagement/dfs_service/distributedfile.gni")
16
17ohos_unittest("fuse_manager_test") {
18  module_out_path = "filemanagement/dfs_service"
19
20  sources = [
21    "${distributedfile_path}/services/cloudfiledaemon/src/fuse_manager/cloud_daemon_statistic.cpp",
22    "${distributedfile_path}/services/cloudfiledaemon/src/fuse_manager/fuse_manager.cpp",
23    "fuse_manager_test.cpp",
24  ]
25
26  cloud_disk = [
27    "${services_path}/cloudfiledaemon/src/cloud_disk/database_manager.cpp",
28    "${services_path}/cloudfiledaemon/src/cloud_disk/file_operations_base.cpp",
29    "${services_path}/cloudfiledaemon/src/cloud_disk/file_operations_cloud.cpp",
30    "${services_path}/cloudfiledaemon/src/cloud_disk/file_operations_local.cpp",
31    "${services_path}/cloudfiledaemon/src/cloud_disk/fuse_operations.cpp",
32  ]
33
34  sources += cloud_disk
35
36  include_dirs = [
37    "../../../../../communication/ipc/interfaces/innerkits/ipc_core/include",
38    "${distributedfile_path}/services/cloudfiledaemon/include",
39    "${distributedfile_path}/services/cloudfiledaemon/include/fuse_manager",
40    "${services_path}/cloudfiledaemon/include/cloud_disk/",
41    "${distributedfile_path}/adapter/cloud_adapter_example/include",
42    "${clouddisk_database_path}/include",
43    "${media_library_path}/frameworks/innerkitsimpl/media_library_helper/include",
44    "${media_library_path}/interfaces/inner_api/media_library_helper/include",
45    "${media_library_path}/frameworks/utils/include",
46  ]
47
48  deps = [
49    "${clouddisk_database_path}:clouddisk_database",
50    "${innerkits_native_path}/cloud_daemon_kit_inner:cloud_daemon_kit_inner",
51    "${innerkits_native_path}/cloud_file_kit_inner:cloudfile_kit",
52    "${utils_path}:libdistributedfiledentry",
53    "${utils_path}:libdistributedfileutils",
54    "//third_party/googletest:gmock_main",
55    "//third_party/googletest:gtest_main",
56  ]
57
58  external_deps = [
59    "ability_base:zuri",
60    "ability_runtime:dataobs_manager",
61    "c_utils:utils",
62    "ffrt:libffrt",
63    "hilog:libhilog",
64    "hisysevent:libhisysevent",
65    "hitrace:hitrace_meter",
66    "init:libbegetutil",
67    "ipc:ipc_single",
68    "libfuse:libfuse",
69    "relational_store:native_rdb",
70  ]
71
72  defines = [
73    "private=public",
74    "LOG_DOMAIN=0xD004308",
75    "LOG_TAG=\"CloudFileDaemon\"",
76  ]
77
78  if (cloudsync_service_hicollie_enable) {
79    external_deps += [ "hicollie:libhicollie" ]
80    defines += [ "HICOLLIE_ENABLE" ]
81  }
82
83  use_exceptions = true
84  part_name = "dfs_service"
85  subsystem_name = "filemanagement"
86}
87
88ohos_unittest("cloud_daemon_statistic_test") {
89  module_out_path = "filemanagement/dfs_service"
90
91  sources = [
92    "${distributedfile_path}/services/cloudfiledaemon/src/fuse_manager/cloud_daemon_statistic.cpp",
93    "cloud_daemon_statistic_test.cpp",
94  ]
95
96  cloud_disk = [
97    "${services_path}/cloudfiledaemon/src/cloud_disk/database_manager.cpp",
98    "${services_path}/cloudfiledaemon/src/cloud_disk/file_operations_base.cpp",
99    "${services_path}/cloudfiledaemon/src/cloud_disk/file_operations_cloud.cpp",
100    "${services_path}/cloudfiledaemon/src/cloud_disk/file_operations_local.cpp",
101    "${services_path}/cloudfiledaemon/src/cloud_disk/fuse_operations.cpp",
102  ]
103
104  sources += cloud_disk
105
106  include_dirs = [
107    "../../../../../communication/ipc/interfaces/innerkits/ipc_core/include",
108    "${distributedfile_path}/services/cloudfiledaemon/include",
109    "${distributedfile_path}/services/cloudfiledaemon/include/fuse_manager",
110    "${services_path}/cloudfiledaemon/include/cloud_disk/",
111    "${distributedfile_path}/adapter/cloud_adapter_example/include",
112    "${clouddisk_database_path}/include",
113    "${media_library_path}/frameworks/innerkitsimpl/media_library_helper/include",
114    "${media_library_path}/interfaces/inner_api/media_library_helper/include",
115    "${media_library_path}/frameworks/utils/include",
116  ]
117
118  deps = [
119    "${clouddisk_database_path}:clouddisk_database",
120    "${innerkits_native_path}/cloud_daemon_kit_inner:cloud_daemon_kit_inner",
121    "${innerkits_native_path}/cloud_file_kit_inner:cloudfile_kit",
122    "${utils_path}:libdistributedfiledentry",
123    "${utils_path}:libdistributedfileutils",
124    "//third_party/googletest:gmock_main",
125    "//third_party/googletest:gtest_main",
126  ]
127
128  external_deps = [
129    "ability_base:zuri",
130    "ability_runtime:dataobs_manager",
131    "ffrt:libffrt",
132    "hilog:libhilog",
133    "hitrace:hitrace_meter",
134    "init:libbegetutil",
135    "ipc:ipc_single",
136    "libfuse:libfuse",
137    "relational_store:native_rdb",
138  ]
139
140  defines = [
141    "private=public",
142    "LOG_DOMAIN=0xD004308",
143    "LOG_TAG=\"CloudFileDaemon\"",
144  ]
145
146  use_exceptions = true
147  part_name = "dfs_service"
148  subsystem_name = "filemanagement"
149}
150
151ohos_unittest("cloud_daemon_test") {
152  module_out_path = "filemanagement/dfs_service"
153
154  sources = [
155    "${distributedfile_path}/services/cloudfiledaemon/src/fuse_manager/cloud_daemon_statistic.cpp",
156    "${distributedfile_path}/services/cloudfiledaemon/src/fuse_manager/fuse_manager.cpp",
157    "${distributedfile_path}/services/cloudfiledaemon/src/ipc/cloud_daemon.cpp",
158    "${distributedfile_path}/services/cloudfiledaemon/src/ipc/cloud_daemon_stub.cpp",
159    "cloud_daemon_test.cpp",
160  ]
161
162  cloud_disk = [
163    "${services_path}/cloudfiledaemon/src/cloud_disk/database_manager.cpp",
164    "${services_path}/cloudfiledaemon/src/cloud_disk/file_operations_base.cpp",
165    "${services_path}/cloudfiledaemon/src/cloud_disk/file_operations_cloud.cpp",
166    "${services_path}/cloudfiledaemon/src/cloud_disk/file_operations_local.cpp",
167    "${services_path}/cloudfiledaemon/src/cloud_disk/fuse_operations.cpp",
168  ]
169
170  sources += cloud_disk
171
172  include_dirs = [
173    "../../../../../communication/ipc/interfaces/innerkits/ipc_core/include",
174    "${distributedfile_path}/services/cloudfiledaemon/include",
175    "${services_path}/cloudfiledaemon/include/cloud_disk/",
176    "${distributedfile_path}/adapter/cloud_adapter_example/include",
177    "${clouddisk_database_path}/include",
178    "${media_library_path}/frameworks/innerkitsimpl/media_library_helper/include",
179    "${media_library_path}/interfaces/inner_api/media_library_helper/include",
180    "${media_library_path}/frameworks/utils/include",
181  ]
182
183  deps = [
184    "${clouddisk_database_path}:clouddisk_database",
185    "${innerkits_native_path}/cloud_daemon_kit_inner:cloud_daemon_kit_inner",
186    "${utils_path}:libdistributedfiledentry",
187    "${utils_path}:libdistributedfileutils",
188    "//third_party/googletest:gmock_main",
189    "//third_party/googletest:gtest_main",
190  ]
191
192  external_deps = [
193    "ability_base:zuri",
194    "ability_runtime:dataobs_manager",
195    "c_utils:utils",
196    "ffrt:libffrt",
197    "hilog:libhilog",
198    "hitrace:hitrace_meter",
199    "ipc:ipc_single",
200    "libfuse:libfuse",
201    "relational_store:native_rdb",
202    "safwk:system_ability_fwk",
203    "samgr:samgr_proxy",
204  ]
205
206  defines = [
207    "private=public",
208    "LOG_DOMAIN=0xD004308",
209    "LOG_TAG=\"CloudFileDaemon\"",
210  ]
211
212  if (cloudsync_service_hicollie_enable) {
213    external_deps += [ "hicollie:libhicollie" ]
214    defines += [ "HICOLLIE_ENABLE" ]
215  }
216
217  use_exceptions = true
218  part_name = "dfs_service"
219  subsystem_name = "filemanagement"
220}
221
222ohos_unittest("cloud_daemon_stub_test") {
223  module_out_path = "filemanagement/dfs_service"
224
225  sources = [
226    "${distributedfile_path}/services/cloudfiledaemon/src/ipc/cloud_daemon_stub.cpp",
227    "cloud_daemon_stub_test.cpp",
228  ]
229
230  include_dirs = [
231    "${distributedfile_path}/services/cloudfiledaemon/include",
232    "${services_path}/cloudsyncservice/include/data_sync/",
233    "${distributedfile_path}/adapter/cloud_adapter_example/include",
234  ]
235
236  deps = [
237    "${innerkits_native_path}/cloud_daemon_kit_inner:cloud_daemon_kit_inner",
238    "${utils_path}:libdistributedfiledentry",
239    "${utils_path}:libdistributedfileutils",
240    "//third_party/googletest:gmock_main",
241    "//third_party/googletest:gtest_main",
242  ]
243
244  external_deps = [
245    "c_utils:utils",
246    "hilog:libhilog",
247    "ipc:ipc_single",
248    "libfuse:libfuse",
249    "safwk:system_ability_fwk",
250    "samgr:samgr_proxy",
251  ]
252
253  defines = [
254    "private=public",
255    "LOG_DOMAIN=0xD004308",
256    "LOG_TAG=\"CloudFileDaemon\"",
257  ]
258
259  use_exceptions = true
260  part_name = "dfs_service"
261  subsystem_name = "filemanagement"
262}
263
264group("services_daemon_test") {
265  testonly = true
266
267  deps = [
268    ":cloud_daemon_statistic_test",
269    ":cloud_daemon_stub_test",
270    ":fuse_manager_test",
271  ]
272}
273