Make smoke utils as a library 04/228604/5
authorSangyoon Jang <jeremy.jang@samsung.com>
Tue, 24 Mar 2020 06:18:09 +0000 (15:18 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Fri, 17 Apr 2020 03:22:57 +0000 (03:22 +0000)
This tpk-smoke-utils library is used at smoke test of unified-installer.

Requires:
 - https://review.tizen.org/gerrit/c/platform/core/appfw/app-installers/+/228720

Change-Id: I342c1827141c3331459a2d752c133aa86ee408dd
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
CMakeLists.txt
packaging/tpk-backend.spec
src/unit_tests/CMakeLists.txt
src/unit_tests/extensive_smoke_test.cc
src/unit_tests/recovery_test.cc
src/unit_tests/smoke_test.cc
src/unit_tests/smoke_utils.cc [deleted file]
src/unit_tests/smoke_utils.h [deleted file]
src/unit_tests/tpk_smoke_utils.cc [new file with mode: 0644]
src/unit_tests/tpk_smoke_utils.h [new file with mode: 0644]

index ce42c94e273683d6e0b7c244ae44650585c094e8..6c01650008190c995c3fcfeb737b723d11412bcd 100644 (file)
@@ -34,6 +34,7 @@ SET(TARGET_SMOKE_TEST_EXTENSIVE "extensive-smoke-test")
 SET(TARGET_SMOKE_TEST_HELPER "smoke-test-helper")
 SET(TARGET_MANIFEST_TEST "manifest-test")
 SET(TARGET_RECOVERY_TEST "recovery-test")
+SET(TARGET_TPK_SMOKE_UTILS "tpk-smoke-utils")
 
 ADD_DEFINITIONS("-DPROJECT_TAG=\"TPK_BACKEND\"")
 
index c3952fd183e5a78035db42ac0e7859c4166a26bf..3fb2a7eb9702104fc55c7acb3bfc934a71cdea60 100644 (file)
@@ -99,6 +99,8 @@ ln -s %{_bindir}/tpk-backend %{buildroot}%{_sysconfdir}/package-manager/backend/
 %manifest tpk-installer-tests.manifest
 %{_bindir}/tpk-installer-ut/*
 %{_datadir}/tpk-installer-ut/*
+%{_libdir}/libtpk-smoke-utils.so*
+%{_includedir}/app-installers/unit_tests/tpk_smoke_utils.h
 
 %changelog
 * Thu Dec 18 2015 Pawel Sikorski <p.sikorski@samsung.com> 0.1-1
index 759fe06246f9018560b69f95d96fef4dfbdfaa45..204ddb8cb2ea6e37c4ab94db7c475268c6947e5a 100644 (file)
@@ -4,14 +4,10 @@ SET(TARGET_SMOKE_UTILS smoke-utils)
 # Executables
 ADD_EXECUTABLE(${TARGET_SMOKE_TEST}
   smoke_test.cc
-  smoke_utils.h
-  smoke_utils.cc
 )
 
 ADD_EXECUTABLE(${TARGET_SMOKE_TEST_EXTENSIVE}
   extensive_smoke_test.cc
-  smoke_utils.h
-  smoke_utils.cc
 )
 
 ADD_EXECUTABLE(${TARGET_SMOKE_TEST_HELPER}
@@ -29,8 +25,10 @@ ADD_EXECUTABLE(${TARGET_MANIFEST_TEST}
 
 ADD_EXECUTABLE(${TARGET_RECOVERY_TEST}
   recovery_test.cc
-  smoke_utils.h
-  smoke_utils.cc
+)
+
+ADD_LIBRARY(${TARGET_TPK_SMOKE_UTILS} SHARED
+  tpk_smoke_utils.cc
 )
 
 TARGET_INCLUDE_DIRECTORIES(${TARGET_SMOKE_TEST} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../)
@@ -45,13 +43,11 @@ APPLY_PKG_CONFIG(${TARGET_SMOKE_TEST} PUBLIC
   Boost
   GTEST
   GUM_DEPS
-  VCONF_DEPS
 )
 APPLY_PKG_CONFIG(${TARGET_SMOKE_TEST_EXTENSIVE} PUBLIC
   Boost
   GTEST
   GUM_DEPS
-  VCONF_DEPS
 )
 APPLY_PKG_CONFIG(${TARGET_MANIFEST_TEST} PUBLIC
   Boost
@@ -61,20 +57,22 @@ APPLY_PKG_CONFIG(${TARGET_RECOVERY_TEST} PUBLIC
   Boost
   GTEST
   GUM_DEPS
-  VCONF_DEPS
 )
 
 # FindGTest module do not sets all needed libraries in GTEST_LIBRARIES and
 # GTest main libraries is still missing, so additional linking of
 # GTEST_MAIN_LIBRARIES is needed.
-TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST} PRIVATE ${TARGET_LIBNAME_TPK} ${GTEST_MAIN_LIBRARIES} ${TARGET_SMOKE_UTILS})
-TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST_EXTENSIVE} PRIVATE ${TARGET_LIBNAME_TPK} ${GTEST_MAIN_LIBRARIES} ${TARGET_SMOKE_UTILS})
+TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST} PRIVATE ${TARGET_LIBNAME_TPK} ${GTEST_MAIN_LIBRARIES} ${TARGET_SMOKE_UTILS} ${TARGET_TPK_SMOKE_UTILS})
+TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST_EXTENSIVE} PRIVATE ${TARGET_LIBNAME_TPK} ${GTEST_MAIN_LIBRARIES} ${TARGET_SMOKE_UTILS} ${TARGET_TPK_SMOKE_UTILS})
 TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST_HELPER} PRIVATE ${TARGET_LIBNAME_TPK})
 TARGET_LINK_LIBRARIES(${TARGET_MANIFEST_TEST} PRIVATE ${TARGET_LIBNAME_TPK} ${GTEST_MAIN_LIBRARIES})
-TARGET_LINK_LIBRARIES(${TARGET_RECOVERY_TEST} PRIVATE ${TARGET_LIBNAME_TPK} ${GTEST_MAIN_LIBRARIES} ${TARGET_SMOKE_UTILS})
+TARGET_LINK_LIBRARIES(${TARGET_RECOVERY_TEST} PRIVATE ${TARGET_LIBNAME_TPK} ${GTEST_MAIN_LIBRARIES} ${TARGET_SMOKE_UTILS} ${TARGET_TPK_SMOKE_UTILS})
+TARGET_LINK_LIBRARIES(${TARGET_TPK_SMOKE_UTILS} PRIVATE ${TARGET_LIBNAME_TPK} ${TARGET_SMOKE_UTILS})
 
 INSTALL(TARGETS ${TARGET_SMOKE_TEST} DESTINATION ${BINDIR}/${DESTINATION_DIR})
 INSTALL(TARGETS ${TARGET_SMOKE_TEST_EXTENSIVE} DESTINATION ${BINDIR}/${DESTINATION_DIR})
 INSTALL(TARGETS ${TARGET_SMOKE_TEST_HELPER} DESTINATION ${BINDIR}/${DESTINATION_DIR})
 INSTALL(TARGETS ${TARGET_MANIFEST_TEST} DESTINATION ${BINDIR}/${DESTINATION_DIR})
 INSTALL(TARGETS ${TARGET_RECOVERY_TEST} DESTINATION ${BINDIR}/${DESTINATION_DIR})
+INSTALL(TARGETS ${TARGET_TPK_SMOKE_UTILS} DESTINATION ${LIB_INSTALL_DIR})
+INSTALL(FILES tpk_smoke_utils.h DESTINATION ${INCLUDEDIR}/app-installers/unit_tests/)
index 7d6afdb19a4867abb153627df9eab96e1314cb52..d0425134d2cd12fb1c4b15416c83c9ad78e6169d 100644 (file)
@@ -10,7 +10,7 @@
 #include <gtest/gtest.h>
 #include <gtest/gtest-death-test.h>
 
-#include "unit_tests/smoke_utils.h"
+#include "unit_tests/tpk_smoke_utils.h"
 
 namespace bpo = boost::program_options;
 namespace ci = common_installer;
index 2cbcefcef4dcd2551352db2c0689cd5434232314..eb5bf0907d97702edecb28910cf6180f8c3c7a32 100644 (file)
@@ -14,7 +14,7 @@
 #include <string>
 #include <vector>
 
-#include "unit_tests/smoke_utils.h"
+#include "unit_tests/tpk_smoke_utils.h"
 
 namespace bf = boost::filesystem;
 namespace bpo = boost::program_options;
index 95a044b41803f76a2cfa52ee2c852b31311a6171..2923e7f735249f7b162bfcb2fa591d5fb93cc50e 100644 (file)
@@ -13,7 +13,7 @@
 #include <gtest/gtest.h>
 #include <gtest/gtest-death-test.h>
 
-#include "unit_tests/smoke_utils.h"
+#include "unit_tests/tpk_smoke_utils.h"
 
 namespace st = smoke_test;
 namespace bf = boost::filesystem;
diff --git a/src/unit_tests/smoke_utils.cc b/src/unit_tests/smoke_utils.cc
deleted file mode 100644 (file)
index 256f1d7..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by an apache-2.0 license that can be
-// found in the LICENSE file.
-
-#include <unit_tests/common/smoke_utils.h>
-
-#include <string>
-#include <utility>
-
-#include "tpk/tpk_installer.h"
-
-#include "unit_tests/smoke_utils.h"
-
-namespace ci = common_installer;
-namespace st = smoke_test;
-
-namespace smoke_test {
-
-const bf::path kSmokePackagesDirectory =
-    "/usr/share/tpk-installer-ut/test_samples/smoke/";
-
-bool ValidatePackage(const std::string& pkgid,
-    const std::pair<std::string, std::string>& app,
-    const TestParameters& params) {
-  return ValidatePackage(pkgid, Apps{ app }, params);
-}
-
-bool ValidateExternalPackage(const std::string& pkgid,
-    const std::pair<std::string, std::string>& app,
-    const TestParameters& params) {
-  return ValidateExternalPackage(pkgid, Apps{ app }, params);
-}
-
-bool ValidateExtendedPackage(const std::string& pkgid,
-    const std::pair<std::string, std::string>& app,
-    const TestParameters& params) {
-  return ValidateExtendedPackage(pkgid, Apps{ app }, params);
-}
-
-TpkBackendInterface::AppQueryInterfacePtr
-TpkBackendInterface::CreateQueryInterface() const {
-  return AppQueryInterfacePtr(new tpk::TpkAppQueryInterface());
-}
-
-TpkBackendInterface::AppInstallerPtr
-TpkBackendInterface::CreateInstaller(
-    ci::PkgMgrPtr pkgmgr) const {
-  return AppInstallerPtr(new tpk::TpkInstaller(pkgmgr));
-}
-
-TpkBackendInterface::AppInstallerPtr
-TpkBackendInterface::CreateFailExpectedInstaller(
-    ci::PkgMgrPtr pkgmgr, int fail_at) const {
-  return AppInstallerPtr(new FailExpectedTpkInstaller(pkgmgr, fail_at));
-}
-
-TpkBackendInterface::CommandResult
-TpkBackendInterface::InstallWithTEP(
-    const bf::path& path, const bf::path& tep) const {
-  const char* argv[] = {"", "-i", path.c_str(), "-u", uid_str_.c_str(),
-                        "-e", tep.c_str()};
-  return CallBackend(SIZEOFARRAY(argv), argv);
-}
-
-TpkBackendInterface::CommandResult
-TpkBackendInterface::MountInstallWithTEP(
-    const bf::path& path, const bf::path& tep) const {
-  const char* argv[] = {"", "-w", path.c_str(), "-u", uid_str_.c_str(),
-                        "-e", tep.c_str()};
-  return CallBackend(SIZEOFARRAY(argv), argv);
-}
-
-TpkBackendInterface::CommandResult
-TpkBackendInterface::InstallSuccessWithTEP(
-    const bf::path& path, const bf::path& tep) const {
-  RequestResult tmp_mode = mode_;
-  RequestResult &original_mode = const_cast<RequestResult&>(mode_);
-  original_mode = RequestResult::NORMAL;
-  if (InstallWithTEP(path, tep) != BackendInterface::CommandResult::OK) {
-    LOG(ERROR) << "Failed to install application with tep. Cannot update";
-    return BackendInterface::CommandResult::UNKNOWN;
-  }
-  original_mode = tmp_mode;
-  return BackendInterface::CommandResult::OK;
-}
-
-TpkBackendInterface::CommandResult
-TpkBackendInterface::MountInstallSuccessWithTEP(
-    const bf::path& path, const bf::path& tep) const {
-  RequestResult tmp_mode = mode_;
-  RequestResult &original_mode = const_cast<RequestResult&>(mode_);
-  original_mode = RequestResult::NORMAL;
-  if (MountInstallWithTEP(path, tep) != BackendInterface::CommandResult::OK) {
-    LOG(ERROR) << "Failed to mount install application with tep. Cannot update";
-    return BackendInterface::CommandResult::UNKNOWN;
-  }
-  original_mode = tmp_mode;
-  return BackendInterface::CommandResult::OK;
-}
-
-}  // namespace smoke_test
diff --git a/src/unit_tests/smoke_utils.h b/src/unit_tests/smoke_utils.h
deleted file mode 100644 (file)
index db77228..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by an apache-2.0 license that can be
-// found in the LICENSE file.
-
-#ifndef UNIT_TESTS_SMOKE_UTILS_H_
-#define UNIT_TESTS_SMOKE_UTILS_H_
-
-#include <common/app_installer.h>
-#include <common/pkgmgr_interface.h>
-#include <common/step/configuration/step_fail.h>
-#include <unit_tests/common/smoke_utils.h>
-
-#include <memory>
-#include <string>
-#include <utility>
-
-#include "tpk/tpk_app_query_interface.h"
-#include "tpk/tpk_installer.h"
-
-namespace smoke_test {
-
-extern const bf::path kSmokePackagesDirectory;
-
-bool ValidatePackage(const std::string& pkgid,
-    const std::pair<std::string, std::string>& app,
-    const TestParameters& params);
-
-bool ValidateExternalPackage(const std::string& pkgid,
-    const std::pair<std::string, std::string>& app,
-    const TestParameters& params);
-
-bool ValidateExtendedPackage(const std::string& pkgid,
-    const std::pair<std::string, std::string>& app,
-    const TestParameters& params);
-
-class TpkBackendInterface: public BackendInterface {
- public:
-  using BackendInterface::BackendInterface;
-  CommandResult InstallWithTEP(const bf::path& path,
-      const bf::path& tep) const;
-  CommandResult InstallSuccessWithTEP(const bf::path& path,
-      const bf::path& tep) const;
-  CommandResult MountInstallWithTEP(const bf::path& path,
-      const bf::path& tep) const;
-  CommandResult MountInstallSuccessWithTEP(const bf::path& path,
-      const bf::path& tep) const;
-
- private:
-  AppQueryInterfacePtr CreateQueryInterface() const override;
-  AppInstallerPtr CreateInstaller(
-      common_installer::PkgMgrPtr pkgmgr) const override;
-  AppInstallerPtr CreateFailExpectedInstaller(
-      common_installer::PkgMgrPtr pkgmgr, int fail_at) const override;
-};
-
-class TpkSmokeTestHelperRunner : public SmokeTestHelperRunner {
- private:
-  common_installer::Subprocess CreateSubprocess() const {
-    return common_installer::Subprocess(
-        "/usr/bin/tpk-installer-ut/smoke-test-helper");
-  }
-};
-
-#define OVERRIDE_STEPS_BLOCK(STEPS)                                            \
-  void STEPS() override {                                                      \
-    tpk::TpkInstaller::STEPS();                                                \
-    if (fail_at_ > -1)                                                         \
-      AddStepAtIndex<common_installer::configuration::StepFail>(fail_at_);     \
-    else                                                                       \
-      AddStep<common_installer::configuration::StepFail>();                    \
-  }                                                                            \
-
-class FailExpectedTpkInstaller : public tpk::TpkInstaller {
- public:
-  explicit FailExpectedTpkInstaller(
-      common_installer::PkgMgrPtr pkgmgr, int fail_at)
-      : tpk::TpkInstaller(pkgmgr), fail_at_(fail_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 fail_at_;
-};
-
-}  // namespace smoke_test
-
-
-#endif  // UNIT_TESTS_SMOKE_UTILS_H_
diff --git a/src/unit_tests/tpk_smoke_utils.cc b/src/unit_tests/tpk_smoke_utils.cc
new file mode 100644 (file)
index 0000000..0d56e1d
--- /dev/null
@@ -0,0 +1,101 @@
+// Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by an apache-2.0 license that can be
+// found in the LICENSE file.
+
+#include "unit_tests/tpk_smoke_utils.h"
+
+#include <unit_tests/common/smoke_utils.h>
+
+#include <string>
+#include <utility>
+
+#include "tpk/tpk_installer.h"
+
+namespace ci = common_installer;
+namespace st = smoke_test;
+
+namespace smoke_test {
+
+const bf::path kSmokePackagesDirectory =
+    "/usr/share/tpk-installer-ut/test_samples/smoke/";
+
+bool ValidatePackage(const std::string& pkgid,
+    const std::pair<std::string, std::string>& app,
+    const TestParameters& params) {
+  return ValidatePackage(pkgid, Apps{ app }, params);
+}
+
+bool ValidateExternalPackage(const std::string& pkgid,
+    const std::pair<std::string, std::string>& app,
+    const TestParameters& params) {
+  return ValidateExternalPackage(pkgid, Apps{ app }, params);
+}
+
+bool ValidateExtendedPackage(const std::string& pkgid,
+    const std::pair<std::string, std::string>& app,
+    const TestParameters& params) {
+  return ValidateExtendedPackage(pkgid, Apps{ app }, params);
+}
+
+TpkBackendInterface::AppQueryInterfacePtr
+TpkBackendInterface::CreateQueryInterface() const {
+  return AppQueryInterfacePtr(new tpk::TpkAppQueryInterface());
+}
+
+TpkBackendInterface::AppInstallerPtr
+TpkBackendInterface::CreateInstaller(
+    ci::PkgMgrPtr pkgmgr) const {
+  return AppInstallerPtr(new tpk::TpkInstaller(pkgmgr));
+}
+
+TpkBackendInterface::AppInstallerPtr
+TpkBackendInterface::CreateFailExpectedInstaller(
+    ci::PkgMgrPtr pkgmgr, int fail_at) const {
+  return AppInstallerPtr(new FailExpectedTpkInstaller(pkgmgr, fail_at));
+}
+
+TpkBackendInterface::CommandResult
+TpkBackendInterface::InstallWithTEP(
+    const bf::path& path, const bf::path& tep) const {
+  const char* argv[] = {"", "-i", path.c_str(), "-u", uid_str_.c_str(),
+                        "-e", tep.c_str()};
+  return CallBackend(SIZEOFARRAY(argv), argv);
+}
+
+TpkBackendInterface::CommandResult
+TpkBackendInterface::MountInstallWithTEP(
+    const bf::path& path, const bf::path& tep) const {
+  const char* argv[] = {"", "-w", path.c_str(), "-u", uid_str_.c_str(),
+                        "-e", tep.c_str()};
+  return CallBackend(SIZEOFARRAY(argv), argv);
+}
+
+TpkBackendInterface::CommandResult
+TpkBackendInterface::InstallSuccessWithTEP(
+    const bf::path& path, const bf::path& tep) const {
+  RequestResult tmp_mode = mode_;
+  RequestResult &original_mode = const_cast<RequestResult&>(mode_);
+  original_mode = RequestResult::NORMAL;
+  if (InstallWithTEP(path, tep) != BackendInterface::CommandResult::OK) {
+    LOG(ERROR) << "Failed to install application with tep. Cannot update";
+    return BackendInterface::CommandResult::UNKNOWN;
+  }
+  original_mode = tmp_mode;
+  return BackendInterface::CommandResult::OK;
+}
+
+TpkBackendInterface::CommandResult
+TpkBackendInterface::MountInstallSuccessWithTEP(
+    const bf::path& path, const bf::path& tep) const {
+  RequestResult tmp_mode = mode_;
+  RequestResult &original_mode = const_cast<RequestResult&>(mode_);
+  original_mode = RequestResult::NORMAL;
+  if (MountInstallWithTEP(path, tep) != BackendInterface::CommandResult::OK) {
+    LOG(ERROR) << "Failed to mount install application with tep. Cannot update";
+    return BackendInterface::CommandResult::UNKNOWN;
+  }
+  original_mode = tmp_mode;
+  return BackendInterface::CommandResult::OK;
+}
+
+}  // namespace smoke_test
diff --git a/src/unit_tests/tpk_smoke_utils.h b/src/unit_tests/tpk_smoke_utils.h
new file mode 100644 (file)
index 0000000..aeaa259
--- /dev/null
@@ -0,0 +1,109 @@
+// Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by an apache-2.0 license that can be
+// found in the LICENSE file.
+
+#ifndef UNIT_TESTS_TPK_SMOKE_UTILS_H_
+#define UNIT_TESTS_TPK_SMOKE_UTILS_H_
+
+#include <common/app_installer.h>
+#include <common/pkgmgr_interface.h>
+#include <common/step/configuration/step_fail.h>
+#include <unit_tests/common/smoke_utils.h>
+
+#include <memory>
+#include <string>
+#include <utility>
+
+#include "tpk/tpk_app_query_interface.h"
+#include "tpk/tpk_installer.h"
+
+namespace smoke_test {
+
+extern const bf::path kSmokePackagesDirectory;
+
+bool ValidatePackage(const std::string& pkgid,
+    const std::pair<std::string, std::string>& app,
+    const TestParameters& params);
+
+bool ValidateExternalPackage(const std::string& pkgid,
+    const std::pair<std::string, std::string>& app,
+    const TestParameters& params);
+
+bool ValidateExtendedPackage(const std::string& pkgid,
+    const std::pair<std::string, std::string>& app,
+    const TestParameters& params);
+
+class TpkBackendInterface: public BackendInterface {
+ public:
+  using BackendInterface::BackendInterface;
+  CommandResult InstallWithTEP(const bf::path& path,
+      const bf::path& tep) const;
+  CommandResult InstallSuccessWithTEP(const bf::path& path,
+      const bf::path& tep) const;
+  CommandResult MountInstallWithTEP(const bf::path& path,
+      const bf::path& tep) const;
+  CommandResult MountInstallSuccessWithTEP(const bf::path& path,
+      const bf::path& tep) const;
+
+  AppQueryInterfacePtr CreateQueryInterface() const override;
+  AppInstallerPtr CreateInstaller(
+      common_installer::PkgMgrPtr pkgmgr) const override;
+  AppInstallerPtr CreateFailExpectedInstaller(
+      common_installer::PkgMgrPtr pkgmgr, int fail_at) const override;
+};
+
+class TpkSmokeTestHelperRunner : public SmokeTestHelperRunner {
+ private:
+  common_installer::Subprocess CreateSubprocess() const {
+    return common_installer::Subprocess(
+        "/usr/bin/tpk-installer-ut/smoke-test-helper");
+  }
+};
+
+#ifdef OVERRIDE_STEPS_BLOCK
+#undef OVERRIDE_STEPS_BLOCK
+#endif
+#define OVERRIDE_STEPS_BLOCK(STEPS)                                            \
+  void STEPS() override {                                                      \
+    tpk::TpkInstaller::STEPS();                                                \
+    if (fail_at_ > -1)                                                         \
+      AddStepAtIndex<common_installer::configuration::StepFail>(fail_at_);     \
+    else                                                                       \
+      AddStep<common_installer::configuration::StepFail>();                    \
+  }                                                                            \
+
+class FailExpectedTpkInstaller : public tpk::TpkInstaller {
+ public:
+  explicit FailExpectedTpkInstaller(
+      common_installer::PkgMgrPtr pkgmgr, int fail_at)
+      : tpk::TpkInstaller(pkgmgr), fail_at_(fail_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 fail_at_;
+};
+
+}  // namespace smoke_test
+
+
+#endif  // UNIT_TESTS_TPK_SMOKE_UTILS_H_