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:ability_manager", 70 "ability_runtime:quickfix_manager", 71 "access_token:libaccesstoken_sdk", 72 "appverify:libhapverify", 73 "bundle_framework:appexecfwk_base", 74 "bundle_framework:appexecfwk_core", 75 "bundle_framework:libappexecfwk_common", 76 "c_utils:utils", 77 "common_event_service:cesfwk_innerkits", 78 "hilog:libhilog", 79 "init:libbegetutil", 80 "ipc:ipc_core", 81 "kv_store:distributeddata_inner", 82 "os_account:os_account_innerkits", 83 "samgr:samgr_proxy", 84 ] 85 86 external_deps += bm_install_external_deps 87} 88 89ohos_moduletest("bm_command_install_module_test") { 90 module_out_path = module_output_path 91 92 sources = [ 93 "${bundletool_path}/src/bundle_command.cpp", 94 "${bundletool_path}/src/bundle_command_common.cpp", 95 "${bundletool_path}/src/quick_fix_command.cpp", 96 "${bundletool_path}/src/shell_command.cpp", 97 "${bundletool_path}/src/status_receiver_impl.cpp", 98 "${kits_path}/js/bundlemgr/bundle_death_recipient.cpp", 99 "bm_command_install_module_test.cpp", 100 ] 101 sources += tools_bm_mock_sources 102 103 configs = [ 104 "${bundletool_path}:tools_bm_config", 105 "${bundletool_test_path}/unittest/bm:tools_bm_config_mock", 106 ] 107 108 cflags = [] 109 if (target_cpu == "arm") { 110 cflags += [ "-DBINDER_IPC_32BIT" ] 111 } 112 113 deps = [ 114 "${bundle_framework_path}/services/bundlemgr:libbms", 115 "//third_party/googletest:gmock_main", 116 "//third_party/googletest:gtest_main", 117 ] 118 119 external_deps = [ 120 "ability_base:base", 121 "ability_base:want", 122 "ability_runtime:ability_manager", 123 "ability_runtime:quickfix_manager", 124 "access_token:libaccesstoken_sdk", 125 "appverify:libhapverify", 126 "bundle_framework:appexecfwk_base", 127 "bundle_framework:appexecfwk_core", 128 "bundle_framework:libappexecfwk_common", 129 "c_utils:utils", 130 "common_event_service:cesfwk_innerkits", 131 "hilog:libhilog", 132 "init:libbegetutil", 133 "ipc:ipc_core", 134 "kv_store:distributeddata_inner", 135 "os_account:os_account_innerkits", 136 "samgr:samgr_proxy", 137 ] 138 139 external_deps += bm_install_external_deps 140} 141 142ohos_moduletest("bm_command_uninstall_module_test") { 143 module_out_path = module_output_path 144 145 sources = [ 146 "${bundletool_path}/src/bundle_command.cpp", 147 "${bundletool_path}/src/bundle_command_common.cpp", 148 "${bundletool_path}/src/quick_fix_command.cpp", 149 "${bundletool_path}/src/shell_command.cpp", 150 "${bundletool_path}/src/status_receiver_impl.cpp", 151 "${kits_path}/js/bundlemgr/bundle_death_recipient.cpp", 152 "bm_command_uninstall_module_test.cpp", 153 ] 154 sources += tools_bm_mock_sources 155 156 configs = [ 157 "${bundletool_path}:tools_bm_config", 158 "${bundletool_test_path}/unittest/bm:tools_bm_config_mock", 159 ] 160 161 cflags = [] 162 if (target_cpu == "arm") { 163 cflags += [ "-DBINDER_IPC_32BIT" ] 164 } 165 166 deps = [ 167 "${bundle_framework_path}/services/bundlemgr:libbms", 168 "//third_party/googletest:gmock_main", 169 "//third_party/googletest:gtest_main", 170 ] 171 172 external_deps = [ 173 "ability_base:base", 174 "ability_base:want", 175 "ability_runtime:ability_manager", 176 "ability_runtime:quickfix_manager", 177 "access_token:libaccesstoken_sdk", 178 "appverify:libhapverify", 179 "bundle_framework:appexecfwk_base", 180 "bundle_framework:appexecfwk_core", 181 "bundle_framework:libappexecfwk_common", 182 "c_utils:utils", 183 "common_event_service:cesfwk_innerkits", 184 "hilog:libhilog", 185 "init:libbegetutil", 186 "ipc:ipc_core", 187 "kv_store:distributeddata_inner", 188 "os_account:os_account_innerkits", 189 "samgr:samgr_proxy", 190 ] 191 192 external_deps += bm_install_external_deps 193} 194 195group("moduletest") { 196 testonly = true 197 198 deps = [ 199 ":bm_command_dump_module_test", 200 ":bm_command_install_module_test", 201 ":bm_command_uninstall_module_test", 202 ] 203} 204