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 "${appexecfwk_path}/services/bundlemgr/include/installd", 22 "${appexecfwk_path}/services/bundlemgr/include", 23 "${appexecfwk_path}/services/bundlemgr/include/sandbox_app", 24 "//foundation/systemabilitymgr/safwk/services/safwk/include", 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 "${appexecfwk_path}/common:libappexecfwk_common", 62 "${appexecfwk_path}/services/bundlemgr:libbms", 63 "//third_party/googletest:gmock_main", 64 "//third_party/googletest:gtest_main", 65 ] 66 67 external_deps = [ 68 "ability_base:base", 69 "ability_base:want", 70 "ability_runtime:quickfix_manager", 71 "bundle_framework:appexecfwk_base", 72 "bundle_framework:appexecfwk_core", 73 "c_utils:utils", 74 "common_event_service:cesfwk_innerkits", 75 "hiviewdfx_hilog_native:libhilog", 76 "init:libbegetutil", 77 "ipc:ipc_core", 78 "kv_store:distributeddata_inner", 79 "os_account:os_account_innerkits", 80 "resource_management:global_resmgr", 81 "samgr:samgr_proxy", 82 ] 83} 84 85ohos_moduletest("bm_command_install_module_test") { 86 module_out_path = module_output_path 87 88 sources = [ 89 "${bundletool_path}/src/bundle_command.cpp", 90 "${bundletool_path}/src/bundle_command_common.cpp", 91 "${bundletool_path}/src/quick_fix_command.cpp", 92 "${bundletool_path}/src/shell_command.cpp", 93 "${bundletool_path}/src/status_receiver_impl.cpp", 94 "${kits_path}/js/bundlemgr/bundle_death_recipient.cpp", 95 "bm_command_install_module_test.cpp", 96 ] 97 sources += tools_bm_mock_sources 98 99 configs = [ 100 "${bundletool_path}:tools_bm_config", 101 "${bundletool_test_path}/unittest/bm:tools_bm_config_mock", 102 ] 103 104 cflags = [] 105 if (target_cpu == "arm") { 106 cflags += [ "-DBINDER_IPC_32BIT" ] 107 } 108 109 deps = [ 110 "${appexecfwk_path}/common:libappexecfwk_common", 111 "${appexecfwk_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 "bundle_framework:appexecfwk_base", 121 "bundle_framework:appexecfwk_core", 122 "c_utils:utils", 123 "common_event_service:cesfwk_innerkits", 124 "hiviewdfx_hilog_native:libhilog", 125 "init:libbegetutil", 126 "ipc:ipc_core", 127 "kv_store:distributeddata_inner", 128 "os_account:os_account_innerkits", 129 "resource_management:global_resmgr", 130 "samgr:samgr_proxy", 131 ] 132} 133 134ohos_moduletest("bm_command_uninstall_module_test") { 135 module_out_path = module_output_path 136 137 sources = [ 138 "${bundletool_path}/src/bundle_command.cpp", 139 "${bundletool_path}/src/bundle_command_common.cpp", 140 "${bundletool_path}/src/quick_fix_command.cpp", 141 "${bundletool_path}/src/shell_command.cpp", 142 "${bundletool_path}/src/status_receiver_impl.cpp", 143 "${kits_path}/js/bundlemgr/bundle_death_recipient.cpp", 144 "bm_command_uninstall_module_test.cpp", 145 ] 146 sources += tools_bm_mock_sources 147 148 configs = [ 149 "${bundletool_path}:tools_bm_config", 150 "${bundletool_test_path}/unittest/bm:tools_bm_config_mock", 151 ] 152 153 cflags = [] 154 if (target_cpu == "arm") { 155 cflags += [ "-DBINDER_IPC_32BIT" ] 156 } 157 158 deps = [ 159 "${appexecfwk_path}/common:libappexecfwk_common", 160 "${appexecfwk_path}/services/bundlemgr:libbms", 161 "//third_party/googletest:gmock_main", 162 "//third_party/googletest:gtest_main", 163 ] 164 165 external_deps = [ 166 "ability_base:base", 167 "ability_base:want", 168 "ability_runtime:quickfix_manager", 169 "bundle_framework:appexecfwk_base", 170 "bundle_framework:appexecfwk_core", 171 "c_utils:utils", 172 "common_event_service:cesfwk_innerkits", 173 "hiviewdfx_hilog_native:libhilog", 174 "init:libbegetutil", 175 "ipc:ipc_core", 176 "kv_store:distributeddata_inner", 177 "os_account:os_account_innerkits", 178 "resource_management:global_resmgr", 179 "samgr:samgr_proxy", 180 ] 181} 182 183group("moduletest") { 184 testonly = true 185 186 deps = [ 187 ":bm_command_dump_module_test", 188 ":bm_command_install_module_test", 189 ":bm_command_uninstall_module_test", 190 ] 191} 192