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