From: Sangyoon Jang Date: Tue, 23 Apr 2019 07:39:37 +0000 (+0900) Subject: Fix smoke test helper X-Git-Tag: submit/tizen/20190626.013636~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cf53e65efd73a6e0705ee2e6631b8b3998e60b36;p=platform%2Fcore%2Fappfw%2Ftpk-backend.git Fix smoke test helper 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: I8eadd437e8a1a2b20a34fa0a3d7f0cd8b75d0f96 Signed-off-by: Sangyoon Jang --- diff --git a/src/unit_tests/smoke_test_helper.cc b/src/unit_tests/smoke_test_helper.cc index 24c4f0a..d826c9d 100644 --- a/src/unit_tests/smoke_test_helper.cc +++ b/src/unit_tests/smoke_test_helper.cc @@ -30,6 +30,45 @@ class StepCrash : public ci::Step { STEP_NAME(Crash) }; +#define OVERRIDE_STEPS_BLOCK(STEPS) \ + void STEPS() override { \ + tpk::TpkInstaller::STEPS(); \ + if (crash_at_ > -1) \ + AddStepAtIndex(crash_at_); \ + else \ + AddStep(); \ + } \ + +class CrashTpkInstaller : public tpk::TpkInstaller { + public: + explicit CrashTpkInstaller(ci::PkgMgrPtr pkgmgr, int crash_at) + : tpk::TpkInstaller(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 version of backend will crash in the end @@ -53,15 +92,10 @@ int main(const int argc, char* argv[]) { return -1; } - tpk::TpkInstaller t(pkgmgr); - if (index != -1) { - t.AddStepAtIndex(index); - } else { - t.AddStep(); - } + ::CrashTpkInstaller t(pkgmgr, index); if (t.Run() != ci::AppInstaller::Result::OK) { - LOG(ERROR) << "TpkInstaller run failure"; + LOG(ERROR) << "CrashTpkInstaller run failure"; return -1; } return 0;