// This version of backend will crash in the end
// it is used for recovery testcase
int main(const int argc, char* argv[]) {
- int index = -1;
- int backend_argc = argc;
- std::string step_name;
- bool remove_plugins = false;
- smoke_test::CrashStepType type = smoke_test::CrashStepType::PROCESS;
+ 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-2], "-idx")) {
- index = atoi(argv[backend_argc-1]);
- backend_argc -= 2;
- LOG(DEBUG) << "Step crash after " << index << " step.";
- }
+ if (!strcmp(argv[backend_argc-2], "-idx")) {
+ index = atoi(argv[backend_argc-1]);
+ backend_argc -= 2;
+ LOG(DEBUG) << "Step crash after " << index << " step.";
+ }
- if (!strcmp(argv[backend_argc-2], "-step_name")) {
- step_name = argv[backend_argc-1];
- backend_argc -= 2;
- LOG(DEBUG) << "Step crash after " << step_name << " step.";
- }
+ if (!strcmp(argv[backend_argc-2], "-step_name")) {
+ step_name = argv[backend_argc-1];
+ backend_argc -= 2;
+ 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";
- }
+ if (!strcmp(argv[backend_argc-1], "-remove_plugin_steps")) {
+ backend_argc--;
+ remove_plugins = true;
+ LOG(DEBUG) << "Remove parser plugins steps";
+ }
- if (!strcmp(argv[backend_argc-1], "-type_clean")) {
- backend_argc--;
- type = smoke_test::CrashStepType::CLEAN;
- LOG(DEBUG) << "step will be crashed in clean operation";
- }
+ if (!strcmp(argv[backend_argc-1], "-type_clean")) {
+ backend_argc--;
+ type = smoke_test::CrashStepType::CLEAN;
+ LOG(DEBUG) << "step will be crashed in clean operation";
+ }
- ci::PkgmgrInstaller pkgmgr_installer;
- tpk::TpkAppQueryInterface interface;
- ci::PkgMgrPtr pkgmgr = ci::PkgMgrInterface::Create(backend_argc, argv,
- &pkgmgr_installer,
- &interface);
- if (!pkgmgr) {
- LOG(ERROR) << "Failed to create pkgmgr interface";
- return -1;
- }
+ ci::PkgmgrInstaller pkgmgr_installer;
+ tpk::TpkAppQueryInterface interface;
+ ci::PkgMgrPtr pkgmgr = ci::PkgMgrInterface::Create(backend_argc, argv,
+ &pkgmgr_installer,
+ &interface);
+ if (!pkgmgr) {
+ LOG(ERROR) << "Failed to create pkgmgr interface";
+ return -1;
+ }
- if (remove_plugins)
- return RunTpkInstallerWithoutParserPlugins(pkgmgr);
- else
- return RunCrashTpkInstaller(pkgmgr, index, step_name, type);
+ if (remove_plugins)
+ return RunTpkInstallerWithoutParserPlugins(pkgmgr);
+ else
+ return RunCrashTpkInstaller(pkgmgr, index, step_name, type);
+ } catch (...) {
+ std::cout << "Exception occurred during testing" << std::endl;
+ return 1;
+ }
}