Fix smoke test helper 76/204376/5
authorSangyoon Jang <jeremy.jang@samsung.com>
Tue, 23 Apr 2019 10:06:30 +0000 (19:06 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Tue, 4 Jun 2019 05:40:39 +0000 (05:40 +0000)
To use custom step, we need to derive a new class.
(refer: https://review.tizen.org/gerrit/c/platform/core/appfw/app-installers/+/203760)

Change-Id: I5d4eff6403f22b2ee081df5e412d073d27827944
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/unit_tests/smoke_test_helper.cc

index d767cdb..8ddf3df 100644 (file)
@@ -27,6 +27,45 @@ class StepCrash : public ci::Step {
   STEP_NAME(Crash)
 };
 
+#define OVERRIDE_STEPS_BLOCK(STEPS)                                            \
+  void STEPS() override {                                                      \
+    wgt::WgtInstaller::STEPS();                                                \
+    if (crash_at_ > -1)                                                        \
+      AddStepAtIndex<StepCrash>(crash_at_);                                    \
+    else                                                                       \
+      AddStep<StepCrash>();                                                    \
+  }                                                                            \
+
+class CrashWgtInstaller : public wgt::WgtInstaller {
+ public:
+  explicit CrashWgtInstaller(ci::PkgMgrPtr pkgmgr, int crash_at)
+      : wgt::WgtInstaller(pkgmgr), crash_at_(crash_at) { }
+
+ private:
+  OVERRIDE_STEPS_BLOCK(InstallSteps)
+  OVERRIDE_STEPS_BLOCK(UpdateSteps)
+  OVERRIDE_STEPS_BLOCK(UninstallSteps)
+  OVERRIDE_STEPS_BLOCK(ReinstallSteps)
+  OVERRIDE_STEPS_BLOCK(DeltaSteps)
+  OVERRIDE_STEPS_BLOCK(MoveSteps)
+  OVERRIDE_STEPS_BLOCK(RecoverySteps)
+  OVERRIDE_STEPS_BLOCK(MountInstallSteps)
+  OVERRIDE_STEPS_BLOCK(MountUpdateSteps)
+  OVERRIDE_STEPS_BLOCK(ManifestDirectInstallSteps)
+  OVERRIDE_STEPS_BLOCK(ManifestDirectUpdateSteps)
+  OVERRIDE_STEPS_BLOCK(ManifestPartialInstallSteps)
+  OVERRIDE_STEPS_BLOCK(ManifestPartialUpdateSteps)
+  OVERRIDE_STEPS_BLOCK(PartialUninstallSteps)
+  OVERRIDE_STEPS_BLOCK(ReadonlyUpdateInstallSteps)
+  OVERRIDE_STEPS_BLOCK(ReadonlyUpdateUninstallSteps)
+  OVERRIDE_STEPS_BLOCK(DisablePkgSteps)
+  OVERRIDE_STEPS_BLOCK(EnablePkgSteps)
+  OVERRIDE_STEPS_BLOCK(MigrateExtImgSteps)
+  OVERRIDE_STEPS_BLOCK(RecoverDBSteps)
+
+  int crash_at_;
+};
+
 }  // namespace
 
 // this main of test binay in done purely for recovery smoke test.
@@ -48,12 +87,7 @@ int main(int argc, char** argv) {
     return EINVAL;
   }
 
-  wgt::WgtInstaller installer(pkgmgr);
-  if (index != -1) {
-    installer.AddStepAtIndex<StepCrash>(index);
-  } else {
-    installer.AddStep<StepCrash>();
-  }
+  ::CrashWgtInstaller installer(pkgmgr, index);
   return (installer.Run() == ci::AppInstaller::Result::OK) ? 0 : 1;
 }