// this main of test binay in done purely for recovery smoke test.
int main(int argc, char** argv) {
- int index = -1;
- int backend_argc = argc;
- std::string step_name;
- smoke_test::CrashStepType type = smoke_test::CrashStepType::PROCESS;
-
- if (!strcmp(argv[backend_argc - 2], "-idx")) {
- index = atoi(argv[argc - 1]);
- backend_argc -= 2;
- LOG(DEBUG) << "Step crash after " << index << " step.";
+ try {
+ int index = -1;
+ int backend_argc = argc;
+ std::string step_name;
+ smoke_test::CrashStepType type = smoke_test::CrashStepType::PROCESS;
+
+ if (!strcmp(argv[backend_argc - 2], "-idx")) {
+ index = atoi(argv[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 - 1], "-type_clean")) {
+ backend_argc--;
+ type = smoke_test::CrashStepType::CLEAN;
+ LOG(DEBUG) << "step will be crashed in clean operation";
+ }
+
+ ci::PkgmgrInstaller pkgmgr_installer;
+ wgt::WgtAppQueryInterface query_interface;
+ auto pkgmgr = ci::PkgMgrInterface::Create(backend_argc, argv,
+ &pkgmgr_installer, &query_interface);
+ if (!pkgmgr) {
+ LOG(ERROR) << "Options of pkgmgr installer cannot be parsed";
+ return EINVAL;
+ }
+
+ smoke_test::CrashWgtInstaller installer(pkgmgr, index, step_name, type);
+ return (installer.Run() == ci::AppInstaller::Result::OK) ? 0 : 1;
+ } catch (...) {
+ std::cout << "Exception occurred during testing" << std::endl;
+ return 1;
}
-
- 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], "-type_clean")) {
- backend_argc--;
- type = smoke_test::CrashStepType::CLEAN;
- LOG(DEBUG) << "step will be crashed in clean operation";
- }
-
- ci::PkgmgrInstaller pkgmgr_installer;
- wgt::WgtAppQueryInterface query_interface;
- auto pkgmgr = ci::PkgMgrInterface::Create(backend_argc, argv,
- &pkgmgr_installer, &query_interface);
- if (!pkgmgr) {
- LOG(ERROR) << "Options of pkgmgr installer cannot be parsed";
- return EINVAL;
- }
-
- smoke_test::CrashWgtInstaller installer(pkgmgr, index, step_name, type);
- return (installer.Run() == ci::AppInstaller::Result::OK) ? 0 : 1;
}