From 04822105b65526314a775b1e7f969673f6d47705 Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Tue, 23 Apr 2019 19:06:30 +0900 Subject: [PATCH] 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: I5d4eff6403f22b2ee081df5e412d073d27827944 Signed-off-by: Sangyoon Jang --- src/unit_tests/smoke_test_helper.cc | 46 ++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/src/unit_tests/smoke_test_helper.cc b/src/unit_tests/smoke_test_helper.cc index d767cdb..8ddf3df 100644 --- a/src/unit_tests/smoke_test_helper.cc +++ b/src/unit_tests/smoke_test_helper.cc @@ -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(crash_at_); \ + else \ + AddStep(); \ + } \ + +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(index); - } else { - installer.AddStep(); - } + ::CrashWgtInstaller installer(pkgmgr, index); return (installer.Run() == ci::AppInstaller::Result::OK) ? 0 : 1; } -- 2.7.4