# Copyright (c) 2021-2023 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//build/test.gni") import("../../../bundletool.gni") module_output_path = "bundle_tool/tools" config("tools_bm_config_mock") { include_dirs = [ "${inner_api_path}/appexecfwk_base/include", "${inner_api_path}/appexecfwk_base/include/quick_fix", "${inner_api_path}/appexecfwk_core/include/bundlemgr", "${bundle_framework_path}/services/bundlemgr/include", "${bundle_framework_path}/services/bundlemgr/include/quick_fix", "${bundle_framework_path}/services/bundlemgr/include/rdb", "${bundle_framework_path}/services/bundlemgr/include/sandbox_app", "${bundle_framework_path}/services/bundlemgr/include/shared", "${bundle_framework_path}/services/bundlemgr/include/uninstall_data_mgr", "${bundletool_test_path}/mock", "//third_party/googletest/googlemock/include", "//third_party/json/single_include", ] } tools_bm_mock_sources = [ "${bundletool_test_path}/mock/mock_bundle_installer_host.cpp", "${bundletool_test_path}/mock/mock_bundle_mgr_host.cpp", ] ohos_unittest("bm_command_dump_test") { module_out_path = module_output_path include_dirs = [] sources = [ "${bundletool_path}/src/bundle_command.cpp", "${bundletool_path}/src/bundle_command_common.cpp", "${bundletool_path}/src/quick_fix_command.cpp", "${bundletool_path}/src/quick_fix_status_callback_host_impl.cpp", "${bundletool_path}/src/shell_command.cpp", "${bundletool_path}/src/status_receiver_impl.cpp", "${kits_path}/js/bundlemgr/bundle_death_recipient.cpp", "bm_command_dump_test.cpp", ] sources += tools_bm_mock_sources configs = [ "${bundletool_path}:tools_bm_config", ":tools_bm_config_mock", ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] } deps = [ "${bundle_framework_path}/services/bundlemgr:libbms", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:want", "ability_runtime:app_manager", "ability_runtime:quickfix_manager", "access_token:libaccesstoken_sdk", "appverify:libhapverify", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "bundle_framework:bundle_napi_common", "bundle_framework:libappexecfwk_common", "c_utils:utils", "common_event_service:cesfwk_innerkits", "eventhandler:libeventhandler", "hilog:libhilog", "init:libbegetutil", "ipc:ipc_core", "kv_store:distributeddata_inner", "os_account:os_account_innerkits", "relational_store:native_rdb", "samgr:samgr_proxy", ] external_deps += bm_install_external_deps } ohos_unittest("bm_command_dump_dependencies_test") { module_out_path = module_output_path include_dirs = [] sources = [ "${bundletool_path}/src/bundle_command.cpp", "${bundletool_path}/src/bundle_command_common.cpp", "${bundletool_path}/src/quick_fix_command.cpp", "${bundletool_path}/src/quick_fix_status_callback_host_impl.cpp", "${bundletool_path}/src/shell_command.cpp", "${bundletool_path}/src/status_receiver_impl.cpp", "${kits_path}/js/bundlemgr/bundle_death_recipient.cpp", "bm_command_dump_dependencies_test.cpp", ] sources += tools_bm_mock_sources configs = [ "${bundletool_path}:tools_bm_config", ":tools_bm_config_mock", ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] } deps = [ "${bundle_framework_path}/services/bundlemgr:libbms", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:want", "ability_runtime:app_manager", "ability_runtime:quickfix_manager", "access_token:libaccesstoken_sdk", "appverify:libhapverify", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "bundle_framework:bundle_napi_common", "bundle_framework:libappexecfwk_common", "c_utils:utils", "common_event_service:cesfwk_innerkits", "eventhandler:libeventhandler", "hilog:libhilog", "init:libbegetutil", "ipc:ipc_core", "kv_store:distributeddata_inner", "os_account:os_account_innerkits", "relational_store:native_rdb", "samgr:samgr_proxy", ] external_deps += bm_install_external_deps } ohos_unittest("bm_command_install_test") { module_out_path = module_output_path include_dirs = [] sources = [ "${bundletool_path}/src/bundle_command.cpp", "${bundletool_path}/src/bundle_command_common.cpp", "${bundletool_path}/src/quick_fix_command.cpp", "${bundletool_path}/src/quick_fix_status_callback_host_impl.cpp", "${bundletool_path}/src/shell_command.cpp", "${bundletool_path}/src/status_receiver_impl.cpp", "${kits_path}/js/bundlemgr/bundle_death_recipient.cpp", "bm_command_install_test.cpp", ] sources += tools_bm_mock_sources configs = [ "${bundletool_path}:tools_bm_config", ":tools_bm_config_mock", ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] } deps = [ "${bundle_framework_path}/services/bundlemgr:libbms", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:want", "ability_runtime:app_manager", "ability_runtime:quickfix_manager", "access_token:libaccesstoken_sdk", "appverify:libhapverify", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "bundle_framework:bundle_napi_common", "bundle_framework:libappexecfwk_common", "c_utils:utils", "common_event_service:cesfwk_innerkits", "eventhandler:libeventhandler", "hilog:libhilog", "init:libbegetutil", "ipc:ipc_core", "kv_store:distributeddata_inner", "os_account:os_account_innerkits", "relational_store:native_rdb", "samgr:samgr_proxy", ] external_deps += bm_install_external_deps } ohos_unittest("bm_command_test") { module_out_path = module_output_path include_dirs = [] sources = [ "${bundletool_path}/src/bundle_command.cpp", "${bundletool_path}/src/bundle_command_common.cpp", "${bundletool_path}/src/quick_fix_command.cpp", "${bundletool_path}/src/quick_fix_status_callback_host_impl.cpp", "${bundletool_path}/src/shell_command.cpp", "${bundletool_path}/src/status_receiver_impl.cpp", "${kits_path}/js/bundlemgr/bundle_death_recipient.cpp", "bm_command_test.cpp", ] sources += tools_bm_mock_sources configs = [ "${bundletool_path}:tools_bm_config", ":tools_bm_config_mock", ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] } deps = [ "${bundle_framework_path}/services/bundlemgr:libbms", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:want", "ability_runtime:app_manager", "ability_runtime:quickfix_manager", "access_token:libaccesstoken_sdk", "appverify:libhapverify", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "bundle_framework:bundle_napi_common", "bundle_framework:libappexecfwk_common", "c_utils:utils", "common_event_service:cesfwk_innerkits", "eventhandler:libeventhandler", "hilog:libhilog", "init:libbegetutil", "ipc:ipc_core", "kv_store:distributeddata_inner", "os_account:os_account_innerkits", "relational_store:native_rdb", "samgr:samgr_proxy", ] external_deps += bm_install_external_deps defines = [] if (account_enable_bm) { external_deps += [ "os_account:os_account_innerkits" ] defines += [ "ACCOUNT_ENABLE" ] } } ohos_unittest("bm_command_uninstall_test") { module_out_path = module_output_path include_dirs = [] sources = [ "${bundletool_path}/src/bundle_command.cpp", "${bundletool_path}/src/bundle_command_common.cpp", "${bundletool_path}/src/quick_fix_command.cpp", "${bundletool_path}/src/quick_fix_status_callback_host_impl.cpp", "${bundletool_path}/src/shell_command.cpp", "${bundletool_path}/src/status_receiver_impl.cpp", "${kits_path}/js/bundlemgr/bundle_death_recipient.cpp", "bm_command_uninstall_test.cpp", ] sources += tools_bm_mock_sources configs = [ "${bundletool_path}:tools_bm_config", ":tools_bm_config_mock", ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] } deps = [ "${bundle_framework_path}/services/bundlemgr:libbms", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:want", "ability_runtime:app_manager", "ability_runtime:quickfix_manager", "access_token:libaccesstoken_sdk", "appverify:libhapverify", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "bundle_framework:bundle_napi_common", "bundle_framework:libappexecfwk_common", "c_utils:utils", "common_event_service:cesfwk_innerkits", "eventhandler:libeventhandler", "hilog:libhilog", "init:libbegetutil", "ipc:ipc_core", "kv_store:distributeddata_inner", "os_account:os_account_innerkits", "relational_store:native_rdb", "samgr:samgr_proxy", ] external_deps += bm_install_external_deps } ohos_unittest("bm_command_quickfix_test") { module_out_path = module_output_path include_dirs = [] sources = [ "${bundletool_path}/src/bundle_command.cpp", "${bundletool_path}/src/bundle_command_common.cpp", "${bundletool_path}/src/quick_fix_command.cpp", "${bundletool_path}/src/quick_fix_status_callback_host_impl.cpp", "${bundletool_path}/src/shell_command.cpp", "${bundletool_path}/src/status_receiver_impl.cpp", "${kits_path}/js/bundlemgr/bundle_death_recipient.cpp", "bm_command_quickfix_test.cpp", ] sources += tools_bm_mock_sources configs = [ "${bundletool_path}:tools_bm_config", ":tools_bm_config_mock", ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] } deps = [ "${bundle_framework_path}/services/bundlemgr:libbms", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:want", "ability_runtime:app_manager", "ability_runtime:quickfix_manager", "access_token:libaccesstoken_sdk", "appverify:libhapverify", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "bundle_framework:bundle_napi_common", "bundle_framework:libappexecfwk_common", "c_utils:utils", "common_event_service:cesfwk_innerkits", "eventhandler:libeventhandler", "hilog:libhilog", "init:libbegetutil", "ipc:ipc_core", "kv_store:distributeddata_inner", "os_account:os_account_innerkits", "relational_store:native_rdb", "samgr:samgr_proxy", ] external_deps += bm_install_external_deps } ohos_unittest("bm_command_overlay_test") { module_out_path = module_output_path include_dirs = [] sources = [ "${bundletool_path}/src/bundle_command.cpp", "${bundletool_path}/src/bundle_command_common.cpp", "${bundletool_path}/src/quick_fix_command.cpp", "${bundletool_path}/src/quick_fix_status_callback_host_impl.cpp", "${bundletool_path}/src/shell_command.cpp", "${bundletool_path}/src/status_receiver_impl.cpp", "${kits_path}/js/bundlemgr/bundle_death_recipient.cpp", "bm_command_overlay_test.cpp", ] sources += tools_bm_mock_sources configs = [ "${bundletool_path}:tools_bm_config", ":tools_bm_config_mock", ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] } deps = [ "${bundle_framework_path}/services/bundlemgr:libbms", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:want", "ability_runtime:app_manager", "ability_runtime:quickfix_manager", "access_token:libaccesstoken_sdk", "appverify:libhapverify", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "bundle_framework:bundle_napi_common", "bundle_framework:libappexecfwk_common", "c_utils:utils", "common_event_service:cesfwk_innerkits", "eventhandler:libeventhandler", "hilog:libhilog", "init:libbegetutil", "ipc:ipc_core", "kv_store:distributeddata_inner", "os_account:os_account_innerkits", "relational_store:native_rdb", "samgr:samgr_proxy", ] external_deps += bm_install_external_deps defines = [] if (overlay_install_bm) { defines += [ "BUNDLE_FRAMEWORK_OVERLAY_INSTALLATION" ] } } group("unittest") { testonly = true deps = [ ":bm_command_dump_dependencies_test", ":bm_command_dump_test", ":bm_command_install_test", ":bm_command_overlay_test", ":bm_command_quickfix_test", ":bm_command_test", ":bm_command_uninstall_test", ] }