1# Copyright (c) 2021-2022 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_moduletest") { 20 include_dirs = [ 21 "${bundle_framework_path}/services/bundlemgr/include/installd", 22 "${bundle_framework_path}/services/bundlemgr/include", 23 "${bundle_framework_path}/services/bundlemgr/include/sandbox_app", 24 "${bundle_framework_path}/services/bundlemgr/include/shared", 25 "//third_party/json/include", 26 "//third_party/zlib", 27 "//third_party/zlib/contrib/minizip", 28 ] 29} 30 31tools_bm_mock_sources = [ 32 "${bundletool_test_path}/mock/mock_bundle_installer_host.cpp", 33 "${bundletool_test_path}/mock/mock_bundle_mgr_host.cpp", 34] 35 36ohos_moduletest("bm_command_dump_module_test") { 37 module_out_path = module_output_path 38 39 sources = [ 40 "${bundletool_path}/src/bundle_command.cpp", 41 "${bundletool_path}/src/bundle_command_common.cpp", 42 "${bundletool_path}/src/quick_fix_command.cpp", 43 "${bundletool_path}/src/shell_command.cpp", 44 "${bundletool_path}/src/status_receiver_impl.cpp", 45 "${kits_path}/js/bundlemgr/bundle_death_recipient.cpp", 46 "bm_command_dump_module_test.cpp", 47 ] 48 sources += tools_bm_mock_sources 49 50 configs = [ 51 "${bundletool_path}:tools_bm_config", 52 "${bundletool_test_path}/unittest/bm:tools_bm_config_mock", 53 ] 54 55 cflags = [] 56 if (target_cpu == "arm") { 57 cflags += [ "-DBINDER_IPC_32BIT" ] 58 } 59 60 deps = [ 61 "${bundle_framework_path}/services/bundlemgr:libbms", 62 "//third_party/googletest:gmock_main", 63 "//third_party/googletest:gtest_main", 64 ] 65 66 external_deps = [ 67 "ability_base:base", 68 "ability_base:want", 69 "ability_runtime:quickfix_manager", 70 "access_token:libaccesstoken_sdk", 71 "appverify:libhapverify", 72 "bundle_framework:appexecfwk_base", 73 "bundle_framework:appexecfwk_core", 74 "bundle_framework:libappexecfwk_common", 75 "c_utils:utils", 76 "common_event_service:cesfwk_innerkits", 77 "hilog:libhilog", 78 "init:libbegetutil", 79 "ipc:ipc_core", 80 "kv_store:distributeddata_inner", 81 "os_account:os_account_innerkits", 82 "samgr:samgr_proxy", 83 ] 84} 85 86ohos_moduletest("bm_command_install_module_test") { 87 module_out_path = module_output_path 88 89 sources = [ 90 "${bundletool_path}/src/bundle_command.cpp", 91 "${bundletool_path}/src/bundle_command_common.cpp", 92 "${bundletool_path}/src/quick_fix_command.cpp", 93 "${bundletool_path}/src/shell_command.cpp", 94 "${bundletool_path}/src/status_receiver_impl.cpp", 95 "${kits_path}/js/bundlemgr/bundle_death_recipient.cpp", 96 "bm_command_install_module_test.cpp", 97 ] 98 sources += tools_bm_mock_sources 99 100 configs = [ 101 "${bundletool_path}:tools_bm_config", 102 "${bundletool_test_path}/unittest/bm:tools_bm_config_mock", 103 ] 104 105 cflags = [] 106 if (target_cpu == "arm") { 107 cflags += [ "-DBINDER_IPC_32BIT" ] 108 } 109 110 deps = [ 111 "${bundle_framework_path}/services/bundlemgr:libbms", 112 "//third_party/googletest:gmock_main", 113 "//third_party/googletest:gtest_main", 114 ] 115 116 external_deps = [ 117 "ability_base:base", 118 "ability_base:want", 119 "ability_runtime:quickfix_manager", 120 "access_token:libaccesstoken_sdk", 121 "appverify:libhapverify", 122 "bundle_framework:appexecfwk_base", 123 "bundle_framework:appexecfwk_core", 124 "bundle_framework:libappexecfwk_common", 125 "c_utils:utils", 126 "common_event_service:cesfwk_innerkits", 127 "hilog:libhilog", 128 "init:libbegetutil", 129 "ipc:ipc_core", 130 "kv_store:distributeddata_inner", 131 "os_account:os_account_innerkits", 132 "samgr:samgr_proxy", 133 ] 134} 135 136ohos_moduletest("bm_command_uninstall_module_test") { 137 module_out_path = module_output_path 138 139 sources = [ 140 "${bundletool_path}/src/bundle_command.cpp", 141 "${bundletool_path}/src/bundle_command_common.cpp", 142 "${bundletool_path}/src/quick_fix_command.cpp", 143 "${bundletool_path}/src/shell_command.cpp", 144 "${bundletool_path}/src/status_receiver_impl.cpp", 145 "${kits_path}/js/bundlemgr/bundle_death_recipient.cpp", 146 "bm_command_uninstall_module_test.cpp", 147 ] 148 sources += tools_bm_mock_sources 149 150 configs = [ 151 "${bundletool_path}:tools_bm_config", 152 "${bundletool_test_path}/unittest/bm:tools_bm_config_mock", 153 ] 154 155 cflags = [] 156 if (target_cpu == "arm") { 157 cflags += [ "-DBINDER_IPC_32BIT" ] 158 } 159 160 deps = [ 161 "${bundle_framework_path}/services/bundlemgr:libbms", 162 "//third_party/googletest:gmock_main", 163 "//third_party/googletest:gtest_main", 164 ] 165 166 external_deps = [ 167 "ability_base:base", 168 "ability_base:want", 169 "ability_runtime:quickfix_manager", 170 "access_token:libaccesstoken_sdk", 171 "appverify:libhapverify", 172 "bundle_framework:appexecfwk_base", 173 "bundle_framework:appexecfwk_core", 174 "bundle_framework:libappexecfwk_common", 175 "c_utils:utils", 176 "common_event_service:cesfwk_innerkits", 177 "hilog:libhilog", 178 "init:libbegetutil", 179 "ipc:ipc_core", 180 "kv_store:distributeddata_inner", 181 "os_account:os_account_innerkits", 182 "samgr:samgr_proxy", 183 ] 184} 185 186group("moduletest") { 187 testonly = true 188 189 deps = [ 190 ":bm_command_dump_module_test", 191 ":bm_command_install_module_test", 192 ":bm_command_uninstall_module_test", 193 ] 194} 195