1545fdf9bSopenharmony_ci# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
2545fdf9bSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3545fdf9bSopenharmony_ci# you may not use this file except in compliance with the License.
4545fdf9bSopenharmony_ci# You may obtain a copy of the License at
5545fdf9bSopenharmony_ci#
6545fdf9bSopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
7545fdf9bSopenharmony_ci#
8545fdf9bSopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9545fdf9bSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10545fdf9bSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11545fdf9bSopenharmony_ci# See the License for the specific language governing permissions and
12545fdf9bSopenharmony_ci# limitations under the License.
13545fdf9bSopenharmony_ci
14545fdf9bSopenharmony_ciimport("//build/test.gni")
15545fdf9bSopenharmony_ciimport("../../../bundletool.gni")
16545fdf9bSopenharmony_ci
17545fdf9bSopenharmony_cimodule_output_path = "bundle_tool/tools"
18545fdf9bSopenharmony_ci
19545fdf9bSopenharmony_ciconfig("tools_bm_config_moduletest") {
20545fdf9bSopenharmony_ci  include_dirs = [
21545fdf9bSopenharmony_ci    "${bundle_framework_path}/services/bundlemgr/include/installd",
22545fdf9bSopenharmony_ci    "${bundle_framework_path}/services/bundlemgr/include",
23545fdf9bSopenharmony_ci    "${bundle_framework_path}/services/bundlemgr/include/sandbox_app",
24545fdf9bSopenharmony_ci    "${bundle_framework_path}/services/bundlemgr/include/shared",
25545fdf9bSopenharmony_ci    "//third_party/json/include",
26545fdf9bSopenharmony_ci    "//third_party/zlib",
27545fdf9bSopenharmony_ci    "//third_party/zlib/contrib/minizip",
28545fdf9bSopenharmony_ci  ]
29545fdf9bSopenharmony_ci}
30545fdf9bSopenharmony_ci
31545fdf9bSopenharmony_citools_bm_mock_sources = [
32545fdf9bSopenharmony_ci  "${bundletool_test_path}/mock/mock_bundle_installer_host.cpp",
33545fdf9bSopenharmony_ci  "${bundletool_test_path}/mock/mock_bundle_mgr_host.cpp",
34545fdf9bSopenharmony_ci]
35545fdf9bSopenharmony_ci
36545fdf9bSopenharmony_ciohos_moduletest("bm_command_dump_module_test") {
37545fdf9bSopenharmony_ci  module_out_path = module_output_path
38545fdf9bSopenharmony_ci
39545fdf9bSopenharmony_ci  sources = [
40545fdf9bSopenharmony_ci    "${bundletool_path}/src/bundle_command.cpp",
41545fdf9bSopenharmony_ci    "${bundletool_path}/src/bundle_command_common.cpp",
42545fdf9bSopenharmony_ci    "${bundletool_path}/src/quick_fix_command.cpp",
43545fdf9bSopenharmony_ci    "${bundletool_path}/src/quick_fix_status_callback_host_impl.cpp",
44545fdf9bSopenharmony_ci    "${bundletool_path}/src/shell_command.cpp",
45545fdf9bSopenharmony_ci    "${bundletool_path}/src/status_receiver_impl.cpp",
46545fdf9bSopenharmony_ci    "${kits_path}/js/bundlemgr/bundle_death_recipient.cpp",
47545fdf9bSopenharmony_ci    "bm_command_dump_module_test.cpp",
48545fdf9bSopenharmony_ci  ]
49545fdf9bSopenharmony_ci  sources += tools_bm_mock_sources
50545fdf9bSopenharmony_ci
51545fdf9bSopenharmony_ci  configs = [
52545fdf9bSopenharmony_ci    "${bundletool_path}:tools_bm_config",
53545fdf9bSopenharmony_ci    "${bundletool_test_path}/unittest/bm:tools_bm_config_mock",
54545fdf9bSopenharmony_ci  ]
55545fdf9bSopenharmony_ci
56545fdf9bSopenharmony_ci  cflags = []
57545fdf9bSopenharmony_ci  if (target_cpu == "arm") {
58545fdf9bSopenharmony_ci    cflags += [ "-DBINDER_IPC_32BIT" ]
59545fdf9bSopenharmony_ci  }
60545fdf9bSopenharmony_ci
61545fdf9bSopenharmony_ci  deps = [
62545fdf9bSopenharmony_ci    "${bundle_framework_path}/services/bundlemgr:libbms",
63545fdf9bSopenharmony_ci    "//third_party/googletest:gmock_main",
64545fdf9bSopenharmony_ci    "//third_party/googletest:gtest_main",
65545fdf9bSopenharmony_ci  ]
66545fdf9bSopenharmony_ci
67545fdf9bSopenharmony_ci  external_deps = [
68545fdf9bSopenharmony_ci    "ability_base:base",
69545fdf9bSopenharmony_ci    "ability_base:want",
70545fdf9bSopenharmony_ci    "ability_runtime:app_manager",
71545fdf9bSopenharmony_ci    "ability_runtime:quickfix_manager",
72545fdf9bSopenharmony_ci    "access_token:libaccesstoken_sdk",
73545fdf9bSopenharmony_ci    "appverify:libhapverify",
74545fdf9bSopenharmony_ci    "bundle_framework:appexecfwk_base",
75545fdf9bSopenharmony_ci    "bundle_framework:appexecfwk_core",
76545fdf9bSopenharmony_ci    "bundle_framework:bundle_napi_common",
77545fdf9bSopenharmony_ci    "bundle_framework:libappexecfwk_common",
78545fdf9bSopenharmony_ci    "c_utils:utils",
79545fdf9bSopenharmony_ci    "common_event_service:cesfwk_innerkits",
80545fdf9bSopenharmony_ci    "hilog:libhilog",
81545fdf9bSopenharmony_ci    "init:libbegetutil",
82545fdf9bSopenharmony_ci    "ipc:ipc_core",
83545fdf9bSopenharmony_ci    "kv_store:distributeddata_inner",
84545fdf9bSopenharmony_ci    "os_account:os_account_innerkits",
85545fdf9bSopenharmony_ci    "samgr:samgr_proxy",
86545fdf9bSopenharmony_ci  ]
87545fdf9bSopenharmony_ci
88545fdf9bSopenharmony_ci  external_deps += bm_install_external_deps
89545fdf9bSopenharmony_ci}
90545fdf9bSopenharmony_ci
91545fdf9bSopenharmony_ciohos_moduletest("bm_command_install_module_test") {
92545fdf9bSopenharmony_ci  module_out_path = module_output_path
93545fdf9bSopenharmony_ci
94545fdf9bSopenharmony_ci  sources = [
95545fdf9bSopenharmony_ci    "${bundletool_path}/src/bundle_command.cpp",
96545fdf9bSopenharmony_ci    "${bundletool_path}/src/bundle_command_common.cpp",
97545fdf9bSopenharmony_ci    "${bundletool_path}/src/quick_fix_command.cpp",
98545fdf9bSopenharmony_ci    "${bundletool_path}/src/quick_fix_status_callback_host_impl.cpp",
99545fdf9bSopenharmony_ci    "${bundletool_path}/src/shell_command.cpp",
100545fdf9bSopenharmony_ci    "${bundletool_path}/src/status_receiver_impl.cpp",
101545fdf9bSopenharmony_ci    "${kits_path}/js/bundlemgr/bundle_death_recipient.cpp",
102545fdf9bSopenharmony_ci    "bm_command_install_module_test.cpp",
103545fdf9bSopenharmony_ci  ]
104545fdf9bSopenharmony_ci  sources += tools_bm_mock_sources
105545fdf9bSopenharmony_ci
106545fdf9bSopenharmony_ci  configs = [
107545fdf9bSopenharmony_ci    "${bundletool_path}:tools_bm_config",
108545fdf9bSopenharmony_ci    "${bundletool_test_path}/unittest/bm:tools_bm_config_mock",
109545fdf9bSopenharmony_ci  ]
110545fdf9bSopenharmony_ci
111545fdf9bSopenharmony_ci  cflags = []
112545fdf9bSopenharmony_ci  if (target_cpu == "arm") {
113545fdf9bSopenharmony_ci    cflags += [ "-DBINDER_IPC_32BIT" ]
114545fdf9bSopenharmony_ci  }
115545fdf9bSopenharmony_ci
116545fdf9bSopenharmony_ci  deps = [
117545fdf9bSopenharmony_ci    "${bundle_framework_path}/services/bundlemgr:libbms",
118545fdf9bSopenharmony_ci    "//third_party/googletest:gmock_main",
119545fdf9bSopenharmony_ci    "//third_party/googletest:gtest_main",
120545fdf9bSopenharmony_ci  ]
121545fdf9bSopenharmony_ci
122545fdf9bSopenharmony_ci  external_deps = [
123545fdf9bSopenharmony_ci    "ability_base:base",
124545fdf9bSopenharmony_ci    "ability_base:want",
125545fdf9bSopenharmony_ci    "ability_runtime:app_manager",
126545fdf9bSopenharmony_ci    "ability_runtime:quickfix_manager",
127545fdf9bSopenharmony_ci    "access_token:libaccesstoken_sdk",
128545fdf9bSopenharmony_ci    "appverify:libhapverify",
129545fdf9bSopenharmony_ci    "bundle_framework:appexecfwk_base",
130545fdf9bSopenharmony_ci    "bundle_framework:appexecfwk_core",
131545fdf9bSopenharmony_ci    "bundle_framework:bundle_napi_common",
132545fdf9bSopenharmony_ci    "bundle_framework:libappexecfwk_common",
133545fdf9bSopenharmony_ci    "c_utils:utils",
134545fdf9bSopenharmony_ci    "common_event_service:cesfwk_innerkits",
135545fdf9bSopenharmony_ci    "hilog:libhilog",
136545fdf9bSopenharmony_ci    "init:libbegetutil",
137545fdf9bSopenharmony_ci    "ipc:ipc_core",
138545fdf9bSopenharmony_ci    "kv_store:distributeddata_inner",
139545fdf9bSopenharmony_ci    "os_account:os_account_innerkits",
140545fdf9bSopenharmony_ci    "samgr:samgr_proxy",
141545fdf9bSopenharmony_ci  ]
142545fdf9bSopenharmony_ci
143545fdf9bSopenharmony_ci  external_deps += bm_install_external_deps
144545fdf9bSopenharmony_ci}
145545fdf9bSopenharmony_ci
146545fdf9bSopenharmony_ciohos_moduletest("bm_command_uninstall_module_test") {
147545fdf9bSopenharmony_ci  module_out_path = module_output_path
148545fdf9bSopenharmony_ci
149545fdf9bSopenharmony_ci  sources = [
150545fdf9bSopenharmony_ci    "${bundletool_path}/src/bundle_command.cpp",
151545fdf9bSopenharmony_ci    "${bundletool_path}/src/bundle_command_common.cpp",
152545fdf9bSopenharmony_ci    "${bundletool_path}/src/quick_fix_command.cpp",
153545fdf9bSopenharmony_ci    "${bundletool_path}/src/quick_fix_status_callback_host_impl.cpp",
154545fdf9bSopenharmony_ci    "${bundletool_path}/src/shell_command.cpp",
155545fdf9bSopenharmony_ci    "${bundletool_path}/src/status_receiver_impl.cpp",
156545fdf9bSopenharmony_ci    "${kits_path}/js/bundlemgr/bundle_death_recipient.cpp",
157545fdf9bSopenharmony_ci    "bm_command_uninstall_module_test.cpp",
158545fdf9bSopenharmony_ci  ]
159545fdf9bSopenharmony_ci  sources += tools_bm_mock_sources
160545fdf9bSopenharmony_ci
161545fdf9bSopenharmony_ci  configs = [
162545fdf9bSopenharmony_ci    "${bundletool_path}:tools_bm_config",
163545fdf9bSopenharmony_ci    "${bundletool_test_path}/unittest/bm:tools_bm_config_mock",
164545fdf9bSopenharmony_ci  ]
165545fdf9bSopenharmony_ci
166545fdf9bSopenharmony_ci  cflags = []
167545fdf9bSopenharmony_ci  if (target_cpu == "arm") {
168545fdf9bSopenharmony_ci    cflags += [ "-DBINDER_IPC_32BIT" ]
169545fdf9bSopenharmony_ci  }
170545fdf9bSopenharmony_ci
171545fdf9bSopenharmony_ci  deps = [
172545fdf9bSopenharmony_ci    "${bundle_framework_path}/services/bundlemgr:libbms",
173545fdf9bSopenharmony_ci    "//third_party/googletest:gmock_main",
174545fdf9bSopenharmony_ci    "//third_party/googletest:gtest_main",
175545fdf9bSopenharmony_ci  ]
176545fdf9bSopenharmony_ci
177545fdf9bSopenharmony_ci  external_deps = [
178545fdf9bSopenharmony_ci    "ability_base:base",
179545fdf9bSopenharmony_ci    "ability_base:want",
180545fdf9bSopenharmony_ci    "ability_runtime:app_manager",
181545fdf9bSopenharmony_ci    "ability_runtime:quickfix_manager",
182545fdf9bSopenharmony_ci    "access_token:libaccesstoken_sdk",
183545fdf9bSopenharmony_ci    "appverify:libhapverify",
184545fdf9bSopenharmony_ci    "bundle_framework:appexecfwk_base",
185545fdf9bSopenharmony_ci    "bundle_framework:appexecfwk_core",
186545fdf9bSopenharmony_ci    "bundle_framework:bundle_napi_common",
187545fdf9bSopenharmony_ci    "bundle_framework:libappexecfwk_common",
188545fdf9bSopenharmony_ci    "c_utils:utils",
189545fdf9bSopenharmony_ci    "common_event_service:cesfwk_innerkits",
190545fdf9bSopenharmony_ci    "hilog:libhilog",
191545fdf9bSopenharmony_ci    "init:libbegetutil",
192545fdf9bSopenharmony_ci    "ipc:ipc_core",
193545fdf9bSopenharmony_ci    "kv_store:distributeddata_inner",
194545fdf9bSopenharmony_ci    "os_account:os_account_innerkits",
195545fdf9bSopenharmony_ci    "samgr:samgr_proxy",
196545fdf9bSopenharmony_ci  ]
197545fdf9bSopenharmony_ci
198545fdf9bSopenharmony_ci  external_deps += bm_install_external_deps
199545fdf9bSopenharmony_ci}
200545fdf9bSopenharmony_ci
201545fdf9bSopenharmony_cigroup("moduletest") {
202545fdf9bSopenharmony_ci  testonly = true
203545fdf9bSopenharmony_ci
204545fdf9bSopenharmony_ci  deps = [
205545fdf9bSopenharmony_ci    ":bm_command_dump_module_test",
206545fdf9bSopenharmony_ci    ":bm_command_install_module_test",
207545fdf9bSopenharmony_ci    ":bm_command_uninstall_module_test",
208545fdf9bSopenharmony_ci  ]
209545fdf9bSopenharmony_ci}
210