1# Copyright (C) 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("distributed_file_daemon_proxy_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    blocklist = "${distributedfile_path}/cfi_blocklist.txt"
25  }
26
27  module_out_path = "storage_distributed_file_manager/distributedfiledaemon"
28
29  sources = [
30    "${distributedfile_path}/frameworks/native/distributed_file_inner/src/distributed_file_daemon_proxy.cpp",
31    "${distributedfile_path}/test/mock/message_parcel_mock.cpp",
32    "distributed_file_daemon_proxy_test.cpp",
33  ]
34
35  include_dirs = [
36    "${distributedfile_path}/frameworks/native/distributed_file_inner/include",
37    "${distributedfile_path}/test/mock",
38    "${distributedfile_path}/test/unittests/distributed_file_daemon/include",
39    "include",
40    "${services_path}/distributedfiledaemon/include/",
41    "${services_path}/distributedfiledaemon/include/ipc",
42  ]
43
44  deps = [
45    "${utils_path}:libdistributedfileutils",
46    "//third_party/googletest:gmock_main",
47    "//third_party/googletest:gtest_main",
48  ]
49
50  external_deps = [
51    "c_utils:utils",
52    "device_manager:devicemanagersdk",
53    "hilog:libhilog",
54    "ipc:ipc_core",
55  ]
56
57  defines = [
58    "private=public",
59    "LOG_TAG=\"distributedfile_daemon\"",
60  ]
61
62  use_exceptions = true
63  part_name = "dfs_service"
64  subsystem_name = "filemanagement"
65}
66
67ohos_unittest("distributed_file_daemon_proxy_sup_test") {
68  branch_protector_ret = "pac_ret"
69  sanitize = {
70    integer_overflow = true
71    cfi = true
72    cfi_cross_dso = true
73    debug = false
74    blocklist = "${distributedfile_path}/cfi_blocklist.txt"
75  }
76
77  module_out_path = "storage_distributed_file_manager/distributedfiledaemon"
78
79  sources = [
80    "${distributedfile_path}/frameworks/native/distributed_file_inner/src/distributed_file_daemon_proxy.cpp",
81    "distributed_file_daemon_proxy_sup_test.cpp",
82  ]
83
84  include_dirs = [
85    "${distributedfile_path}/frameworks/native/distributed_file_inner/include",
86    "${distributedfile_path}/test/mock",
87    "${distributedfile_path}/test/unittests/distributed_file_daemon/include",
88    "include",
89    "${services_path}/distributedfiledaemon/include/",
90    "${services_path}/distributedfiledaemon/include/ipc",
91  ]
92
93  deps = [
94    "${utils_path}:libdistributedfileutils",
95    "//third_party/googletest:gmock_main",
96    "//third_party/googletest:gtest_main",
97  ]
98
99  external_deps = [
100    "c_utils:utils",
101    "device_manager:devicemanagersdk",
102    "hilog:libhilog",
103    "ipc:ipc_core",
104  ]
105
106  defines = [
107    "private=public",
108    "LOG_TAG=\"distributedfile_daemon\"",
109  ]
110
111  use_exceptions = true
112  part_name = "dfs_service"
113  subsystem_name = "filemanagement"
114}
115
116ohos_unittest("file_trans_listener_stub_test") {
117  branch_protector_ret = "pac_ret"
118  sanitize = {
119    integer_overflow = true
120    cfi = true
121    cfi_cross_dso = true
122    debug = false
123    blocklist = "${distributedfile_path}/cfi_blocklist.txt"
124  }
125
126  module_out_path = "storage_distributed_file_manager/distributedfiledaemon"
127
128  sources = [
129    "${distributedfile_path}/frameworks/native/distributed_file_inner/src/file_trans_listener_stub.cpp",
130    "${distributedfile_path}/test/mock/message_parcel_mock.cpp",
131    "file_trans_listener_stub_test.cpp",
132  ]
133
134  include_dirs = [
135    "${distributedfile_path}/frameworks/native/distributed_file_inner/include",
136    "${distributedfile_path}/test/mock",
137  ]
138
139  deps = [
140    "${utils_path}:libdistributedfileutils",
141    "//third_party/googletest:gmock_main",
142    "//third_party/googletest:gtest_main",
143  ]
144
145  external_deps = [
146    "c_utils:utils",
147    "device_manager:devicemanagersdk",
148    "hilog:libhilog",
149    "ipc:ipc_core",
150  ]
151
152  defines = [
153    "private=public",
154    "LOG_TAG=\"distributedfile_daemon\"",
155  ]
156
157  use_exceptions = true
158  part_name = "dfs_service"
159  subsystem_name = "filemanagement"
160}
161
162ohos_unittest("asset_recv_callback_stub_test") {
163  branch_protector_ret = "pac_ret"
164  sanitize = {
165    integer_overflow = true
166    cfi = true
167    cfi_cross_dso = true
168    debug = false
169    blocklist = "${distributedfile_path}/cfi_blocklist.txt"
170  }
171
172  module_out_path = "storage_distributed_file_manager/distributedfiledaemon"
173
174  sources = [
175    "${distributedfile_path}/frameworks/native/distributed_file_inner/src/asset/asset_obj.cpp",
176    "${distributedfile_path}/frameworks/native/distributed_file_inner/src/asset/asset_recv_callback_stub.cpp",
177    "asset/asset_recv_callback_stub_test.cpp",
178  ]
179
180  include_dirs = [
181    "${distributedfile_path}/frameworks/native/distributed_file_inner/include",
182    "${distributedfile_path}/test/unittests/distributed_file_daemon/include",
183    "include",
184    "${services_path}/distributedfiledaemon/include/",
185    "${services_path}/distributedfiledaemon/include/ipc",
186  ]
187
188  deps = [
189    "${utils_path}:libdistributedfileutils",
190    "//third_party/googletest:gmock_main",
191    "//third_party/googletest:gtest_main",
192  ]
193
194  external_deps = [
195    "c_utils:utils",
196    "device_manager:devicemanagersdk",
197    "hilog:libhilog",
198    "ipc:ipc_core",
199  ]
200
201  defines = [
202    "private=public",
203    "LOG_TAG=\"distributedfile_daemon\"",
204  ]
205
206  use_exceptions = true
207  part_name = "dfs_service"
208  subsystem_name = "filemanagement"
209}
210
211ohos_unittest("asset_send_callback_stub_test") {
212  branch_protector_ret = "pac_ret"
213  sanitize = {
214    integer_overflow = true
215    cfi = true
216    cfi_cross_dso = true
217    debug = false
218    blocklist = "${distributedfile_path}/cfi_blocklist.txt"
219  }
220
221  module_out_path = "storage_distributed_file_manager/distributedfiledaemon"
222
223  sources = [
224    "${distributedfile_path}/frameworks/native/distributed_file_inner/src/asset/asset_obj.cpp",
225    "${distributedfile_path}/frameworks/native/distributed_file_inner/src/asset/asset_send_callback_stub.cpp",
226    "asset/asset_send_callback_stub_test.cpp",
227  ]
228
229  include_dirs = [
230    "${distributedfile_path}/frameworks/native/distributed_file_inner/include",
231    "${distributedfile_path}/test/unittests/distributed_file_daemon/include",
232    "include",
233    "${services_path}/distributedfiledaemon/include/",
234    "${services_path}/distributedfiledaemon/include/ipc",
235  ]
236
237  deps = [
238    "${utils_path}:libdistributedfileutils",
239    "//third_party/googletest:gmock_main",
240    "//third_party/googletest:gtest_main",
241  ]
242
243  external_deps = [
244    "c_utils:utils",
245    "device_manager:devicemanagersdk",
246    "hilog:libhilog",
247    "ipc:ipc_core",
248  ]
249
250  defines = [
251    "private=public",
252    "LOG_TAG=\"distributedfile_daemon\"",
253  ]
254
255  use_exceptions = true
256  part_name = "dfs_service"
257  subsystem_name = "filemanagement"
258}
259
260group("distributed_file_inner") {
261  testonly = true
262
263  deps = [
264    ":asset_recv_callback_stub_test",
265    ":asset_send_callback_stub_test",
266    ":distributed_file_daemon_proxy_sup_test",
267    ":distributed_file_daemon_proxy_test",
268    ":file_trans_listener_stub_test",
269  ]
270}
271