From 523bb6a278450a8c0e5bf1709d623ac1c58098e0 Mon Sep 17 00:00:00 2001 From: ilho kim Date: Thu, 5 Jan 2023 19:58:16 +0900 Subject: [PATCH] Supports the "remove_plugin_steps" option in smoke test This option is for prevent the excution of plugin that can affect the test Change-Id: I759cadb77421e85b9c8beed5c50f3396614358b2 Signed-off-by: ilho kim --- test/smoke_tests/smoke_test_helper.cc | 36 +++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/test/smoke_tests/smoke_test_helper.cc b/test/smoke_tests/smoke_test_helper.cc index 45dbacc..b83d41c 100644 --- a/test/smoke_tests/smoke_test_helper.cc +++ b/test/smoke_tests/smoke_test_helper.cc @@ -11,12 +11,36 @@ namespace ci = common_installer; +static int RunCrashWgtInstaller(ci::PkgMgrPtr pkgmgr, + int index, + std::string step_name, + smoke_test::CrashStepType type) { + smoke_test::CrashWgtInstaller t(pkgmgr, index, step_name, type); + + if (t.Run() != ci::AppInstaller::Result::OK) { + LOG(ERROR) << "CrashWgtInstaller run failure"; + return 1; + } + return 0; +} + +static int RunWgtInstallerWithoutParserPlugins(ci::PkgMgrPtr pkgmgr) { + smoke_test::WgtInstallerWithoutPasrserPlugins t(pkgmgr); + + if (t.Run() != ci::AppInstaller::Result::OK) { + LOG(ERROR) << "WgtInstallerWithoutPasrserPlugins run failure"; + return 1; + } + return 0; +} + // this main of test binay in done purely for recovery smoke test. int main(int argc, char** argv) { try { int index = -1; int backend_argc = argc; std::string step_name; + bool remove_plugins = false; smoke_test::CrashStepType type = smoke_test::CrashStepType::PROCESS; if (!strcmp(argv[backend_argc - 1], "-type_clean")) { @@ -37,6 +61,12 @@ int main(int argc, char** argv) { LOG(DEBUG) << "Step crash after " << step_name << " step."; } + if (!strcmp(argv[backend_argc-1], "-remove_plugin_steps")) { + backend_argc--; + remove_plugins = true; + LOG(DEBUG) << "Remove parser plugins steps"; + } + ci::PkgmgrInstaller pkgmgr_installer; std::shared_ptr query_interface( new wgt::WgtAppQueryInterface()); @@ -47,8 +77,10 @@ int main(int argc, char** argv) { return EINVAL; } - smoke_test::CrashWgtInstaller installer(pkgmgr, index, step_name, type); - return (installer.Run() == ci::AppInstaller::Result::OK) ? 0 : 1; + if (remove_plugins) + return RunWgtInstallerWithoutParserPlugins(pkgmgr); + else + return RunCrashWgtInstaller(pkgmgr, index, step_name, type); } catch (...) { std::cout << "Exception occurred during testing" << std::endl; return 1; -- 2.7.4