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("//foundation/appexecfwk/standard/appexecfwk.gni") 16 17module_output_path = "bundle_tool/tools" 18 19config("tools_bm_config_mock") { 20 include_dirs = [ 21 "${appexecfwk_path}/interfaces/innerkits/appexecfwk_base/include", 22 "${appexecfwk_path}/interfaces/innerkits/appexecfwk_core/include/bundlemgr", 23 "${aafwk_path}/interfaces/innerkits/uri/include", 24 "${aafwk_path}/interfaces/innerkits/want/include", 25 "${aafwk_path}/interfaces/innerkits/want/include/ohos/aafwk/content", 26 "${appexecfwk_path}/interfaces/innerkits/libeventhandler/include", 27 "${appexecfwk_path}/services/bundlemgr/include", 28 "${appexecfwk_path}/tools/test/mock", 29 "//base/security/permission/interfaces/innerkits/permission_standard/permissionsdk/main/cpp/include", 30 "//base/security/appverify/interfaces/innerkits/appverify/include", 31 "//third_party/googletest/googlemock/include", 32 "//third_party/json/single_include", 33 ] 34} 35 36tools_bm_mock_sources = [ 37 "${appexecfwk_path}/tools/test/mock/mock_bundle_installer_host.cpp", 38 "${appexecfwk_path}/tools/test/mock/mock_bundle_mgr_host.cpp", 39] 40 41ohos_unittest("bm_command_dump_test") { 42 module_out_path = module_output_path 43 44 include_dirs = [] 45 46 sources = [ 47 "${appexecfwk_path}/kits/appkit/napi/bundlemgr/bundle_death_recipient.cpp", 48 "${appexecfwk_path}/tools/bm/src/bundle_command.cpp", 49 "${appexecfwk_path}/tools/bm/src/shell_command.cpp", 50 "${appexecfwk_path}/tools/bm/src/status_receiver_impl.cpp", 51 "bm_command_dump_test.cpp", 52 ] 53 sources += tools_bm_mock_sources 54 55 configs = [ 56 "${appexecfwk_path}/tools/bm: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 "${aafwk_path}/services/abilitymgr:abilityms", 67 "${appexecfwk_path}/common:libappexecfwk_common", 68 "${appexecfwk_path}/services/bundlemgr:libbms", 69 "//third_party/googletest:gmock_main", 70 "//third_party/googletest:gtest_main", 71 ] 72 73 external_deps = [ 74 "ability_base:want", 75 "appverify:libhapverify", 76 "bundle_framework:appexecfwk_base", 77 "bundle_framework:appexecfwk_core", 78 "ces_standard:cesfwk_innerkits", 79 "distributeddatamgr:distributeddata_inner", 80 "eventhandler:libeventhandler", 81 "hiviewdfx_hilog_native:libhilog", 82 "ipc:ipc_core", 83 "os_account_standard:os_account_innerkits", 84 "resmgr_standard:global_resmgr", 85 "samgr_standard:samgr_proxy", 86 "startup_l2:syspara", 87 "utils_base:utils", 88 ] 89} 90 91ohos_unittest("bm_command_install_test") { 92 module_out_path = module_output_path 93 94 include_dirs = [] 95 96 sources = [ 97 "${appexecfwk_path}/kits/appkit/napi/bundlemgr/bundle_death_recipient.cpp", 98 "${appexecfwk_path}/tools/bm/src/bundle_command.cpp", 99 "${appexecfwk_path}/tools/bm/src/shell_command.cpp", 100 "${appexecfwk_path}/tools/bm/src/status_receiver_impl.cpp", 101 "bm_command_install_test.cpp", 102 ] 103 sources += tools_bm_mock_sources 104 105 configs = [ 106 "${appexecfwk_path}/tools/bm:tools_bm_config", 107 ":tools_bm_config_mock", 108 ] 109 110 cflags = [] 111 if (target_cpu == "arm") { 112 cflags += [ "-DBINDER_IPC_32BIT" ] 113 } 114 115 deps = [ 116 "${aafwk_path}/services/abilitymgr:abilityms", 117 "${appexecfwk_path}/common:libappexecfwk_common", 118 "${appexecfwk_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 "appverify:libhapverify", 126 "bundle_framework:appexecfwk_base", 127 "bundle_framework:appexecfwk_core", 128 "ces_standard:cesfwk_innerkits", 129 "distributeddatamgr:distributeddata_inner", 130 "eventhandler:libeventhandler", 131 "hiviewdfx_hilog_native:libhilog", 132 "ipc:ipc_core", 133 "os_account_standard:os_account_innerkits", 134 "resmgr_standard:global_resmgr", 135 "samgr_standard:samgr_proxy", 136 "startup_l2:syspara", 137 "utils_base:utils", 138 ] 139} 140 141ohos_unittest("bm_command_test") { 142 module_out_path = module_output_path 143 144 include_dirs = [] 145 146 sources = [ 147 "${appexecfwk_path}/kits/appkit/napi/bundlemgr/bundle_death_recipient.cpp", 148 "${appexecfwk_path}/tools/bm/src/bundle_command.cpp", 149 "${appexecfwk_path}/tools/bm/src/shell_command.cpp", 150 "${appexecfwk_path}/tools/bm/src/status_receiver_impl.cpp", 151 "bm_command_test.cpp", 152 ] 153 sources += tools_bm_mock_sources 154 155 configs = [ 156 "${appexecfwk_path}/tools/bm:tools_bm_config", 157 ":tools_bm_config_mock", 158 ] 159 160 cflags = [] 161 if (target_cpu == "arm") { 162 cflags += [ "-DBINDER_IPC_32BIT" ] 163 } 164 165 deps = [ 166 "${aafwk_path}/services/abilitymgr:abilityms", 167 "${appexecfwk_path}/common:libappexecfwk_common", 168 "${appexecfwk_path}/services/bundlemgr:libbms", 169 "//third_party/googletest:gmock_main", 170 "//third_party/googletest:gtest_main", 171 ] 172 173 external_deps = [ 174 "ability_base:want", 175 "appverify:libhapverify", 176 "bundle_framework:appexecfwk_base", 177 "bundle_framework:appexecfwk_core", 178 "ces_standard:cesfwk_innerkits", 179 "distributeddatamgr:distributeddata_inner", 180 "eventhandler:libeventhandler", 181 "hiviewdfx_hilog_native:libhilog", 182 "ipc:ipc_core", 183 "os_account_standard:os_account_innerkits", 184 "resmgr_standard:global_resmgr", 185 "samgr_standard:samgr_proxy", 186 "startup_l2:syspara", 187 "utils_base:utils", 188 ] 189} 190 191ohos_unittest("bm_command_uninstall_test") { 192 module_out_path = module_output_path 193 194 include_dirs = [] 195 196 sources = [ 197 "${appexecfwk_path}/kits/appkit/napi/bundlemgr/bundle_death_recipient.cpp", 198 "${appexecfwk_path}/tools/bm/src/bundle_command.cpp", 199 "${appexecfwk_path}/tools/bm/src/shell_command.cpp", 200 "${appexecfwk_path}/tools/bm/src/status_receiver_impl.cpp", 201 "bm_command_uninstall_test.cpp", 202 ] 203 sources += tools_bm_mock_sources 204 205 configs = [ 206 "${appexecfwk_path}/tools/bm:tools_bm_config", 207 ":tools_bm_config_mock", 208 ] 209 210 cflags = [] 211 if (target_cpu == "arm") { 212 cflags += [ "-DBINDER_IPC_32BIT" ] 213 } 214 215 deps = [ 216 "${aafwk_path}/services/abilitymgr:abilityms", 217 "${appexecfwk_path}/common:libappexecfwk_common", 218 "${appexecfwk_path}/services/bundlemgr:libbms", 219 "//third_party/googletest:gmock_main", 220 "//third_party/googletest:gtest_main", 221 ] 222 223 external_deps = [ 224 "ability_base:want", 225 "appverify:libhapverify", 226 "bundle_framework:appexecfwk_base", 227 "bundle_framework:appexecfwk_core", 228 "ces_standard:cesfwk_innerkits", 229 "distributeddatamgr:distributeddata_inner", 230 "eventhandler:libeventhandler", 231 "hiviewdfx_hilog_native:libhilog", 232 "ipc:ipc_core", 233 "os_account_standard:os_account_innerkits", 234 "resmgr_standard:global_resmgr", 235 "samgr_standard:samgr_proxy", 236 "startup_l2:syspara", 237 "utils_base:utils", 238 ] 239} 240 241group("unittest") { 242 testonly = true 243 244 deps = [ 245 ":bm_command_dump_test", 246 ":bm_command_install_test", 247 ":bm_command_test", 248 ":bm_command_uninstall_test", 249 ] 250} 251