• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2024-2025 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("distributed_file_daemon_test") {
18  branch_protector_ret = "pac_ret"
19  sanitize = {
20    integer_overflow = true
21    cfi = true
22    cfi_cross_dso = true
23    debug = false
24  }
25
26  module_out_path = "dfs_service/dfs_service_daemon"
27
28  sources = [ "daemon_test.cpp" ]
29
30  include_dirs = [
31    "${distributedfile_path}/frameworks/native/distributed_file_inner/include",
32    "${distributedfile_path}/test/unittests/distributed_file_daemon/include",
33    "${services_path}/distributedfiledaemon/include",
34    "${services_path}/distributedfiledaemon/include/ipc",
35  ]
36
37  deps = [
38    "${services_path}/distributedfiledaemon:distributed_file_daemon_kit_inner",
39    "${services_path}/distributedfiledaemon:libdistributedfiledaemon",
40    "${utils_path}:libdistributedfileutils",
41  ]
42
43  external_deps = [
44    "ability_base:want",
45    "ability_base:zuri",
46    "access_token:libaccesstoken_sdk",
47    "app_file_service:remote_file_share_native",
48    "app_file_service:sandbox_helper_native",
49    "c_utils:utils",
50    "common_event_service:cesfwk_innerkits",
51    "dataclassification:data_transit_mgr",
52    "device_auth:deviceauth_sdk",
53    "device_manager:devicemanagersdk",
54    "dsoftbus:softbus_client",
55    "eventhandler:libeventhandler",
56    "file_api:securitylabel",
57    "googletest:gmock_main",
58    "googletest:gtest_main",
59    "hilog:libhilog",
60    "hisysevent:libhisysevent",
61    "init:libbegetutil",
62    "ipc:ipc_core",
63    "libfuse:libfuse",
64    "os_account:os_account_innerkits",
65    "safwk:system_ability_fwk",
66    "samgr:samgr_proxy",
67    "storage_service:storage_manager_sa_proxy",
68    "zlib:shared_libz",
69  ]
70
71  defines = [
72    "private=public",
73    "LOG_TAG=\"distributedfile_daemon\"",
74  ]
75
76  use_exceptions = true
77  part_name = "dfs_service"
78  subsystem_name = "filemanagement"
79}
80
81ohos_unittest("distributed_file_daemon_stub_test") {
82  branch_protector_ret = "pac_ret"
83  sanitize = {
84    integer_overflow = true
85    cfi = true
86    cfi_cross_dso = true
87    debug = false
88    blocklist = "${distributedfile_path}/cfi_blocklist.txt"
89  }
90
91  module_out_path = "dfs_service/dfs_service_daemon"
92
93  sources = [ "daemon_stub_test.cpp" ]
94
95  include_dirs = [
96    "${distributedfile_path}/frameworks/native/distributed_file_inner/include",
97    "${distributedfile_path}/test/unittests/distributed_file_daemon/include",
98    "${services_path}/distributedfiledaemon/include",
99    "${services_path}/distributedfiledaemon/include/ipc",
100  ]
101
102  deps = [
103    "${services_path}/distributedfiledaemon:distributed_file_daemon_kit_inner",
104    "${services_path}/distributedfiledaemon:libdistributedfiledaemon",
105    "${utils_path}:libdistributedfileutils",
106  ]
107
108  external_deps = [
109    "ability_base:want",
110    "ability_base:zuri",
111    "access_token:libaccesstoken_sdk",
112    "app_file_service:remote_file_share_native",
113    "app_file_service:sandbox_helper_native",
114    "c_utils:utils",
115    "common_event_service:cesfwk_innerkits",
116    "dataclassification:data_transit_mgr",
117    "device_auth:deviceauth_sdk",
118    "device_manager:devicemanagersdk",
119    "dsoftbus:softbus_client",
120    "eventhandler:libeventhandler",
121    "file_api:securitylabel",
122    "googletest:gmock_main",
123    "googletest:gtest_main",
124    "hilog:libhilog",
125    "hisysevent:libhisysevent",
126    "init:libbegetutil",
127    "ipc:ipc_core",
128    "libfuse:libfuse",
129    "os_account:os_account_innerkits",
130    "safwk:system_ability_fwk",
131    "samgr:samgr_proxy",
132    "storage_service:storage_manager_sa_proxy",
133    "zlib:shared_libz",
134  ]
135
136  defines = [
137    "private=public",
138    "LOG_TAG=\"distributedfile_daemon\"",
139  ]
140
141  use_exceptions = true
142  part_name = "dfs_service"
143  subsystem_name = "filemanagement"
144}
145
146ohos_unittest("distributed_file_daemon_stub_sup_test") {
147  branch_protector_ret = "pac_ret"
148  sanitize = {
149    integer_overflow = true
150    cfi = true
151    cfi_cross_dso = true
152    debug = false
153    blocklist = "${distributedfile_path}/cfi_blocklist.txt"
154  }
155
156  module_out_path = "dfs_service/dfs_service_daemon"
157
158  sources = [
159    "${distributedfile_path}/test/mock/message_parcel_mock.cpp",
160    "daemon_stub_sup_test.cpp",
161  ]
162
163  include_dirs = [
164    "include",
165    "${distributedfile_path}/frameworks/native/distributed_file_inner/include",
166    "${distributedfile_path}/frameworks/native/distributed_file_inner/include/asset",
167    "${distributedfile_path}/services/distributedfiledaemon/test/mock/include",
168    "${distributedfile_path}/test/unittests/distributed_file_daemon/include",
169    "${distributedfile_path}/test/mock",
170    "${services_path}/distributedfiledaemon/include",
171    "${services_path}/distributedfiledaemon/include/ipc",
172    "${services_path}/distributedfiledaemon/test/mock/include",
173  ]
174
175  deps = [
176    "${services_path}/distributedfiledaemon:distributed_file_daemon_kit_inner",
177    "${services_path}/distributedfiledaemon:libdistributedfiledaemon",
178    "${utils_path}:libdistributedfileutils",
179  ]
180
181  external_deps = [
182    "ability_base:want",
183    "ability_base:zuri",
184    "access_token:libaccesstoken_sdk",
185    "app_file_service:remote_file_share_native",
186    "app_file_service:sandbox_helper_native",
187    "c_utils:utils",
188    "common_event_service:cesfwk_innerkits",
189    "dataclassification:data_transit_mgr",
190    "device_auth:deviceauth_sdk",
191    "device_manager:devicemanagersdk",
192    "dsoftbus:softbus_client",
193    "eventhandler:libeventhandler",
194    "file_api:securitylabel",
195    "googletest:gmock_main",
196    "googletest:gtest_main",
197    "hilog:libhilog",
198    "hisysevent:libhisysevent",
199    "init:libbegetutil",
200    "ipc:ipc_core",
201    "libfuse:libfuse",
202    "os_account:os_account_innerkits",
203    "safwk:system_ability_fwk",
204    "samgr:samgr_proxy",
205    "storage_service:storage_manager_sa_proxy",
206    "zlib:shared_libz",
207  ]
208
209  defines = [
210    "private=public",
211    "LOG_TAG=\"distributedfile_daemon\"",
212  ]
213
214  use_exceptions = true
215  part_name = "dfs_service"
216  subsystem_name = "filemanagement"
217}
218
219ohos_unittest("daemon_manager_impl_test") {
220  branch_protector_ret = "pac_ret"
221  sanitize = {
222    integer_overflow = true
223    cfi = true
224    cfi_cross_dso = true
225    debug = false
226    blocklist = "${distributedfile_path}/cfi_blocklist.txt"
227  }
228
229  module_out_path = "dfs_service/dfs_service_daemon"
230
231  sources = [
232    "${distributedfile_path}/utils/log/src/utils_log.cpp",
233    "daemon_manager_impl_test.cpp",
234  ]
235
236  include_dirs = [
237    "${distributedfile_path}/frameworks/native/distributed_file_inner/include",
238    "${distributedfile_path}/frameworks/native/distributed_file_inner/include/asset",
239    "${distributedfile_path}/services/distributedfiledaemon/test/mock/include",
240    "${distributedfile_path}/test/unittests/distributed_file_daemon/include",
241    "${services_path}/distributedfiledaemon/include",
242  ]
243
244  deps = [
245    "${services_path}/distributedfiledaemon:distributed_file_daemon_kit_inner",
246    "${utils_path}:libdistributedfileutils",
247  ]
248
249  external_deps = [
250    "app_file_service:remote_file_share_native",
251    "c_utils:utils",
252    "device_manager:devicemanagersdk",
253    "googletest:gmock_main",
254    "googletest:gtest_main",
255    "hilog:libhilog",
256    "ipc:ipc_single",
257    "libfuse:libfuse",
258  ]
259
260  defines = [
261    "private=public",
262    "LOG_TAG=\"distributedfile_daemon\"",
263  ]
264
265  use_exceptions = true
266  part_name = "dfs_service"
267  subsystem_name = "filemanagement"
268}
269
270ohos_unittest("daemon_manager_test") {
271  branch_protector_ret = "pac_ret"
272  sanitize = {
273    integer_overflow = true
274    cfi = true
275    cfi_cross_dso = true
276    debug = false
277  }
278
279  module_out_path = "dfs_service/dfs_service_daemon"
280
281  sources = [
282    "${distributedfile_path}/utils/log/src/utils_log.cpp",
283    "daemon_manager_test.cpp",
284  ]
285
286  include_dirs = [
287    "${distributedfile_path}/frameworks/native/distributed_file_inner/include",
288    "${distributedfile_path}/test/unittests/distributed_file_daemon/include",
289    "${services_path}/distributedfiledaemon/include",
290  ]
291
292  deps = [
293    "${services_path}/distributedfiledaemon:distributed_file_daemon_kit_inner",
294    "${utils_path}:libdistributedfileutils",
295  ]
296
297  external_deps = [
298    "c_utils:utils",
299    "device_manager:devicemanagersdk",
300    "googletest:gmock_main",
301    "googletest:gtest_main",
302    "hilog:libhilog",
303    "ipc:ipc_core",
304  ]
305
306  defines = [
307    "private=public",
308    "LOG_TAG=\"distributedfile_daemon\"",
309  ]
310
311  use_exceptions = true
312  part_name = "dfs_service"
313  subsystem_name = "filemanagement"
314}
315
316ohos_unittest("daemon_service_proxy_test") {
317  branch_protector_ret = "pac_ret"
318  sanitize = {
319    integer_overflow = true
320    cfi = true
321    cfi_cross_dso = true
322    debug = false
323    blocklist = "${distributedfile_path}/cfi_blocklist.txt"
324  }
325
326  module_out_path = "dfs_service/dfs_service_daemon"
327
328  sources = [
329    "${distributedfile_path}/utils/log/src/utils_log.cpp",
330    "daemon_service_proxy_test.cpp",
331  ]
332
333  include_dirs = [
334    "${distributedfile_path}/frameworks/native/distributed_file_inner/include",
335    "${distributedfile_path}/test/unittests/distributed_file_daemon/include",
336    "${services_path}/distributedfiledaemon/include",
337  ]
338
339  deps = [
340    "${services_path}/distributedfiledaemon:distributed_file_daemon_kit_inner",
341    "${utils_path}:libdistributedfileutils",
342  ]
343
344  external_deps = [
345    "ability_base:zuri",
346    "app_file_service:remote_file_share_native",
347    "c_utils:utils",
348    "device_manager:devicemanagersdk",
349    "googletest:gmock_main",
350    "googletest:gtest_main",
351    "hilog:libhilog",
352    "ipc:ipc_core",
353  ]
354
355  defines = [
356    "private=public",
357    "LOG_TAG=\"distributedfile_daemon\"",
358  ]
359
360  use_exceptions = true
361  part_name = "dfs_service"
362  subsystem_name = "filemanagement"
363}
364
365ohos_unittest("connection_detector_test") {
366  branch_protector_ret = "pac_ret"
367  sanitize = {
368    integer_overflow = true
369    cfi = true
370    cfi_cross_dso = true
371    debug = false
372  }
373
374  module_out_path = "dfs_service/dfs_service_daemon"
375
376  sources = [
377    "${distributedfile_path}/utils/log/src/utils_log.cpp",
378    "${services_path}/distributedfiledaemon/src/ipc/connection_detector.cpp",
379    "connection_detector_test.cpp",
380  ]
381
382  include_dirs = [
383    "${services_path}/distributedfiledaemon/include/ipc",
384    "${services_path}/distributedfiledaemon/src/ipc",
385  ]
386
387  deps = [ "${utils_path}:libdistributedfileutils" ]
388
389  external_deps = [
390    "ability_base:zuri",
391    "c_utils:utils",
392    "device_manager:devicemanagersdk",
393    "googletest:gmock_main",
394    "googletest:gtest_main",
395    "hilog:libhilog",
396    "ipc:ipc_core",
397    "os_account:os_account_innerkits",
398  ]
399
400  defines = [
401    "private=public",
402    "LOG_TAG=\"distributedfile_daemon\"",
403  ]
404
405  use_exceptions = true
406  part_name = "dfs_service"
407  subsystem_name = "filemanagement"
408}
409
410ohos_unittest("file_dfs_listener_proxy_test") {
411  branch_protector_ret = "pac_ret"
412  sanitize = {
413    integer_overflow = true
414    cfi = true
415    cfi_cross_dso = true
416    debug = false
417    blocklist = "${distributedfile_path}/cfi_blocklist.txt"
418  }
419
420  module_out_path = "dfs_service/dfs_service_daemon"
421
422  sources = [
423    "${distributedfile_path}/test/mock/message_parcel_mock.cpp",
424    "${distributedfile_path}/utils/log/src/utils_log.cpp",
425    "${services_path}/distributedfiledaemon/src/ipc/file_dfs_listener_proxy.cpp",
426    "file_dfs_listener_proxy_test.cpp",
427  ]
428
429  include_dirs = [
430    "${distributedfile_path}/frameworks/native/distributed_file_inner/include",
431    "${distributedfile_path}/test/mock",
432    "${distributedfile_path}/test/unittests/distributed_file_daemon/include",
433    "${services_path}/distributedfiledaemon/include/ipc",
434    "${services_path}/distributedfiledaemon/src/ipc",
435  ]
436
437  deps = [ "${utils_path}:libdistributedfileutils" ]
438
439  external_deps = [
440    "ability_base:zuri",
441    "c_utils:utils",
442    "device_manager:devicemanagersdk",
443    "googletest:gmock_main",
444    "googletest:gtest_main",
445    "hilog:libhilog",
446    "ipc:ipc_core",
447    "os_account:os_account_innerkits",
448    "samgr:samgr_proxy",
449  ]
450
451  defines = [
452    "private=public",
453    "LOG_TAG=\"distributedfile_daemon\"",
454  ]
455
456  use_exceptions = true
457  part_name = "dfs_service"
458  subsystem_name = "filemanagement"
459}
460
461ohos_unittest("file_trans_listener_proxy_test") {
462  branch_protector_ret = "pac_ret"
463  sanitize = {
464    integer_overflow = true
465    cfi = true
466    cfi_cross_dso = true
467    debug = false
468    blocklist = "${distributedfile_path}/cfi_blocklist.txt"
469  }
470
471  module_out_path = "dfs_service/dfs_service_daemon"
472
473  sources = [
474    "${distributedfile_path}/test/mock/message_parcel_mock.cpp",
475    "${distributedfile_path}/utils/log/src/utils_log.cpp",
476    "${services_path}/distributedfiledaemon/src/ipc/file_trans_listener_proxy.cpp",
477    "file_trans_listener_proxy_test.cpp",
478  ]
479
480  include_dirs = [
481    "${distributedfile_path}/frameworks/native/distributed_file_inner/include",
482    "${distributedfile_path}/test/mock",
483    "${distributedfile_path}/test/unittests/distributed_file_daemon/include",
484    "${services_path}/distributedfiledaemon/include/ipc",
485    "${services_path}/distributedfiledaemon/src/ipc",
486  ]
487
488  deps = [ "${utils_path}:libdistributedfileutils" ]
489
490  external_deps = [
491    "ability_base:zuri",
492    "c_utils:utils",
493    "device_manager:devicemanagersdk",
494    "googletest:gmock_main",
495    "googletest:gtest_main",
496    "hilog:libhilog",
497    "ipc:ipc_core",
498    "os_account:os_account_innerkits",
499    "samgr:samgr_proxy",
500  ]
501
502  defines = [
503    "private=public",
504    "LOG_TAG=\"distributedfile_daemon\"",
505  ]
506
507  use_exceptions = true
508  part_name = "dfs_service"
509  subsystem_name = "filemanagement"
510}
511
512ohos_unittest("trans_mananger_test") {
513  branch_protector_ret = "pac_ret"
514  sanitize = {
515    integer_overflow = true
516    cfi = true
517    cfi_cross_dso = true
518    debug = false
519  }
520
521  module_out_path = "dfs_service/dfs_service_daemon"
522
523  sources = [
524    "${distributedfile_path}/utils/log/src/utils_log.cpp",
525    "${services_path}/distributedfiledaemon/src/ipc/trans_mananger.cpp",
526    "trans_mananger_test.cpp",
527  ]
528
529  include_dirs = [
530    "${services_path}/distributedfiledaemon/include/ipc",
531    "${services_path}/distributedfiledaemon/src/ipc",
532    "${distributedfile_path}/frameworks/native/distributed_file_inner/include/",
533  ]
534
535  deps = [ "${utils_path}:libdistributedfileutils" ]
536
537  external_deps = [
538    "ability_base:zuri",
539    "c_utils:utils",
540    "device_manager:devicemanagersdk",
541    "googletest:gmock_main",
542    "googletest:gtest_main",
543    "hilog:libhilog",
544    "ipc:ipc_core",
545    "os_account:os_account_innerkits",
546  ]
547
548  defines = [
549    "private=public",
550    "LOG_TAG=\"distributedfile_daemon\"",
551  ]
552
553  use_exceptions = true
554  part_name = "dfs_service"
555  subsystem_name = "filemanagement"
556}
557
558group("distributed_daemon_test") {
559  testonly = true
560
561  deps = [
562    ":connection_detector_test",
563    ":daemon_manager_impl_test",
564    ":daemon_manager_test",
565    ":daemon_service_proxy_test",
566    ":distributed_file_daemon_stub_sup_test",
567    ":distributed_file_daemon_stub_test",
568    ":distributed_file_daemon_test",
569    ":file_dfs_listener_proxy_test",
570    ":file_trans_listener_proxy_test",
571    ":trans_mananger_test",
572  ]
573}
574