• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2023 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("../../../bundletool.gni")
16
17module_output_path = "bundle_tool/tools"
18
19config("tools_bm_config_mock") {
20  include_dirs = [
21    "${inner_api_path}/appexecfwk_base/include",
22    "${inner_api_path}/appexecfwk_base/include/quick_fix",
23    "${inner_api_path}/appexecfwk_core/include/bundlemgr",
24    "${bundle_framework_path}/services/bundlemgr/include",
25    "${bundle_framework_path}/services/bundlemgr/include/quick_fix",
26    "${bundle_framework_path}/services/bundlemgr/include/sandbox_app",
27    "${bundle_framework_path}/services/bundlemgr/include/shared",
28    "${bundletool_test_path}/mock",
29    "//third_party/googletest/googlemock/include",
30    "//third_party/json/single_include",
31  ]
32}
33
34tools_bm_mock_sources = [
35  "${bundletool_test_path}/mock/mock_bundle_installer_host.cpp",
36  "${bundletool_test_path}/mock/mock_bundle_mgr_host.cpp",
37]
38
39ohos_unittest("bm_command_dump_test") {
40  module_out_path = module_output_path
41
42  include_dirs = []
43
44  sources = [
45    "${bundletool_path}/src/bundle_command.cpp",
46    "${bundletool_path}/src/bundle_command_common.cpp",
47    "${bundletool_path}/src/quick_fix_command.cpp",
48    "${bundletool_path}/src/shell_command.cpp",
49    "${bundletool_path}/src/status_receiver_impl.cpp",
50    "${kits_path}/js/bundlemgr/bundle_death_recipient.cpp",
51    "bm_command_dump_test.cpp",
52  ]
53  sources += tools_bm_mock_sources
54
55  configs = [
56    "${bundletool_path}:tools_bm_config",
57    ":tools_bm_config_mock",
58  ]
59
60  cflags = []
61  if (target_cpu == "arm") {
62    cflags += [ "-DBINDER_IPC_32BIT" ]
63  }
64
65  deps = [
66    "${bundle_framework_path}/services/bundlemgr:libbms",
67    "//third_party/googletest:gmock_main",
68    "//third_party/googletest:gtest_main",
69  ]
70
71  external_deps = [
72    "ability_base:want",
73    "ability_runtime:quickfix_manager",
74    "access_token:libaccesstoken_sdk",
75    "appverify:libhapverify",
76    "bundle_framework:appexecfwk_base",
77    "bundle_framework:appexecfwk_core",
78    "bundle_framework:libappexecfwk_common",
79    "c_utils:utils",
80    "common_event_service:cesfwk_innerkits",
81    "eventhandler:libeventhandler",
82    "hilog:libhilog",
83    "init:libbegetutil",
84    "ipc:ipc_core",
85    "kv_store:distributeddata_inner",
86    "os_account:os_account_innerkits",
87    "samgr:samgr_proxy",
88  ]
89}
90
91ohos_unittest("bm_command_dump_dependencies_test") {
92  module_out_path = module_output_path
93
94  include_dirs = []
95
96  sources = [
97    "${bundletool_path}/src/bundle_command.cpp",
98    "${bundletool_path}/src/bundle_command_common.cpp",
99    "${bundletool_path}/src/quick_fix_command.cpp",
100    "${bundletool_path}/src/shell_command.cpp",
101    "${bundletool_path}/src/status_receiver_impl.cpp",
102    "${kits_path}/js/bundlemgr/bundle_death_recipient.cpp",
103    "bm_command_dump_dependencies_test.cpp",
104  ]
105  sources += tools_bm_mock_sources
106
107  configs = [
108    "${bundletool_path}:tools_bm_config",
109    ":tools_bm_config_mock",
110  ]
111
112  cflags = []
113  if (target_cpu == "arm") {
114    cflags += [ "-DBINDER_IPC_32BIT" ]
115  }
116
117  deps = [
118    "${bundle_framework_path}/services/bundlemgr:libbms",
119    "//third_party/googletest:gmock_main",
120    "//third_party/googletest:gtest_main",
121  ]
122
123  external_deps = [
124    "ability_base:want",
125    "ability_runtime:quickfix_manager",
126    "access_token:libaccesstoken_sdk",
127    "appverify:libhapverify",
128    "bundle_framework:appexecfwk_base",
129    "bundle_framework:appexecfwk_core",
130    "bundle_framework:libappexecfwk_common",
131    "c_utils:utils",
132    "common_event_service:cesfwk_innerkits",
133    "eventhandler:libeventhandler",
134    "hilog:libhilog",
135    "init:libbegetutil",
136    "ipc:ipc_core",
137    "kv_store:distributeddata_inner",
138    "os_account:os_account_innerkits",
139    "samgr:samgr_proxy",
140  ]
141}
142
143ohos_unittest("bm_command_install_test") {
144  module_out_path = module_output_path
145
146  include_dirs = []
147
148  sources = [
149    "${bundletool_path}/src/bundle_command.cpp",
150    "${bundletool_path}/src/bundle_command_common.cpp",
151    "${bundletool_path}/src/quick_fix_command.cpp",
152    "${bundletool_path}/src/shell_command.cpp",
153    "${bundletool_path}/src/status_receiver_impl.cpp",
154    "${kits_path}/js/bundlemgr/bundle_death_recipient.cpp",
155    "bm_command_install_test.cpp",
156  ]
157  sources += tools_bm_mock_sources
158
159  configs = [
160    "${bundletool_path}:tools_bm_config",
161    ":tools_bm_config_mock",
162  ]
163
164  cflags = []
165  if (target_cpu == "arm") {
166    cflags += [ "-DBINDER_IPC_32BIT" ]
167  }
168
169  deps = [
170    "${bundle_framework_path}/services/bundlemgr:libbms",
171    "//third_party/googletest:gmock_main",
172    "//third_party/googletest:gtest_main",
173  ]
174
175  external_deps = [
176    "ability_base:want",
177    "ability_runtime:quickfix_manager",
178    "access_token:libaccesstoken_sdk",
179    "appverify:libhapverify",
180    "bundle_framework:appexecfwk_base",
181    "bundle_framework:appexecfwk_core",
182    "bundle_framework:libappexecfwk_common",
183    "c_utils:utils",
184    "common_event_service:cesfwk_innerkits",
185    "eventhandler:libeventhandler",
186    "hilog:libhilog",
187    "init:libbegetutil",
188    "ipc:ipc_core",
189    "kv_store:distributeddata_inner",
190    "os_account:os_account_innerkits",
191    "samgr:samgr_proxy",
192  ]
193}
194
195ohos_unittest("bm_command_test") {
196  module_out_path = module_output_path
197
198  include_dirs = []
199
200  sources = [
201    "${bundletool_path}/src/bundle_command.cpp",
202    "${bundletool_path}/src/bundle_command_common.cpp",
203    "${bundletool_path}/src/quick_fix_command.cpp",
204    "${bundletool_path}/src/shell_command.cpp",
205    "${bundletool_path}/src/status_receiver_impl.cpp",
206    "${kits_path}/js/bundlemgr/bundle_death_recipient.cpp",
207    "bm_command_test.cpp",
208  ]
209  sources += tools_bm_mock_sources
210
211  configs = [
212    "${bundletool_path}:tools_bm_config",
213    ":tools_bm_config_mock",
214  ]
215
216  cflags = []
217  if (target_cpu == "arm") {
218    cflags += [ "-DBINDER_IPC_32BIT" ]
219  }
220
221  deps = [
222    "${bundle_framework_path}/services/bundlemgr:libbms",
223    "//third_party/googletest:gmock_main",
224    "//third_party/googletest:gtest_main",
225  ]
226
227  external_deps = [
228    "ability_base:want",
229    "ability_runtime:quickfix_manager",
230    "access_token:libaccesstoken_sdk",
231    "appverify:libhapverify",
232    "bundle_framework:appexecfwk_base",
233    "bundle_framework:appexecfwk_core",
234    "bundle_framework:libappexecfwk_common",
235    "c_utils:utils",
236    "common_event_service:cesfwk_innerkits",
237    "eventhandler:libeventhandler",
238    "hilog:libhilog",
239    "init:libbegetutil",
240    "ipc:ipc_core",
241    "kv_store:distributeddata_inner",
242    "os_account:os_account_innerkits",
243    "samgr:samgr_proxy",
244  ]
245}
246
247ohos_unittest("bm_command_uninstall_test") {
248  module_out_path = module_output_path
249
250  include_dirs = []
251
252  sources = [
253    "${bundletool_path}/src/bundle_command.cpp",
254    "${bundletool_path}/src/bundle_command_common.cpp",
255    "${bundletool_path}/src/quick_fix_command.cpp",
256    "${bundletool_path}/src/shell_command.cpp",
257    "${bundletool_path}/src/status_receiver_impl.cpp",
258    "${kits_path}/js/bundlemgr/bundle_death_recipient.cpp",
259    "bm_command_uninstall_test.cpp",
260  ]
261  sources += tools_bm_mock_sources
262
263  configs = [
264    "${bundletool_path}:tools_bm_config",
265    ":tools_bm_config_mock",
266  ]
267
268  cflags = []
269  if (target_cpu == "arm") {
270    cflags += [ "-DBINDER_IPC_32BIT" ]
271  }
272
273  deps = [
274    "${bundle_framework_path}/services/bundlemgr:libbms",
275    "//third_party/googletest:gmock_main",
276    "//third_party/googletest:gtest_main",
277  ]
278
279  external_deps = [
280    "ability_base:want",
281    "ability_runtime:quickfix_manager",
282    "access_token:libaccesstoken_sdk",
283    "appverify:libhapverify",
284    "bundle_framework:appexecfwk_base",
285    "bundle_framework:appexecfwk_core",
286    "bundle_framework:libappexecfwk_common",
287    "c_utils:utils",
288    "common_event_service:cesfwk_innerkits",
289    "eventhandler:libeventhandler",
290    "hilog:libhilog",
291    "init:libbegetutil",
292    "ipc:ipc_core",
293    "kv_store:distributeddata_inner",
294    "os_account:os_account_innerkits",
295    "samgr:samgr_proxy",
296  ]
297}
298
299ohos_unittest("bm_command_quickfix_test") {
300  module_out_path = module_output_path
301
302  include_dirs = []
303
304  sources = [
305    "${bundletool_path}/src/bundle_command.cpp",
306    "${bundletool_path}/src/bundle_command_common.cpp",
307    "${bundletool_path}/src/quick_fix_command.cpp",
308    "${bundletool_path}/src/shell_command.cpp",
309    "${bundletool_path}/src/status_receiver_impl.cpp",
310    "${kits_path}/js/bundlemgr/bundle_death_recipient.cpp",
311    "bm_command_quickfix_test.cpp",
312  ]
313  sources += tools_bm_mock_sources
314
315  configs = [
316    "${bundletool_path}:tools_bm_config",
317    ":tools_bm_config_mock",
318  ]
319
320  cflags = []
321  if (target_cpu == "arm") {
322    cflags += [ "-DBINDER_IPC_32BIT" ]
323  }
324
325  deps = [
326    "${bundle_framework_path}/services/bundlemgr:libbms",
327    "//third_party/googletest:gmock_main",
328    "//third_party/googletest:gtest_main",
329  ]
330
331  external_deps = [
332    "ability_base:want",
333    "ability_runtime:quickfix_manager",
334    "access_token:libaccesstoken_sdk",
335    "appverify:libhapverify",
336    "bundle_framework:appexecfwk_base",
337    "bundle_framework:appexecfwk_core",
338    "bundle_framework:libappexecfwk_common",
339    "c_utils:utils",
340    "common_event_service:cesfwk_innerkits",
341    "eventhandler:libeventhandler",
342    "hilog:libhilog",
343    "init:libbegetutil",
344    "ipc:ipc_core",
345    "kv_store:distributeddata_inner",
346    "os_account:os_account_innerkits",
347    "samgr:samgr_proxy",
348  ]
349}
350
351ohos_unittest("bm_command_overlay_test") {
352  module_out_path = module_output_path
353
354  include_dirs = []
355
356  sources = [
357    "${bundletool_path}/src/bundle_command.cpp",
358    "${bundletool_path}/src/bundle_command_common.cpp",
359    "${bundletool_path}/src/quick_fix_command.cpp",
360    "${bundletool_path}/src/shell_command.cpp",
361    "${bundletool_path}/src/status_receiver_impl.cpp",
362    "${kits_path}/js/bundlemgr/bundle_death_recipient.cpp",
363    "bm_command_overlay_test.cpp",
364  ]
365  sources += tools_bm_mock_sources
366
367  configs = [
368    "${bundletool_path}:tools_bm_config",
369    ":tools_bm_config_mock",
370  ]
371
372  cflags = []
373  if (target_cpu == "arm") {
374    cflags += [ "-DBINDER_IPC_32BIT" ]
375  }
376
377  deps = [
378    "${bundle_framework_path}/services/bundlemgr:libbms",
379    "//third_party/googletest:gmock_main",
380    "//third_party/googletest:gtest_main",
381  ]
382
383  external_deps = [
384    "ability_base:want",
385    "ability_runtime:quickfix_manager",
386    "access_token:libaccesstoken_sdk",
387    "appverify:libhapverify",
388    "bundle_framework:appexecfwk_base",
389    "bundle_framework:appexecfwk_core",
390    "bundle_framework:libappexecfwk_common",
391    "c_utils:utils",
392    "common_event_service:cesfwk_innerkits",
393    "eventhandler:libeventhandler",
394    "hilog:libhilog",
395    "init:libbegetutil",
396    "ipc:ipc_core",
397    "kv_store:distributeddata_inner",
398    "os_account:os_account_innerkits",
399    "samgr:samgr_proxy",
400  ]
401
402  defines = []
403  if (overlay_install_bm) {
404    defines += [ "BUNDLE_FRAMEWORK_OVERLAY_INSTALLATION" ]
405  }
406}
407
408group("unittest") {
409  testonly = true
410
411  deps = [
412    ":bm_command_dump_dependencies_test",
413    ":bm_command_dump_test",
414    ":bm_command_install_test",
415    ":bm_command_overlay_test",
416    ":bm_command_quickfix_test",
417    ":bm_command_test",
418    ":bm_command_uninstall_test",
419  ]
420}
421