Move unit test location 88/238088/1
authorJunghyun Yeon <jungh.yeon@samsung.com>
Wed, 8 Jul 2020 08:43:01 +0000 (17:43 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Wed, 8 Jul 2020 08:43:01 +0000 (17:43 +0900)
Change-Id: I59c9a77767deddecd230efb378108c21dc2c286c
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
115 files changed:
CMakeLists.txt
src/CMakeLists.txt
src/unit_tests/CMakeLists.txt [deleted file]
src/unit_tests/smoke_test.cc [deleted file]
src/unit_tests/smoke_test_helper.cc [deleted file]
src/unit_tests/smoke_utils.cc [deleted file]
src/unit_tests/smoke_utils.h [deleted file]
src/unit_tests/test_samples/smoke/InstallAndROUpdate_RollbackTpk.tpk [deleted file]
src/unit_tests/test_samples/smoke/InstallAndROUpdate_RollbackWgt.wgt [deleted file]
src/unit_tests/test_samples/smoke/InstallAndROUpdate_RollbackWgt_2.wgt [deleted file]
src/unit_tests/test_samples/smoke/InstallAndROUpdate_Tpk.tpk [deleted file]
src/unit_tests/test_samples/smoke/InstallAndROUpdate_Tpk_2.tpk [deleted file]
src/unit_tests/test_samples/smoke/InstallAndROUpdate_Wgt.wgt [deleted file]
src/unit_tests/test_samples/smoke/InstallAndUpdate_RollbackTpk.tpk [deleted file]
src/unit_tests/test_samples/smoke/InstallAndUpdate_RollbackWgt.wgt [deleted file]
src/unit_tests/test_samples/smoke/InstallAndUpdate_RollbackWgt_2.wgt [deleted file]
src/unit_tests/test_samples/smoke/InstallAndUpdate_Tpk.tpk [deleted file]
src/unit_tests/test_samples/smoke/InstallAndUpdate_Tpk_2.tpk [deleted file]
src/unit_tests/test_samples/smoke/InstallAndUpdate_Wgt.wgt [deleted file]
src/unit_tests/test_samples/smoke/Install_DoubleTpk.tpk [deleted file]
src/unit_tests/test_samples/smoke/Install_DoubleWgt.wgt [deleted file]
src/unit_tests/test_samples/smoke/Install_RollbackTpk.tpk [deleted file]
src/unit_tests/test_samples/smoke/Install_RollbackWgt.wgt [deleted file]
src/unit_tests/test_samples/smoke/Install_SingleTpk.tpk [deleted file]
src/unit_tests/test_samples/smoke/Install_TripleHybrid.wgt [deleted file]
src/unit_tests/test_samples/smoke/Install_TripleTpk.tpk [deleted file]
src/unit_tests/test_samples/smoke/Install_TripleWgt.wgt [deleted file]
src/unit_tests/test_samples/smoke/Recovery_InstallTpk.tpk [deleted file]
src/unit_tests/test_samples/smoke/Recovery_InstallWgt.wgt [deleted file]
src/unit_tests/test_samples/smoke/Recovery_UpdateTpk.tpk [deleted file]
src/unit_tests/test_samples/smoke/Recovery_UpdateTpk_2.tpk [deleted file]
src/unit_tests/test_samples/smoke/Recovery_UpdateWgt.wgt [deleted file]
src/unit_tests/test_samples/smoke/Recovery_UpdateWgt_2.wgt [deleted file]
src/unit_tests/test_samples/smoke/UninstallAndROUpdateUninstall_Tpk.tpk [deleted file]
src/unit_tests/test_samples/smoke/UninstallAndROUpdateUninstall_Tpk_2.tpk [deleted file]
src/unit_tests/test_samples/smoke/UninstallAndROUpdateUninstall_Wgt.wgt [deleted file]
src/unit_tests/test_samples/smoke/Uninstall_DoubleTpk.tpk [deleted file]
src/unit_tests/test_samples/smoke/Uninstall_DoubleWgt.wgt [deleted file]
src/unit_tests/test_samples/smoke/Uninstall_SingleTpk.tpk [deleted file]
src/unit_tests/test_samples/smoke/Uninstall_TripleHybrid.wgt [deleted file]
src/unit_tests/test_samples/smoke/Uninstall_TripleTpk.tpk [deleted file]
src/unit_tests/test_samples/smoke/Uninstall_TripleWgt.wgt [deleted file]
src/unit_tests/test_samples/smoke/Update_DoubleTpk.tpk [deleted file]
src/unit_tests/test_samples/smoke/Update_DoubleTpk_2.tpk [deleted file]
src/unit_tests/test_samples/smoke/Update_DoubleWgt.wgt [deleted file]
src/unit_tests/test_samples/smoke/Update_DoubleWgt_2.wgt [deleted file]
src/unit_tests/test_samples/smoke/Update_RollbackTpk.tpk [deleted file]
src/unit_tests/test_samples/smoke/Update_RollbackTpk_2.tpk [deleted file]
src/unit_tests/test_samples/smoke/Update_RollbackWgt.wgt [deleted file]
src/unit_tests/test_samples/smoke/Update_RollbackWgt_2.wgt [deleted file]
src/unit_tests/test_samples/smoke/Update_SingleTpk.tpk [deleted file]
src/unit_tests/test_samples/smoke/Update_SingleTpk_2.tpk [deleted file]
src/unit_tests/test_samples/smoke/Update_TripleHybrid.wgt [deleted file]
src/unit_tests/test_samples/smoke/Update_TripleHybrid_2.wgt [deleted file]
src/unit_tests/test_samples/smoke/Update_TripleTpk.tpk [deleted file]
src/unit_tests/test_samples/smoke/Update_TripleTpk_2.tpk [deleted file]
src/unit_tests/test_samples/smoke/Update_TripleWgt.wgt [deleted file]
src/unit_tests/test_samples/smoke/Update_TripleWgt_2.wgt [deleted file]
test/CMakeLists.txt [new file with mode: 0644]
test/smoke_test/CMakeLists.txt [new file with mode: 0644]
test/smoke_test/smoke_test.cc [new file with mode: 0644]
test/smoke_test/smoke_test_helper.cc [new file with mode: 0644]
test/smoke_test/smoke_utils.cc [new file with mode: 0644]
test/smoke_test/smoke_utils.h [new file with mode: 0644]
test/smoke_test/test_samples/smoke/InstallAndROUpdate_RollbackTpk.tpk [new file with mode: 0644]
test/smoke_test/test_samples/smoke/InstallAndROUpdate_RollbackWgt.wgt [new file with mode: 0644]
test/smoke_test/test_samples/smoke/InstallAndROUpdate_RollbackWgt_2.wgt [new file with mode: 0644]
test/smoke_test/test_samples/smoke/InstallAndROUpdate_Tpk.tpk [new file with mode: 0644]
test/smoke_test/test_samples/smoke/InstallAndROUpdate_Tpk_2.tpk [new file with mode: 0644]
test/smoke_test/test_samples/smoke/InstallAndROUpdate_Wgt.wgt [new file with mode: 0644]
test/smoke_test/test_samples/smoke/InstallAndUpdate_RollbackTpk.tpk [new file with mode: 0644]
test/smoke_test/test_samples/smoke/InstallAndUpdate_RollbackWgt.wgt [new file with mode: 0644]
test/smoke_test/test_samples/smoke/InstallAndUpdate_RollbackWgt_2.wgt [new file with mode: 0644]
test/smoke_test/test_samples/smoke/InstallAndUpdate_Tpk.tpk [new file with mode: 0644]
test/smoke_test/test_samples/smoke/InstallAndUpdate_Tpk_2.tpk [new file with mode: 0644]
test/smoke_test/test_samples/smoke/InstallAndUpdate_Wgt.wgt [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Install_DoubleTpk.tpk [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Install_DoubleWgt.wgt [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Install_RollbackTpk.tpk [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Install_RollbackWgt.wgt [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Install_SingleTpk.tpk [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Install_TripleHybrid.wgt [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Install_TripleTpk.tpk [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Install_TripleWgt.wgt [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Recovery_InstallTpk.tpk [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Recovery_InstallWgt.wgt [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Recovery_UpdateTpk.tpk [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Recovery_UpdateTpk_2.tpk [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Recovery_UpdateWgt.wgt [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Recovery_UpdateWgt_2.wgt [new file with mode: 0644]
test/smoke_test/test_samples/smoke/UninstallAndROUpdateUninstall_Tpk.tpk [new file with mode: 0644]
test/smoke_test/test_samples/smoke/UninstallAndROUpdateUninstall_Tpk_2.tpk [new file with mode: 0644]
test/smoke_test/test_samples/smoke/UninstallAndROUpdateUninstall_Wgt.wgt [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Uninstall_DoubleTpk.tpk [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Uninstall_DoubleWgt.wgt [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Uninstall_SingleTpk.tpk [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Uninstall_TripleHybrid.wgt [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Uninstall_TripleTpk.tpk [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Uninstall_TripleWgt.wgt [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Update_DoubleTpk.tpk [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Update_DoubleTpk_2.tpk [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Update_DoubleWgt.wgt [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Update_DoubleWgt_2.wgt [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Update_RollbackTpk.tpk [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Update_RollbackTpk_2.tpk [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Update_RollbackWgt.wgt [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Update_RollbackWgt_2.wgt [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Update_SingleTpk.tpk [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Update_SingleTpk_2.tpk [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Update_TripleHybrid.wgt [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Update_TripleHybrid_2.wgt [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Update_TripleTpk.tpk [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Update_TripleTpk_2.tpk [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Update_TripleWgt.wgt [new file with mode: 0644]
test/smoke_test/test_samples/smoke/Update_TripleWgt_2.wgt [new file with mode: 0644]

index 613d04f89273a3b7ba744d200adf23c9e8a8a681..e7192ad72ba816115f94f55e6107200c186e07e5 100644 (file)
@@ -51,3 +51,4 @@ FIND_PACKAGE(Boost REQUIRED COMPONENTS system filesystem regex program_options)
 FIND_PACKAGE(GTest REQUIRED)
 
 ADD_SUBDIRECTORY(src)
+ADD_SUBDIRECTORY(test)
index 52efa6fae04857051303841fea371778c64cb907..a91f32fe7ee0a304f25b8e78ffe6143c2f846dec 100644 (file)
@@ -1,2 +1 @@
 ADD_SUBDIRECTORY(unified)
-ADD_SUBDIRECTORY(unit_tests)
diff --git a/src/unit_tests/CMakeLists.txt b/src/unit_tests/CMakeLists.txt
deleted file mode 100644 (file)
index 3536cdc..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-SET(DESTINATION_DIR unified-installer-ut)
-SET(TARGET_SMOKE_UTILS smoke-utils)
-SET(TARGET_TPK_SMOKE_UTILS tpk-smoke-utils)
-SET(TARGET_WGT_SMOKE_UTILS wgt-smoke-utils)
-
-# Executables
-ADD_EXECUTABLE(${TARGET_SMOKE_TEST}
-  smoke_test.cc
-  smoke_utils.h
-  smoke_utils.cc
-)
-
-ADD_EXECUTABLE(${TARGET_SMOKE_TEST_HELPER}
-  smoke_test_helper.cc
-)
-
-TARGET_INCLUDE_DIRECTORIES(${TARGET_SMOKE_TEST} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../)
-TARGET_INCLUDE_DIRECTORIES(${TARGET_SMOKE_TEST_HELPER} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../)
-
-INSTALL(DIRECTORY test_samples/ DESTINATION ${SHAREDIR}/${DESTINATION_DIR}/test_samples)
-
-APPLY_PKG_CONFIG(${TARGET_SMOKE_TEST} PUBLIC
-  Boost
-  GTEST
-  GUM_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_UNIFIED} ${GTEST_MAIN_LIBRARIES} ${TARGET_SMOKE_UTILS} ${TARGET_TPK_SMOKE_UTILS} ${TARGET_WGT_SMOKE_UTILS})
-TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST_HELPER} PRIVATE ${TARGET_LIBNAME_UNIFIED} ${TARGET_TPK_SMOKE_UTILS} ${TARGET_WGT_SMOKE_UTILS})
-
-INSTALL(TARGETS ${TARGET_SMOKE_TEST} DESTINATION ${BINDIR}/${DESTINATION_DIR})
-INSTALL(TARGETS ${TARGET_SMOKE_TEST_HELPER} DESTINATION ${BINDIR}/${DESTINATION_DIR})
diff --git a/src/unit_tests/smoke_test.cc b/src/unit_tests/smoke_test.cc
deleted file mode 100644 (file)
index 8aec51a..0000000
+++ /dev/null
@@ -1,646 +0,0 @@
-// Copyright (c) 2020 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 <common/utils/subprocess.h>
-
-#include <gtest/gtest.h>
-#include <gtest/gtest-death-test.h>
-
-#include "unit_tests/smoke_utils.h"
-
-namespace ci = common_installer;
-
-namespace smoke_test {
-
-class SmokeEnvironment : public testing::Environment {
- public:
-  explicit SmokeEnvironment(ci::RequestMode mode) : request_mode_(mode) { }
-
-  void SetUp() override {
-    if (request_mode_ == ci::RequestMode::USER) {
-      ASSERT_TRUE(AddTestUser(&test_user));
-    }
-    backups_ = SetupBackupDirectories(test_user.uid);
-    for (auto& path : backups_)
-      ASSERT_TRUE(BackupPath(path));
-  }
-  void TearDown() override {
-    ASSERT_TRUE(request_mode_ == ci::RequestMode::GLOBAL ||
-                (request_mode_ == ci::RequestMode::USER &&
-                kGlobalUserUid != test_user.uid));
-    BackendInterface::SmokeInstallerFactoryPtr factory(
-        new UnifiedSmokeInstallerFactory());
-    UnifiedBackendInterface backend(
-        std::move(factory), std::to_string(test_user.uid));
-    UninstallAllSmokeApps(request_mode_, test_user.uid, &backend);
-    for (auto& path : backups_)
-      ASSERT_TRUE(RestorePath(path));
-    if (request_mode_ == ci::RequestMode::USER) {
-      ASSERT_TRUE(DeleteTestUser());
-    }
-  }
-  User test_user;
-
- private:
-  ci::RequestMode request_mode_;
-  std::vector<bf::path> backups_;
-};
-
-}  // namespace smoke_test
-
-
-namespace {
-
-const char kSmokeTestHelperPath[] =
-    "/usr/bin/unified-installer-ut/smoke-test-helper";
-
-smoke_test::SmokeEnvironment *env = nullptr;
-void signalHandler(int signum) {
-  env->TearDown();
-  exit(signum);
-}
-
-}  // namespace
-
-namespace smoke_test {
-
-const bf::path kUnifiedSmokePackagesDirectory =
-    "/usr/share/unified-installer-ut/test_samples/smoke/";
-
-class SmokeTest : public testing::Test {
- public:
-  SmokeTest()
-    : backend(BackendInterface::SmokeInstallerFactoryPtr(
-              new UnifiedSmokeInstallerFactory()),
-              std::to_string(env->test_user.uid)),
-      params({PackageType::TPK, false}) {
-    params.test_user.uid = env->test_user.uid;
-    params.test_user.gid = env->test_user.gid;
-  }
- protected:
-  UnifiedBackendInterface backend;
-  TestParameters params;
-};
-
-TEST_F(SmokeTest, Install_Single) {
-  bf::path path =
-      kUnifiedSmokePackagesDirectory / "Install_SingleTpk.tpk";
-  std::string pkgid = "smokeuni01";
-  std::string appid = "smokeuni01.InstallSingleTpk";
-  std::string exec = "smokeunified";
-
-  std::vector<bf::path> paths = { path };
-  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
-  params.pkg_type = PackageType::TPK;
-  ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
-}
-
-TEST_F(SmokeTest, Install_Double) {
-  bf::path path1 =
-      kUnifiedSmokePackagesDirectory / "Install_DoubleTpk.tpk";
-  std::string pkgid1 = "smokeuni02";
-  std::string appid1 = "smokeuni02.InstallDoubleTpk";
-  std::string exec1 = "smokeunified";
-  bf::path path2 =
-      kUnifiedSmokePackagesDirectory / "Install_DoubleWgt.wgt";
-  std::string pkgid2 = "smokeuni03";
-  std::string appid2 = "smokeuni03.InstallDoubleWgt";
-  std::string exec2 = "smokeuni03.InstallDoubleWgt";
-
-  std::vector<bf::path> paths = { path1, path2 };
-  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
-  params.pkg_type = PackageType::TPK;
-  ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
-  params.pkg_type = PackageType::WGT;
-  ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
-}
-
-TEST_F(SmokeTest, Install_Triple) {
-  bf::path path1 =
-      kUnifiedSmokePackagesDirectory / "Install_TripleTpk.tpk";
-  std::string pkgid1 = "smokeuni04";
-  std::string appid1 = "smokeuni04.InstallTripleTpk";
-  std::string exec1 = "smokeunified";
-  bf::path path2 =
-      kUnifiedSmokePackagesDirectory / "Install_TripleWgt.wgt";
-  std::string pkgid2 = "smokeuni05";
-  std::string appid2 = "smokeuni05.InstallTripleWgt";
-  std::string exec2 = "smokeuni05.InstallTripleWgt";
-  bf::path path3 =
-      kUnifiedSmokePackagesDirectory / "Install_TripleHybrid.wgt";
-  std::string pkgid3 = "smokeuni06";
-  std::string appid3 = "smokeuni06.InstallTripleHybrid";
-  std::string exec3 = "smokeuni06.InstallTripleHybrid";
-
-  std::vector<bf::path> paths = { path1, path2, path3 };
-  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
-  params.pkg_type = PackageType::TPK;
-  ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
-  params.pkg_type = PackageType::WGT;
-  ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
-  params.pkg_type = PackageType::HYBRID;
-  ASSERT_TRUE(ValidatePackage(pkgid3, {appid3, exec3}, params));
-}
-
-TEST_F(SmokeTest, Update_Single) {
-  bf::path path_old =
-      kUnifiedSmokePackagesDirectory / "Update_SingleTpk.tpk";
-  bf::path path_new =
-      kUnifiedSmokePackagesDirectory / "Update_SingleTpk_2.tpk";
-  std::string pkgid = "smokeuni07";
-  std::string appid = "smokeuni07.UpdateSingleTpk";
-  std::string exec = "smokeunified";
-
-  std::vector<bf::path> paths = { path_old };
-//  ASSERT_EQ(backend.InstallSuccess(paths), ci::AppInstaller::Result::OK);
-  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
-  paths = { path_new };
-  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
-  params.pkg_type = PackageType::TPK;
-  ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
-  ASSERT_TRUE(
-      ValidateFileContentInPackage(pkgid, "res/VERSION", "2", params));
-}
-
-TEST_F(SmokeTest, Update_Double) {
-  bf::path path1_old =
-      kUnifiedSmokePackagesDirectory / "Update_DoubleTpk.tpk";
-  bf::path path1_new =
-      kUnifiedSmokePackagesDirectory / "Update_DoubleTpk_2.tpk";
-  std::string pkgid1 = "smokeuni08";
-  std::string appid1 = "smokeuni08.UpdateDoubleTpk";
-  std::string exec1 = "smokeunified";
-  bf::path path2_old =
-      kUnifiedSmokePackagesDirectory / "Update_DoubleWgt.wgt";
-  bf::path path2_new =
-      kUnifiedSmokePackagesDirectory / "Update_DoubleWgt_2.wgt";
-  std::string pkgid2 = "smokeuni09";
-  std::string appid2 = "smokeuni09.UpdateDoubleWgt";
-  std::string exec2 = "smokeuni09.UpdateDoubleWgt";
-
-  std::vector<bf::path> paths = { path1_old, path2_old };
-//  ASSERT_EQ(backend.InstallSuccess(paths), ci::AppInstaller::Result::OK);
-  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
-  paths = { path1_new, path2_new };
-  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
-  params.pkg_type = PackageType::TPK;
-  ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
-  params.pkg_type = PackageType::WGT;
-  ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
-  ASSERT_TRUE(
-      ValidateFileContentInPackage(pkgid1, "res/VERSION", "2", params));
-  ASSERT_TRUE(
-      ValidateFileContentInPackage(pkgid2, "res/wgt/VERSION", "2", params));
-}
-
-TEST_F(SmokeTest, Update_Triple) {
-  bf::path path1_old =
-      kUnifiedSmokePackagesDirectory / "Update_TripleTpk.tpk";
-  bf::path path1_new =
-      kUnifiedSmokePackagesDirectory / "Update_TripleTpk_2.tpk";
-  std::string pkgid1 = "smokeuni10";
-  std::string appid1 = "smokeuni10.UpdateTripleTpk";
-  std::string exec1 = "smokeunified";
-  bf::path path2_old =
-      kUnifiedSmokePackagesDirectory / "Update_TripleWgt.wgt";
-  bf::path path2_new =
-      kUnifiedSmokePackagesDirectory / "Update_TripleWgt_2.wgt";
-  std::string pkgid2 = "smokeuni11";
-  std::string appid2 = "smokeuni11.UpdateTripleWgt";
-  std::string exec2 = "smokeuni11.UpdateTripleWgt";
-  bf::path path3_old =
-      kUnifiedSmokePackagesDirectory / "Update_TripleHybrid.wgt";
-  bf::path path3_new =
-      kUnifiedSmokePackagesDirectory / "Update_TripleHybrid_2.wgt";
-  std::string pkgid3 = "smokeuni12";
-  std::string appid3 = "smokeuni12.UpdateTripleHybrid";
-  std::string exec3 = "smokeuni12.UpdateTripleHybrid";
-
-  std::vector<bf::path> paths = { path1_old, path2_old, path3_old };
-//  ASSERT_EQ(backend.InstallSuccess(paths), ci::AppInstaller::Result::OK);
-  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
-  paths = { path1_new, path2_new, path3_new };
-  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
-  params.pkg_type = PackageType::TPK;
-  ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
-  params.pkg_type = PackageType::WGT;
-  ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
-  params.pkg_type = PackageType::HYBRID;
-  ASSERT_TRUE(ValidatePackage(pkgid3, {appid3, exec3}, params));
-  ASSERT_TRUE(
-      ValidateFileContentInPackage(pkgid1, "res/VERSION", "2", params));
-  ASSERT_TRUE(
-      ValidateFileContentInPackage(pkgid2, "res/wgt/VERSION", "2", params));
-  ASSERT_TRUE(
-      ValidateFileContentInPackage(pkgid3, "res/wgt/VERSION", "2", params));
-}
-
-TEST_F(SmokeTest, InstallAndUpdate) {
-  bf::path path1_old =
-      kUnifiedSmokePackagesDirectory / "InstallAndUpdate_Tpk.tpk";
-  bf::path path1_new =
-      kUnifiedSmokePackagesDirectory / "InstallAndUpdate_Tpk_2.tpk";
-  std::string pkgid1 = "smokeuni13";
-  std::string appid1 = "smokeuni13.InstallAndUpdateModeTpk";
-  std::string exec1 = "smokeunified";
-  bf::path path2 =
-      kUnifiedSmokePackagesDirectory / "InstallAndUpdate_Wgt.wgt";
-  std::string pkgid2 = "smokeuni14";
-  std::string appid2 = "smokeuni14.InstallAndUpdateWgt";
-  std::string exec2 = "smokeuni14.InstallAndUpdateWgt";
-
-  // install tpk version 1
-  std::vector<bf::path> paths = { path1_old };
-  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
-  // update tpk version 2, install wgt version 1
-  paths = { path1_new, path2 };
-  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
-  params.pkg_type = PackageType::TPK;
-  ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
-  params.pkg_type = PackageType::WGT;
-  ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
-  ASSERT_TRUE(
-      ValidateFileContentInPackage(pkgid1, "res/VERSION", "2", params));
-}
-
-TEST_F(SmokeTest, InstallAndROUpdate) {
-  bf::path path1_old =
-      kUnifiedSmokePackagesDirectory / "InstallAndROUpdate_Tpk.tpk";
-  bf::path path1_new =
-      kUnifiedSmokePackagesDirectory / "InstallAndROUpdate_Tpk_2.tpk";
-  std::string pkgid1 = "smokeuni25";
-  std::string appid1 = "smokeuni25.InstallAndROUpdateModeTpk";
-  std::string exec1 = "smokeunified";
-  bf::path path2 =
-      kUnifiedSmokePackagesDirectory / "InstallAndROUpdate_Wgt.wgt";
-  std::string pkgid2 = "smokeuni26";
-  std::string appid2 = "smokeuni26.InstallAndROUpdateWgt";
-  std::string exec2 = "smokeuni26.InstallAndROUpdateWgt";
-
-  // install tpk version 1
-  ASSERT_EQ(backend.InstallPreload(path1_old), ci::AppInstaller::Result::OK);
-  // update tpk version 2, install wgt version 1
-  std::vector<bf::path> paths = { path1_new, path2 };
-  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
-  params.pkg_type = PackageType::TPK;
-  ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
-  params.pkg_type = PackageType::WGT;
-  ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
-  ASSERT_TRUE(
-      ValidateFileContentInPackage(pkgid1, "res/VERSION", "2", params));
-}
-
-TEST_F(SmokeTest, Uninstall_Single) {
-  bf::path path =
-      kUnifiedSmokePackagesDirectory / "Uninstall_SingleTpk.tpk";
-  std::string pkgid = "smokeuni29";
-  std::string appid = "smokeuni29.UninstallSingleTpk";
-  std::string exec = "smokeunified";
-
-  std::vector<bf::path> paths = { path };
-  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
-  params.pkg_type = PackageType::TPK;
-  ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
-  std::vector<std::string> pkgids = { pkgid };
-  ASSERT_EQ(backend.Uninstall(pkgids), ci::AppInstaller::Result::OK);
-  ASSERT_TRUE(CheckPackageNonExistance(pkgid, params));
-}
-
-TEST_F(SmokeTest, Uninstall_Double) {
-  bf::path path1 =
-      kUnifiedSmokePackagesDirectory / "Uninstall_DoubleTpk.tpk";
-  std::string pkgid1 = "smokeuni30";
-  std::string appid1 = "smokeuni30.UninstallDoubleTpk";
-  std::string exec1 = "smokeunified";
-  bf::path path2 =
-      kUnifiedSmokePackagesDirectory / "Uninstall_DoubleWgt.wgt";
-  std::string pkgid2 = "smokeuni31";
-  std::string appid2 = "smokeuni31.UninstallDoubleWgt";
-  std::string exec2 = "smokeuni31.UninstallDoubleWgt";
-
-  std::vector<bf::path> paths = { path1, path2 };
-  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
-  params.pkg_type = PackageType::TPK;
-  ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
-  params.pkg_type = PackageType::WGT;
-  ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
-  std::vector<std::string> pkgids = { pkgid1, pkgid2 };
-  ASSERT_EQ(backend.Uninstall(pkgids), ci::AppInstaller::Result::OK);
-  ASSERT_TRUE(CheckPackageNonExistance(pkgid1, params));
-  ASSERT_TRUE(CheckPackageNonExistance(pkgid2, params));
-}
-
-TEST_F(SmokeTest, Uninstall_Triple) {
-  bf::path path1 =
-      kUnifiedSmokePackagesDirectory / "Uninstall_TripleTpk.tpk";
-  std::string pkgid1 = "smokeuni32";
-  std::string appid1 = "smokeuni32.UninstallTripleTpk";
-  std::string exec1 = "smokeunified";
-  bf::path path2 =
-      kUnifiedSmokePackagesDirectory / "Uninstall_TripleWgt.wgt";
-  std::string pkgid2 = "smokeuni33";
-  std::string appid2 = "smokeuni33.UninstallTripleWgt";
-  std::string exec2 = "smokeuni33.UninstallTripleWgt";
-  bf::path path3 =
-      kUnifiedSmokePackagesDirectory / "Uninstall_TripleHybrid.wgt";
-  std::string pkgid3 = "smokeuni34";
-  std::string appid3 = "smokeuni34.UninstallTripleHybrid";
-  std::string exec3 = "smokeuni34.UninstallTripleHybrid";
-
-  std::vector<bf::path> paths = { path1, path2, path3 };
-  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
-  params.pkg_type = PackageType::TPK;
-  ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
-  params.pkg_type = PackageType::WGT;
-  ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
-  params.pkg_type = PackageType::HYBRID;
-  ASSERT_TRUE(ValidatePackage(pkgid3, {appid3, exec3}, params));
-  std::vector<std::string> pkgids = { pkgid1, pkgid2, pkgid3 };
-  ASSERT_EQ(backend.Uninstall(pkgids), ci::AppInstaller::Result::OK);
-  ASSERT_TRUE(CheckPackageNonExistance(pkgid1, params));
-  ASSERT_TRUE(CheckPackageNonExistance(pkgid2, params));
-  ASSERT_TRUE(CheckPackageNonExistance(pkgid3, params));
-}
-
-TEST_F(SmokeTest, UninstallAndROUpdateUninstall) {
-  bf::path path1_old =
-      kUnifiedSmokePackagesDirectory / "UninstallAndROUpdateUninstall_Tpk.tpk";
-  bf::path path1_new =
-      kUnifiedSmokePackagesDirectory /
-      "UninstallAndROUpdateUninstall_Tpk_2.tpk";
-  std::string pkgid1 = "smokeuni35";
-  std::string appid1 = "smokeuni35.UninstallAndROUpdateUninstallTpk";
-  std::string exec1 = "smokeunified";
-  bf::path path2 =
-      kUnifiedSmokePackagesDirectory / "UninstallAndROUpdateUninstall_Wgt.wgt";
-  std::string pkgid2 = "smokeuni36";
-  std::string appid2 = "smokeuni36.UninstallAndROUpdateUninstallWgt";
-  std::string exec2 = "smokeuni36.UninstallAndROUpdateUninstallWgt";
-
-  // install tpk version 1
-  ASSERT_EQ(backend.InstallPreload(path1_old), ci::AppInstaller::Result::OK);
-  ci::PkgQueryInterface pkg_query1(pkgid1, params.test_user.uid);
-  PackageAttributes original(pkg_query1);
-  // update tpk version 2, install wgt version 1
-  std::vector<bf::path> paths = { path1_new, path2 };
-  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
-  params.pkg_type = PackageType::TPK;
-  ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
-  params.pkg_type = PackageType::WGT;
-  ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
-  ASSERT_TRUE(
-      ValidateFileContentInPackage(pkgid1, "res/VERSION", "2", params));
-  // uninstall
-  std::vector<std::string> pkgids = { pkgid1, pkgid2 };
-  ASSERT_EQ(backend.Uninstall(pkgids), ci::AppInstaller::Result::OK);
-  ci::PkgQueryInterface pkg_query2(pkgid1, params.test_user.uid, true);
-  PackageAttributes restored(pkg_query2);
-  ASSERT_EQ(original, restored);
-  ASSERT_TRUE(CheckPackageNonExistance(pkgid2, params));
-  params.pkg_type = PackageType::TPK;
-  params.is_readonly = true;
-  ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
-  ASSERT_TRUE(
-      ValidateFileContentInPackage(pkgid1, "res/VERSION", "1", params));
-}
-
-class RollbackSmokeTest : public testing::Test {
- public:
-  RollbackSmokeTest()
-    : backend(BackendInterface::SmokeInstallerFactoryPtr(
-              new UnifiedSmokeInstallerFactory()),
-              std::to_string(env->test_user.uid),
-              RequestResult::FAIL),
-      params({PackageType::TPK, false}) {
-    params.test_user.uid = env->test_user.uid;
-    params.test_user.gid = env->test_user.gid;
-  }
- protected:
-  UnifiedBackendInterface backend;
-  TestParameters params;
-};
-
-TEST_F(RollbackSmokeTest, Install_Rollback) {
-  bf::path path1 =
-      kUnifiedSmokePackagesDirectory / "Install_RollbackTpk.tpk";
-  std::string pkgid1 = "smokeuni15";
-  std::string appid1 = "smokeuni15.InstallRollbackTpk";
-  std::string exec1 = "smokeunified";
-  bf::path path2 =
-      kUnifiedSmokePackagesDirectory / "Install_RollbackWgt.wgt";
-  std::string pkgid2 = "smokeuni16";
-  std::string appid2 = "smokeuni16.InstallRollbackWgt";
-  std::string exec2 = "smokeuni16.InstallRollbackWgt";
-
-  std::vector<bf::path> paths = { path1, path2 };
-  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::ERROR);
-  params.pkg_type = PackageType::TPK;
-  ASSERT_TRUE(CheckPackageNonExistance(pkgid1, params));
-  params.pkg_type = PackageType::WGT;
-  ASSERT_TRUE(CheckPackageNonExistance(pkgid2, params));
-}
-
-TEST_F(RollbackSmokeTest, Update_Rollback) {
-  bf::path path1_old =
-      kUnifiedSmokePackagesDirectory / "Update_RollbackTpk.tpk";
-  bf::path path1_new =
-      kUnifiedSmokePackagesDirectory / "Update_RollbackTpk_2.tpk";
-  std::string pkgid1 = "smokeuni17";
-  std::string appid1 = "smokeuni17.UpdateRollbackTpk";
-  std::string exec1 = "smokeunified";
-  bf::path path2_old =
-      kUnifiedSmokePackagesDirectory / "Update_RollbackWgt.wgt";
-  bf::path path2_new =
-      kUnifiedSmokePackagesDirectory / "Update_RollbackWgt_2.wgt";
-  std::string pkgid2 = "smokeuni18";
-  std::string appid2 = "smokeuni18.UpdateRollbackWgt";
-  std::string exec2 = "smokeuni18.UpdateRollbackWgt";
-
-  std::vector<bf::path> paths = { path1_old, path2_old };
-  ASSERT_EQ(backend.InstallSuccess(paths), ci::AppInstaller::Result::OK);
-  paths = { path1_new, path2_new };
-  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::ERROR);
-
-  params.pkg_type = PackageType::TPK;
-  ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
-  params.pkg_type = PackageType::WGT;
-  ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
-  ASSERT_TRUE(
-      ValidateFileContentInPackage(pkgid1, "res/VERSION", "1", params));
-  ASSERT_TRUE(
-      ValidateFileContentInPackage(pkgid2, "res/wgt/VERSION", "1", params));
-}
-
-TEST_F(RollbackSmokeTest, InstallAndUpdate_Rollback) {
-  bf::path path1 =
-      kUnifiedSmokePackagesDirectory / "InstallAndUpdate_RollbackTpk.tpk";
-  std::string pkgid1 = "smokeuni19";
-  std::string appid1 = "smokeuni19.InstallAndUpdateRollbackTpk";
-  std::string exec1 = "smokeunified";
-  bf::path path2_old =
-      kUnifiedSmokePackagesDirectory / "InstallAndUpdate_RollbackWgt.wgt";
-  bf::path path2_new =
-      kUnifiedSmokePackagesDirectory / "InstallAndUpdate_RollbackWgt_2.wgt";
-  std::string pkgid2 = "smokeuni20";
-  std::string appid2 = "smokeuni20.InstallAndUpdateRollbackWgt";
-  std::string exec2 = "smokeuni20.InstallAndUpdateRollbackWgt";
-
-  std::vector<bf::path> paths = { path2_old };
-  ASSERT_EQ(backend.InstallSuccess(paths), ci::AppInstaller::Result::OK);
-  // pkgid1: install, pkgid2: update
-  paths = { path1, path2_new };
-  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::ERROR);
-
-  params.pkg_type = PackageType::TPK;
-  ASSERT_TRUE(CheckPackageNonExistance(pkgid1, params));
-  params.pkg_type = PackageType::WGT;
-  ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
-  ASSERT_TRUE(
-      ValidateFileContentInPackage(pkgid2, "res/wgt/VERSION", "1", params));
-}
-
-TEST_F(RollbackSmokeTest, InstallAndROUpdate_Rollback) {
-  bf::path path1 =
-      kUnifiedSmokePackagesDirectory / "InstallAndROUpdate_RollbackTpk.tpk";
-  std::string pkgid1 = "smokeuni27";
-  std::string appid1 = "smokeuni27.InstallAndROUpdateRollbackTpk";
-  std::string exec1 = "smokeunified";
-  bf::path path2_old =
-      kUnifiedSmokePackagesDirectory / "InstallAndROUpdate_RollbackWgt.wgt";
-  bf::path path2_new =
-      kUnifiedSmokePackagesDirectory / "InstallAndROUpdate_RollbackWgt_2.wgt";
-  std::string pkgid2 = "smokeuni28";
-  std::string appid2 = "smokeuni28.InstallAndROUpdateRollbackWgt";
-  std::string exec2 = "smokeuni28.InstallAndROUpdateRollbackWgt";
-
-  ASSERT_EQ(backend.InstallPreloadSuccess(path2_old),
-        ci::AppInstaller::Result::OK);
-  // pkgid1: install, pkgid2: update
-  std::vector<bf::path> paths = { path1, path2_new };
-  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::ERROR);
-  params.pkg_type = PackageType::TPK;
-  ASSERT_TRUE(CheckPackageNonExistance(pkgid1, params));
-  params.pkg_type = PackageType::WGT;
-  params.is_readonly = true;
-  ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
-  ASSERT_TRUE(
-      ValidateFileContentInPackage(pkgid2, "res/wgt/VERSION", "1", params));
-}
-
-TEST_F(SmokeTest, Recovery_Install) {
-  bf::path path1 =
-      kUnifiedSmokePackagesDirectory / "Recovery_InstallTpk.tpk";
-  std::string pkgid1 = "smokeuni21";
-  std::string appid1 = "smokeuni21.RecoveryInstallTpk";
-  std::string exec1 = "smokeunified";
-  bf::path path2 =
-      kUnifiedSmokePackagesDirectory / "Recovery_InstallWgt.wgt";
-  std::string pkgid2 = "smokeuni22";
-  std::string appid2 = "smokeuni22.RecoveryInstallWgt";
-  std::string exec2 = "smokeuni22.RecoveryInstallWgt";
-
-  std::vector<std::string> paths = { path1.string(), path2.string() };
-  ci::Subprocess backend_crash(kSmokeTestHelperPath);
-  std::string test_uid_str = std::to_string(params.test_user.uid);
-  std::vector<std::string> argv = { "-u", test_uid_str, "-i" };
-  argv.insert(argv.end(), paths.begin(), paths.end());
-  backend_crash.Run(argv);
-  ASSERT_NE(backend_crash.Wait(), 0);
-
-  bf::path recovery_file =
-      FindRecoveryFile("/tpk-recovery", params.test_user.uid);
-  ASSERT_FALSE(recovery_file.empty());
-  std::unique_ptr<ci::recovery::RecoveryFile> recovery_info =
-      GetRecoverFileInfo(recovery_file);
-  ASSERT_TRUE(recovery_info);
-  ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK);
-  params.pkg_type = PackageType::TPK;
-  ASSERT_TRUE(CheckPackageNonExistance(pkgid1, params));
-  ASSERT_FALSE(bf::exists(recovery_info->unpacked_dir()));
-
-  recovery_file =
-      FindRecoveryFile("/wgt-recovery", params.test_user.uid);
-  ASSERT_FALSE(recovery_file.empty());
-  recovery_info.reset();
-  recovery_info = GetRecoverFileInfo(recovery_file);
-  ASSERT_TRUE(recovery_info);
-  ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK);
-  params.pkg_type = PackageType::WGT;
-  ASSERT_TRUE(CheckPackageNonExistance(pkgid2, params));
-  ASSERT_FALSE(bf::exists(recovery_info->unpacked_dir()));
-}
-
-TEST_F(SmokeTest, Recovery_Update) {
-  bf::path path1_old =
-      kUnifiedSmokePackagesDirectory / "Recovery_UpdateTpk.tpk";
-  bf::path path1_new =
-      kUnifiedSmokePackagesDirectory / "Recovery_UpdateTpk_2.tpk";
-  std::string pkgid1 = "smokeuni23";
-  std::string appid1 = "smokeuni23.RecoveryUpdateTpk";
-  std::string exec1 = "smokeunified";
-  bf::path path2_old =
-      kUnifiedSmokePackagesDirectory / "Recovery_UpdateWgt.wgt";
-  bf::path path2_new =
-      kUnifiedSmokePackagesDirectory / "Recovery_UpdateWgt_2.wgt";
-  std::string pkgid2 = "smokeuni24";
-  std::string appid2 = "smokeuni24.RecoveryUpdateWgt";
-  std::string exec2 = "smokeuni24.RecoveryUpdateWgt";
-
-  std::vector<bf::path> paths_old = { path1_old, path2_old };
-  ASSERT_EQ(backend.Install(paths_old), ci::AppInstaller::Result::OK);
-
-  std::vector<std::string> paths = { path1_new.string(), path2_new.string() };
-  ci::Subprocess backend_crash(kSmokeTestHelperPath);
-  std::string test_uid_str = std::to_string(params.test_user.uid);
-  std::vector<std::string> argv = { "-u", test_uid_str, "-i" };
-  argv.insert(argv.end(), paths.begin(), paths.end());
-  backend_crash.Run(argv);
-  ASSERT_NE(backend_crash.Wait(), 0);
-
-  bf::path recovery_file =
-      FindRecoveryFile("/tpk-recovery", params.test_user.uid);
-  ASSERT_FALSE(recovery_file.empty());
-  std::unique_ptr<ci::recovery::RecoveryFile> recovery_info =
-      GetRecoverFileInfo(recovery_file);
-  ASSERT_TRUE(recovery_info);
-  ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK);
-  params.pkg_type = PackageType::TPK;
-  ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
-  ASSERT_TRUE(
-      ValidateFileContentInPackage(pkgid1, "res/VERSION", "1", params));
-
-  recovery_file =
-      FindRecoveryFile("/wgt-recovery", params.test_user.uid);
-  ASSERT_FALSE(recovery_file.empty());
-  recovery_info.reset();
-  recovery_info = GetRecoverFileInfo(recovery_file);
-  ASSERT_TRUE(recovery_info);
-  ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK);
-  params.pkg_type = PackageType::WGT;
-  ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
-  ASSERT_TRUE(
-      ValidateFileContentInPackage(pkgid2, "res/wgt/VERSION", "1", params));
-}
-
-}  // namespace smoke_test
-
-int main(int argc, char** argv) {
-  try {
-    ci::RequestMode request_mode = smoke_test::ParseRequestMode(argc, argv);
-    if (getuid() != 0 || request_mode != ci::RequestMode::GLOBAL) {
-      std::cout << "Skip tests for preload request" << std::endl;
-      ::testing::GTEST_FLAG(filter) = "SmokeTest.*";
-    }
-    testing::InitGoogleTest(&argc, argv);
-    ::env = static_cast<smoke_test::SmokeEnvironment*>(
-        testing::AddGlobalTestEnvironment(
-          new smoke_test::SmokeEnvironment(request_mode)));
-    signal(SIGINT, ::signalHandler);
-    signal(SIGSEGV, ::signalHandler);
-    return RUN_ALL_TESTS();
-  } catch (...) {
-    std::cout << "Exception occurred during testing" << std::endl;
-    return -1;
-  }
-}
diff --git a/src/unit_tests/smoke_test_helper.cc b/src/unit_tests/smoke_test_helper.cc
deleted file mode 100644 (file)
index 78ace41..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright (c) 2020 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 <common/installer_factory.h>
-#include <common/installer_runner.h>
-#include <common/pkgmgr_interface.h>
-#include <tpk/tpk_app_query_interface.h>
-#include <unit_tests/common/smoke_utils.h>
-#include <unit_tests/tpk_smoke_utils.h>
-#include <unit_tests/wgt_smoke_utils.h>
-#include <wgt/utils/wgt_app_query_interface.h>
-
-#include <algorithm>
-#include <memory>
-#include <string>
-
-namespace ci = common_installer;
-
-namespace {
-
-bool EndsWith(const std::string str, const std::string& to_match) {
-  if (to_match.size() > str.size())
-    return false;
-  return std::equal(to_match.rbegin(), to_match.rend(), str.rbegin());
-}
-
-#if __cplusplus < 201300L
-template<typename T, typename... Args>
-std::unique_ptr<T> make_unique(Args&&... args) {
-  return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
-}
-#endif
-
-}  // namespace
-
-class CrashInstallerFactory : public ci::InstallerFactory {
- public:
-  std::unique_ptr<ci::AppInstaller> CreateInstaller(ci::PkgMgrPtr pkgmgr,
-      int idx) override {
-    std::string type =
-        EndsWith(pkgmgr->GetRequestInfo(idx), "tpk") ? "tpk" : "wgt";
-    int n_pkgs = pkgmgr->GetRequestInfoCount();
-    std::unique_ptr<ci::AppInstaller> installer;
-    if (type == "tpk") {
-      tpk::TpkAppQueryInterface* tpk_aqi = new tpk::TpkAppQueryInterface();
-      pkgmgr->AddAppQueryInterface(idx, tpk_aqi);
-      installer.reset(
-          idx + 1 == n_pkgs ?
-              new smoke_test::CrashTpkInstaller(pkgmgr, -1, {},
-                  smoke_test::CrashStepType::PROCESS) :
-              new tpk::TpkInstaller(pkgmgr));
-
-    } else {
-      wgt::WgtAppQueryInterface* wgt_aqi = new wgt::WgtAppQueryInterface();
-      pkgmgr->AddAppQueryInterface(idx, wgt_aqi);
-      installer.reset(
-          idx + 1 == n_pkgs ?
-              new smoke_test::CrashWgtInstaller(pkgmgr, -1, {},
-                  smoke_test::CrashStepType::PROCESS) :
-              new wgt::WgtInstaller(pkgmgr));
-    }
-    installer->SetIndex(idx);
-    return installer;
-  }
-};
-
-int main(int argc, char** argv) {
-  ci::PkgmgrInstaller pkgmgr_installer;
-  auto pkgmgr = ci::PkgMgrInterface::Create(argc, argv, &pkgmgr_installer);
-
-#if __cplusplus >= 201300L
-  using std;
-#endif
-  ci::InstallerRunner runner(make_unique<CrashInstallerFactory>(), pkgmgr);
-  ci::AppInstaller::Result result = runner.Run();
-
-  return (result == ci::AppInstaller::Result::OK) ? 0 : 1;
-}
diff --git a/src/unit_tests/smoke_utils.cc b/src/unit_tests/smoke_utils.cc
deleted file mode 100644 (file)
index 3138da4..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-// Copyright (c) 2020 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/smoke_utils.h"
-
-#include <unit_tests/common/smoke_utils.h>
-#include <unit_tests/tpk_smoke_utils.h>
-#include <unit_tests/wgt_smoke_utils.h>
-#include <unzip.h>
-
-#include <map>
-#include <string>
-
-namespace bf = boost::filesystem;
-namespace ci = common_installer;
-
-namespace {
-
-std::map<const char*, const char*> kTypeMap = {
-  {"res/wgt/config.xml", "wgt"},
-  {"config.xml", "wgt"},
-  {"tizen-manifest.xml", "tpk"},
-};
-
-std::string GetPkgTypeFromPkgid(const std::string& pkgid, uid_t uid) {
-  ci::PkgQueryInterface query(pkgid, uid);
-  return query.Type();
-}
-
-std::string GetPkgTypeFromPath(const std::string& path) {
-  std::string type;
-  unzFile uf = unzOpen(path.c_str());
-  if (!uf) {
-    LOG(ERROR) << "Failed to open zip file: " << path;
-    return type;
-  }
-  for (auto it : kTypeMap) {
-    if (unzLocateFile(uf, it.first, 0) == UNZ_OK) {
-      LOG(DEBUG) << "Found: " << it.first;
-      type = it.second;
-      break;
-    }
-  }
-  if (type.empty())
-    LOG(ERROR) << "Cannot get pkg type";
-  unzClose(uf);
-  return type;
-}
-
-std::string GetPkgTypeFromRecoveryFile(const std::string& path) {
-  bf::path recovery_file = path;
-  if (recovery_file.filename().string().find("tpk") == 0)
-    return "tpk";
-  else if (recovery_file.filename().string().find("wgt") == 0)
-    return "wgt";
-  return {};
-}
-
-std::string GetPkgType(const std::string& pkginfo, uid_t uid) {
-  std::string type = GetPkgTypeFromPkgid(pkginfo, uid);
-  if (type.empty())
-    type = GetPkgTypeFromPath(pkginfo);
-  // recovery file
-  if (type.empty())
-    type = GetPkgTypeFromRecoveryFile(pkginfo);
-  return type;
-}
-
-}  // namespace
-
-namespace smoke_test {
-
-UnifiedSmokeInstallerFactory::AppInstallerPtr
-UnifiedSmokeInstallerFactory::CreateInstaller(
-    int idx, ci::PkgMgrPtr pkgmgr) const {
-  std::string type = GetPkgType(pkgmgr->GetRequestInfo(idx), pkgmgr->GetUid());
-  if (type.empty())
-    return {};
-
-  std::unique_ptr<ci::AppInstaller> installer;
-  if (type == "tpk") {
-    tpk::TpkAppQueryInterface* tpk_aqi = new tpk::TpkAppQueryInterface();
-    pkgmgr->AddAppQueryInterface(idx, tpk_aqi);
-    installer.reset(new tpk::TpkInstaller(pkgmgr));
-  } else {
-    wgt::WgtAppQueryInterface* wgt_aqi = new wgt::WgtAppQueryInterface();
-    pkgmgr->AddAppQueryInterface(idx, wgt_aqi);
-    if (wgt_aqi->IsHybridApplication(pkgmgr->GetRequestInfo(idx),
-            pkgmgr->GetUid())) {
-      LOG(INFO) << "Hybrid package detected";
-      installer.reset(new hybrid::HybridInstaller(pkgmgr));
-    } else {
-      installer.reset(new wgt::WgtInstaller(pkgmgr));
-    }
-  }
-
-  installer->SetIndex(idx);
-
-  return installer;
-}
-
-UnifiedSmokeInstallerFactory::AppInstallerPtr
-UnifiedSmokeInstallerFactory::CreateFailExpectedInstaller(
-    int idx, ci::PkgMgrPtr pkgmgr, int fail_at) const {
-  std::string type = GetPkgType(pkgmgr->GetRequestInfo(idx), pkgmgr->GetUid());
-  if (type.empty())
-    return {};
-
-  std::unique_ptr<ci::AppInstaller> installer;
-  if (type == "tpk") {
-    tpk::TpkAppQueryInterface* tpk_aqi = new tpk::TpkAppQueryInterface();
-    pkgmgr->AddAppQueryInterface(idx, tpk_aqi);
-    installer.reset(new smoke_test::FailExpectedTpkInstaller(pkgmgr, fail_at));
-  } else {
-    wgt::WgtAppQueryInterface* wgt_aqi = new wgt::WgtAppQueryInterface();
-    pkgmgr->AddAppQueryInterface(idx, wgt_aqi);
-    if (wgt_aqi->IsHybridApplication(pkgmgr->GetRequestInfo(idx),
-            pkgmgr->GetUid())) {
-      LOG(INFO) << "Hybrid package detected";
-      installer.reset(
-          new smoke_test::FailExpectedHybridInstaller(pkgmgr, fail_at));
-    } else {
-      installer.reset(
-          new smoke_test::FailExpectedWgtInstaller(pkgmgr, fail_at));
-    }
-  }
-
-  installer->SetIndex(idx);
-
-  return installer;
-}
-
-UnifiedBackendInterface::AppQueryInterfacePtr
-UnifiedBackendInterface::CreateQueryInterface() const {
-  // this is not used
-  return {};
-}
-
-UnifiedBackendInterface::AppInstallerPtr
-UnifiedBackendInterface::CreateInstaller(ci::PkgMgrPtr pkgmgr) const {
-  return factory_->CreateInstaller(0, pkgmgr);
-}
-
-UnifiedBackendInterface::AppInstallerPtr
-UnifiedBackendInterface::CreateFailExpectedInstaller(
-    ci::PkgMgrPtr pkgmgr, int fail_at) const {
-  return factory_->CreateFailExpectedInstaller(0, pkgmgr, fail_at);;
-}
-
-}  // 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 3ce24f5..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 2020 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/installer/app_installer.h>
-#include <common/pkgmgr_interface.h>
-#include <unit_tests/common/smoke_utils.h>
-#include <unit_tests/tpk_smoke_utils.h>
-
-namespace smoke_test {
-
-class UnifiedSmokeInstallerFactory : public SmokeInstallerFactory {
- public:
-  AppInstallerPtr CreateInstaller(
-      int idx, common_installer::PkgMgrPtr pkgmgr) const override;
-  AppInstallerPtr CreateFailExpectedInstaller(
-      int idx, common_installer::PkgMgrPtr pkgmgr, int fail_at) const override;
-};
-
-class UnifiedBackendInterface : public BackendInterface {
- public:
-  using BackendInterface::BackendInterface;
-
-  AppQueryInterfacePtr CreateQueryInterface() const override;
-  AppInstallerPtr CreateInstaller(
-      common_installer::PkgMgrPtr pkgmgr) const override;
-  AppInstallerPtr CreateFailExpectedInstaller(
-      common_installer::PkgMgrPtr pkgmgr, int fail_at) const override;
-};
-
-}  // namespace smoke_test
-
-#endif  // UNIT_TESTS_SMOKE_UTILS_H_
diff --git a/src/unit_tests/test_samples/smoke/InstallAndROUpdate_RollbackTpk.tpk b/src/unit_tests/test_samples/smoke/InstallAndROUpdate_RollbackTpk.tpk
deleted file mode 100644 (file)
index b9342ca..0000000
Binary files a/src/unit_tests/test_samples/smoke/InstallAndROUpdate_RollbackTpk.tpk and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/InstallAndROUpdate_RollbackWgt.wgt b/src/unit_tests/test_samples/smoke/InstallAndROUpdate_RollbackWgt.wgt
deleted file mode 100644 (file)
index bad3112..0000000
Binary files a/src/unit_tests/test_samples/smoke/InstallAndROUpdate_RollbackWgt.wgt and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/InstallAndROUpdate_RollbackWgt_2.wgt b/src/unit_tests/test_samples/smoke/InstallAndROUpdate_RollbackWgt_2.wgt
deleted file mode 100644 (file)
index 8d0f6fc..0000000
Binary files a/src/unit_tests/test_samples/smoke/InstallAndROUpdate_RollbackWgt_2.wgt and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/InstallAndROUpdate_Tpk.tpk b/src/unit_tests/test_samples/smoke/InstallAndROUpdate_Tpk.tpk
deleted file mode 100644 (file)
index df5f2f2..0000000
Binary files a/src/unit_tests/test_samples/smoke/InstallAndROUpdate_Tpk.tpk and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/InstallAndROUpdate_Tpk_2.tpk b/src/unit_tests/test_samples/smoke/InstallAndROUpdate_Tpk_2.tpk
deleted file mode 100644 (file)
index 9fb1f4d..0000000
Binary files a/src/unit_tests/test_samples/smoke/InstallAndROUpdate_Tpk_2.tpk and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/InstallAndROUpdate_Wgt.wgt b/src/unit_tests/test_samples/smoke/InstallAndROUpdate_Wgt.wgt
deleted file mode 100644 (file)
index 08cdb5c..0000000
Binary files a/src/unit_tests/test_samples/smoke/InstallAndROUpdate_Wgt.wgt and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/InstallAndUpdate_RollbackTpk.tpk b/src/unit_tests/test_samples/smoke/InstallAndUpdate_RollbackTpk.tpk
deleted file mode 100644 (file)
index ed9986f..0000000
Binary files a/src/unit_tests/test_samples/smoke/InstallAndUpdate_RollbackTpk.tpk and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/InstallAndUpdate_RollbackWgt.wgt b/src/unit_tests/test_samples/smoke/InstallAndUpdate_RollbackWgt.wgt
deleted file mode 100644 (file)
index 7b7eec8..0000000
Binary files a/src/unit_tests/test_samples/smoke/InstallAndUpdate_RollbackWgt.wgt and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/InstallAndUpdate_RollbackWgt_2.wgt b/src/unit_tests/test_samples/smoke/InstallAndUpdate_RollbackWgt_2.wgt
deleted file mode 100644 (file)
index 5ce4a31..0000000
Binary files a/src/unit_tests/test_samples/smoke/InstallAndUpdate_RollbackWgt_2.wgt and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/InstallAndUpdate_Tpk.tpk b/src/unit_tests/test_samples/smoke/InstallAndUpdate_Tpk.tpk
deleted file mode 100644 (file)
index a1962e7..0000000
Binary files a/src/unit_tests/test_samples/smoke/InstallAndUpdate_Tpk.tpk and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/InstallAndUpdate_Tpk_2.tpk b/src/unit_tests/test_samples/smoke/InstallAndUpdate_Tpk_2.tpk
deleted file mode 100644 (file)
index b89491f..0000000
Binary files a/src/unit_tests/test_samples/smoke/InstallAndUpdate_Tpk_2.tpk and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/InstallAndUpdate_Wgt.wgt b/src/unit_tests/test_samples/smoke/InstallAndUpdate_Wgt.wgt
deleted file mode 100644 (file)
index 9693927..0000000
Binary files a/src/unit_tests/test_samples/smoke/InstallAndUpdate_Wgt.wgt and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Install_DoubleTpk.tpk b/src/unit_tests/test_samples/smoke/Install_DoubleTpk.tpk
deleted file mode 100644 (file)
index dd2cacf..0000000
Binary files a/src/unit_tests/test_samples/smoke/Install_DoubleTpk.tpk and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Install_DoubleWgt.wgt b/src/unit_tests/test_samples/smoke/Install_DoubleWgt.wgt
deleted file mode 100644 (file)
index 012ad4b..0000000
Binary files a/src/unit_tests/test_samples/smoke/Install_DoubleWgt.wgt and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Install_RollbackTpk.tpk b/src/unit_tests/test_samples/smoke/Install_RollbackTpk.tpk
deleted file mode 100644 (file)
index 4ccaf24..0000000
Binary files a/src/unit_tests/test_samples/smoke/Install_RollbackTpk.tpk and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Install_RollbackWgt.wgt b/src/unit_tests/test_samples/smoke/Install_RollbackWgt.wgt
deleted file mode 100644 (file)
index 4a13903..0000000
Binary files a/src/unit_tests/test_samples/smoke/Install_RollbackWgt.wgt and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Install_SingleTpk.tpk b/src/unit_tests/test_samples/smoke/Install_SingleTpk.tpk
deleted file mode 100644 (file)
index 6ff90ec..0000000
Binary files a/src/unit_tests/test_samples/smoke/Install_SingleTpk.tpk and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Install_TripleHybrid.wgt b/src/unit_tests/test_samples/smoke/Install_TripleHybrid.wgt
deleted file mode 100644 (file)
index 6da86a3..0000000
Binary files a/src/unit_tests/test_samples/smoke/Install_TripleHybrid.wgt and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Install_TripleTpk.tpk b/src/unit_tests/test_samples/smoke/Install_TripleTpk.tpk
deleted file mode 100644 (file)
index 7fda828..0000000
Binary files a/src/unit_tests/test_samples/smoke/Install_TripleTpk.tpk and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Install_TripleWgt.wgt b/src/unit_tests/test_samples/smoke/Install_TripleWgt.wgt
deleted file mode 100644 (file)
index bd63e79..0000000
Binary files a/src/unit_tests/test_samples/smoke/Install_TripleWgt.wgt and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Recovery_InstallTpk.tpk b/src/unit_tests/test_samples/smoke/Recovery_InstallTpk.tpk
deleted file mode 100644 (file)
index b7f3dca..0000000
Binary files a/src/unit_tests/test_samples/smoke/Recovery_InstallTpk.tpk and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Recovery_InstallWgt.wgt b/src/unit_tests/test_samples/smoke/Recovery_InstallWgt.wgt
deleted file mode 100644 (file)
index 66844e2..0000000
Binary files a/src/unit_tests/test_samples/smoke/Recovery_InstallWgt.wgt and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Recovery_UpdateTpk.tpk b/src/unit_tests/test_samples/smoke/Recovery_UpdateTpk.tpk
deleted file mode 100644 (file)
index 8d5ab7b..0000000
Binary files a/src/unit_tests/test_samples/smoke/Recovery_UpdateTpk.tpk and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Recovery_UpdateTpk_2.tpk b/src/unit_tests/test_samples/smoke/Recovery_UpdateTpk_2.tpk
deleted file mode 100644 (file)
index 75f5342..0000000
Binary files a/src/unit_tests/test_samples/smoke/Recovery_UpdateTpk_2.tpk and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Recovery_UpdateWgt.wgt b/src/unit_tests/test_samples/smoke/Recovery_UpdateWgt.wgt
deleted file mode 100644 (file)
index fcf60aa..0000000
Binary files a/src/unit_tests/test_samples/smoke/Recovery_UpdateWgt.wgt and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Recovery_UpdateWgt_2.wgt b/src/unit_tests/test_samples/smoke/Recovery_UpdateWgt_2.wgt
deleted file mode 100644 (file)
index 8f28138..0000000
Binary files a/src/unit_tests/test_samples/smoke/Recovery_UpdateWgt_2.wgt and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/UninstallAndROUpdateUninstall_Tpk.tpk b/src/unit_tests/test_samples/smoke/UninstallAndROUpdateUninstall_Tpk.tpk
deleted file mode 100644 (file)
index 01c4902..0000000
Binary files a/src/unit_tests/test_samples/smoke/UninstallAndROUpdateUninstall_Tpk.tpk and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/UninstallAndROUpdateUninstall_Tpk_2.tpk b/src/unit_tests/test_samples/smoke/UninstallAndROUpdateUninstall_Tpk_2.tpk
deleted file mode 100644 (file)
index 67043eb..0000000
Binary files a/src/unit_tests/test_samples/smoke/UninstallAndROUpdateUninstall_Tpk_2.tpk and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/UninstallAndROUpdateUninstall_Wgt.wgt b/src/unit_tests/test_samples/smoke/UninstallAndROUpdateUninstall_Wgt.wgt
deleted file mode 100644 (file)
index becb791..0000000
Binary files a/src/unit_tests/test_samples/smoke/UninstallAndROUpdateUninstall_Wgt.wgt and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Uninstall_DoubleTpk.tpk b/src/unit_tests/test_samples/smoke/Uninstall_DoubleTpk.tpk
deleted file mode 100644 (file)
index fcd6a1a..0000000
Binary files a/src/unit_tests/test_samples/smoke/Uninstall_DoubleTpk.tpk and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Uninstall_DoubleWgt.wgt b/src/unit_tests/test_samples/smoke/Uninstall_DoubleWgt.wgt
deleted file mode 100644 (file)
index ac9d7fb..0000000
Binary files a/src/unit_tests/test_samples/smoke/Uninstall_DoubleWgt.wgt and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Uninstall_SingleTpk.tpk b/src/unit_tests/test_samples/smoke/Uninstall_SingleTpk.tpk
deleted file mode 100644 (file)
index 6b59e8d..0000000
Binary files a/src/unit_tests/test_samples/smoke/Uninstall_SingleTpk.tpk and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Uninstall_TripleHybrid.wgt b/src/unit_tests/test_samples/smoke/Uninstall_TripleHybrid.wgt
deleted file mode 100644 (file)
index 5a4fa88..0000000
Binary files a/src/unit_tests/test_samples/smoke/Uninstall_TripleHybrid.wgt and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Uninstall_TripleTpk.tpk b/src/unit_tests/test_samples/smoke/Uninstall_TripleTpk.tpk
deleted file mode 100644 (file)
index 1d348c4..0000000
Binary files a/src/unit_tests/test_samples/smoke/Uninstall_TripleTpk.tpk and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Uninstall_TripleWgt.wgt b/src/unit_tests/test_samples/smoke/Uninstall_TripleWgt.wgt
deleted file mode 100644 (file)
index 9b9f867..0000000
Binary files a/src/unit_tests/test_samples/smoke/Uninstall_TripleWgt.wgt and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Update_DoubleTpk.tpk b/src/unit_tests/test_samples/smoke/Update_DoubleTpk.tpk
deleted file mode 100644 (file)
index dbee219..0000000
Binary files a/src/unit_tests/test_samples/smoke/Update_DoubleTpk.tpk and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Update_DoubleTpk_2.tpk b/src/unit_tests/test_samples/smoke/Update_DoubleTpk_2.tpk
deleted file mode 100644 (file)
index 5dd7d91..0000000
Binary files a/src/unit_tests/test_samples/smoke/Update_DoubleTpk_2.tpk and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Update_DoubleWgt.wgt b/src/unit_tests/test_samples/smoke/Update_DoubleWgt.wgt
deleted file mode 100644 (file)
index ba5a98d..0000000
Binary files a/src/unit_tests/test_samples/smoke/Update_DoubleWgt.wgt and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Update_DoubleWgt_2.wgt b/src/unit_tests/test_samples/smoke/Update_DoubleWgt_2.wgt
deleted file mode 100644 (file)
index 58d4039..0000000
Binary files a/src/unit_tests/test_samples/smoke/Update_DoubleWgt_2.wgt and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Update_RollbackTpk.tpk b/src/unit_tests/test_samples/smoke/Update_RollbackTpk.tpk
deleted file mode 100644 (file)
index 2d9065d..0000000
Binary files a/src/unit_tests/test_samples/smoke/Update_RollbackTpk.tpk and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Update_RollbackTpk_2.tpk b/src/unit_tests/test_samples/smoke/Update_RollbackTpk_2.tpk
deleted file mode 100644 (file)
index 96dc4fd..0000000
Binary files a/src/unit_tests/test_samples/smoke/Update_RollbackTpk_2.tpk and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Update_RollbackWgt.wgt b/src/unit_tests/test_samples/smoke/Update_RollbackWgt.wgt
deleted file mode 100644 (file)
index 6d670e1..0000000
Binary files a/src/unit_tests/test_samples/smoke/Update_RollbackWgt.wgt and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Update_RollbackWgt_2.wgt b/src/unit_tests/test_samples/smoke/Update_RollbackWgt_2.wgt
deleted file mode 100644 (file)
index 71e23b0..0000000
Binary files a/src/unit_tests/test_samples/smoke/Update_RollbackWgt_2.wgt and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Update_SingleTpk.tpk b/src/unit_tests/test_samples/smoke/Update_SingleTpk.tpk
deleted file mode 100644 (file)
index ab44827..0000000
Binary files a/src/unit_tests/test_samples/smoke/Update_SingleTpk.tpk and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Update_SingleTpk_2.tpk b/src/unit_tests/test_samples/smoke/Update_SingleTpk_2.tpk
deleted file mode 100644 (file)
index e414f11..0000000
Binary files a/src/unit_tests/test_samples/smoke/Update_SingleTpk_2.tpk and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Update_TripleHybrid.wgt b/src/unit_tests/test_samples/smoke/Update_TripleHybrid.wgt
deleted file mode 100644 (file)
index 7ae8eed..0000000
Binary files a/src/unit_tests/test_samples/smoke/Update_TripleHybrid.wgt and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Update_TripleHybrid_2.wgt b/src/unit_tests/test_samples/smoke/Update_TripleHybrid_2.wgt
deleted file mode 100644 (file)
index 10c2ee5..0000000
Binary files a/src/unit_tests/test_samples/smoke/Update_TripleHybrid_2.wgt and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Update_TripleTpk.tpk b/src/unit_tests/test_samples/smoke/Update_TripleTpk.tpk
deleted file mode 100644 (file)
index 9362636..0000000
Binary files a/src/unit_tests/test_samples/smoke/Update_TripleTpk.tpk and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Update_TripleTpk_2.tpk b/src/unit_tests/test_samples/smoke/Update_TripleTpk_2.tpk
deleted file mode 100644 (file)
index 7dac47d..0000000
Binary files a/src/unit_tests/test_samples/smoke/Update_TripleTpk_2.tpk and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Update_TripleWgt.wgt b/src/unit_tests/test_samples/smoke/Update_TripleWgt.wgt
deleted file mode 100644 (file)
index 85bcbe8..0000000
Binary files a/src/unit_tests/test_samples/smoke/Update_TripleWgt.wgt and /dev/null differ
diff --git a/src/unit_tests/test_samples/smoke/Update_TripleWgt_2.wgt b/src/unit_tests/test_samples/smoke/Update_TripleWgt_2.wgt
deleted file mode 100644 (file)
index 1b23d6e..0000000
Binary files a/src/unit_tests/test_samples/smoke/Update_TripleWgt_2.wgt and /dev/null differ
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644 (file)
index 0000000..5e073da
--- /dev/null
@@ -0,0 +1 @@
+ADD_SUBDIRECTORY(smoke_test)
diff --git a/test/smoke_test/CMakeLists.txt b/test/smoke_test/CMakeLists.txt
new file mode 100644 (file)
index 0000000..3536cdc
--- /dev/null
@@ -0,0 +1,35 @@
+SET(DESTINATION_DIR unified-installer-ut)
+SET(TARGET_SMOKE_UTILS smoke-utils)
+SET(TARGET_TPK_SMOKE_UTILS tpk-smoke-utils)
+SET(TARGET_WGT_SMOKE_UTILS wgt-smoke-utils)
+
+# Executables
+ADD_EXECUTABLE(${TARGET_SMOKE_TEST}
+  smoke_test.cc
+  smoke_utils.h
+  smoke_utils.cc
+)
+
+ADD_EXECUTABLE(${TARGET_SMOKE_TEST_HELPER}
+  smoke_test_helper.cc
+)
+
+TARGET_INCLUDE_DIRECTORIES(${TARGET_SMOKE_TEST} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../)
+TARGET_INCLUDE_DIRECTORIES(${TARGET_SMOKE_TEST_HELPER} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../)
+
+INSTALL(DIRECTORY test_samples/ DESTINATION ${SHAREDIR}/${DESTINATION_DIR}/test_samples)
+
+APPLY_PKG_CONFIG(${TARGET_SMOKE_TEST} PUBLIC
+  Boost
+  GTEST
+  GUM_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_UNIFIED} ${GTEST_MAIN_LIBRARIES} ${TARGET_SMOKE_UTILS} ${TARGET_TPK_SMOKE_UTILS} ${TARGET_WGT_SMOKE_UTILS})
+TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST_HELPER} PRIVATE ${TARGET_LIBNAME_UNIFIED} ${TARGET_TPK_SMOKE_UTILS} ${TARGET_WGT_SMOKE_UTILS})
+
+INSTALL(TARGETS ${TARGET_SMOKE_TEST} DESTINATION ${BINDIR}/${DESTINATION_DIR})
+INSTALL(TARGETS ${TARGET_SMOKE_TEST_HELPER} DESTINATION ${BINDIR}/${DESTINATION_DIR})
diff --git a/test/smoke_test/smoke_test.cc b/test/smoke_test/smoke_test.cc
new file mode 100644 (file)
index 0000000..4ec003e
--- /dev/null
@@ -0,0 +1,646 @@
+// Copyright (c) 2020 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 <common/utils/subprocess.h>
+
+#include <gtest/gtest.h>
+#include <gtest/gtest-death-test.h>
+
+#include "smoke_test/smoke_utils.h"
+
+namespace ci = common_installer;
+
+namespace smoke_test {
+
+class SmokeEnvironment : public testing::Environment {
+ public:
+  explicit SmokeEnvironment(ci::RequestMode mode) : request_mode_(mode) { }
+
+  void SetUp() override {
+    if (request_mode_ == ci::RequestMode::USER) {
+      ASSERT_TRUE(AddTestUser(&test_user));
+    }
+    backups_ = SetupBackupDirectories(test_user.uid);
+    for (auto& path : backups_)
+      ASSERT_TRUE(BackupPath(path));
+  }
+  void TearDown() override {
+    ASSERT_TRUE(request_mode_ == ci::RequestMode::GLOBAL ||
+                (request_mode_ == ci::RequestMode::USER &&
+                kGlobalUserUid != test_user.uid));
+    BackendInterface::SmokeInstallerFactoryPtr factory(
+        new UnifiedSmokeInstallerFactory());
+    UnifiedBackendInterface backend(
+        std::move(factory), std::to_string(test_user.uid));
+    UninstallAllSmokeApps(request_mode_, test_user.uid, &backend);
+    for (auto& path : backups_)
+      ASSERT_TRUE(RestorePath(path));
+    if (request_mode_ == ci::RequestMode::USER) {
+      ASSERT_TRUE(DeleteTestUser());
+    }
+  }
+  User test_user;
+
+ private:
+  ci::RequestMode request_mode_;
+  std::vector<bf::path> backups_;
+};
+
+}  // namespace smoke_test
+
+
+namespace {
+
+const char kSmokeTestHelperPath[] =
+    "/usr/bin/unified-installer-ut/smoke-test-helper";
+
+smoke_test::SmokeEnvironment *env = nullptr;
+void signalHandler(int signum) {
+  env->TearDown();
+  exit(signum);
+}
+
+}  // namespace
+
+namespace smoke_test {
+
+const bf::path kUnifiedSmokePackagesDirectory =
+    "/usr/share/unified-installer-ut/test_samples/smoke/";
+
+class SmokeTest : public testing::Test {
+ public:
+  SmokeTest()
+    : backend(BackendInterface::SmokeInstallerFactoryPtr(
+              new UnifiedSmokeInstallerFactory()),
+              std::to_string(env->test_user.uid)),
+      params({PackageType::TPK, false}) {
+    params.test_user.uid = env->test_user.uid;
+    params.test_user.gid = env->test_user.gid;
+  }
+ protected:
+  UnifiedBackendInterface backend;
+  TestParameters params;
+};
+
+TEST_F(SmokeTest, Install_Single) {
+  bf::path path =
+      kUnifiedSmokePackagesDirectory / "Install_SingleTpk.tpk";
+  std::string pkgid = "smokeuni01";
+  std::string appid = "smokeuni01.InstallSingleTpk";
+  std::string exec = "smokeunified";
+
+  std::vector<bf::path> paths = { path };
+  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
+  params.pkg_type = PackageType::TPK;
+  ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
+}
+
+TEST_F(SmokeTest, Install_Double) {
+  bf::path path1 =
+      kUnifiedSmokePackagesDirectory / "Install_DoubleTpk.tpk";
+  std::string pkgid1 = "smokeuni02";
+  std::string appid1 = "smokeuni02.InstallDoubleTpk";
+  std::string exec1 = "smokeunified";
+  bf::path path2 =
+      kUnifiedSmokePackagesDirectory / "Install_DoubleWgt.wgt";
+  std::string pkgid2 = "smokeuni03";
+  std::string appid2 = "smokeuni03.InstallDoubleWgt";
+  std::string exec2 = "smokeuni03.InstallDoubleWgt";
+
+  std::vector<bf::path> paths = { path1, path2 };
+  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
+  params.pkg_type = PackageType::TPK;
+  ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
+  params.pkg_type = PackageType::WGT;
+  ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
+}
+
+TEST_F(SmokeTest, Install_Triple) {
+  bf::path path1 =
+      kUnifiedSmokePackagesDirectory / "Install_TripleTpk.tpk";
+  std::string pkgid1 = "smokeuni04";
+  std::string appid1 = "smokeuni04.InstallTripleTpk";
+  std::string exec1 = "smokeunified";
+  bf::path path2 =
+      kUnifiedSmokePackagesDirectory / "Install_TripleWgt.wgt";
+  std::string pkgid2 = "smokeuni05";
+  std::string appid2 = "smokeuni05.InstallTripleWgt";
+  std::string exec2 = "smokeuni05.InstallTripleWgt";
+  bf::path path3 =
+      kUnifiedSmokePackagesDirectory / "Install_TripleHybrid.wgt";
+  std::string pkgid3 = "smokeuni06";
+  std::string appid3 = "smokeuni06.InstallTripleHybrid";
+  std::string exec3 = "smokeuni06.InstallTripleHybrid";
+
+  std::vector<bf::path> paths = { path1, path2, path3 };
+  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
+  params.pkg_type = PackageType::TPK;
+  ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
+  params.pkg_type = PackageType::WGT;
+  ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
+  params.pkg_type = PackageType::HYBRID;
+  ASSERT_TRUE(ValidatePackage(pkgid3, {appid3, exec3}, params));
+}
+
+TEST_F(SmokeTest, Update_Single) {
+  bf::path path_old =
+      kUnifiedSmokePackagesDirectory / "Update_SingleTpk.tpk";
+  bf::path path_new =
+      kUnifiedSmokePackagesDirectory / "Update_SingleTpk_2.tpk";
+  std::string pkgid = "smokeuni07";
+  std::string appid = "smokeuni07.UpdateSingleTpk";
+  std::string exec = "smokeunified";
+
+  std::vector<bf::path> paths = { path_old };
+//  ASSERT_EQ(backend.InstallSuccess(paths), ci::AppInstaller::Result::OK);
+  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
+  paths = { path_new };
+  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
+  params.pkg_type = PackageType::TPK;
+  ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
+  ASSERT_TRUE(
+      ValidateFileContentInPackage(pkgid, "res/VERSION", "2", params));
+}
+
+TEST_F(SmokeTest, Update_Double) {
+  bf::path path1_old =
+      kUnifiedSmokePackagesDirectory / "Update_DoubleTpk.tpk";
+  bf::path path1_new =
+      kUnifiedSmokePackagesDirectory / "Update_DoubleTpk_2.tpk";
+  std::string pkgid1 = "smokeuni08";
+  std::string appid1 = "smokeuni08.UpdateDoubleTpk";
+  std::string exec1 = "smokeunified";
+  bf::path path2_old =
+      kUnifiedSmokePackagesDirectory / "Update_DoubleWgt.wgt";
+  bf::path path2_new =
+      kUnifiedSmokePackagesDirectory / "Update_DoubleWgt_2.wgt";
+  std::string pkgid2 = "smokeuni09";
+  std::string appid2 = "smokeuni09.UpdateDoubleWgt";
+  std::string exec2 = "smokeuni09.UpdateDoubleWgt";
+
+  std::vector<bf::path> paths = { path1_old, path2_old };
+//  ASSERT_EQ(backend.InstallSuccess(paths), ci::AppInstaller::Result::OK);
+  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
+  paths = { path1_new, path2_new };
+  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
+  params.pkg_type = PackageType::TPK;
+  ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
+  params.pkg_type = PackageType::WGT;
+  ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
+  ASSERT_TRUE(
+      ValidateFileContentInPackage(pkgid1, "res/VERSION", "2", params));
+  ASSERT_TRUE(
+      ValidateFileContentInPackage(pkgid2, "res/wgt/VERSION", "2", params));
+}
+
+TEST_F(SmokeTest, Update_Triple) {
+  bf::path path1_old =
+      kUnifiedSmokePackagesDirectory / "Update_TripleTpk.tpk";
+  bf::path path1_new =
+      kUnifiedSmokePackagesDirectory / "Update_TripleTpk_2.tpk";
+  std::string pkgid1 = "smokeuni10";
+  std::string appid1 = "smokeuni10.UpdateTripleTpk";
+  std::string exec1 = "smokeunified";
+  bf::path path2_old =
+      kUnifiedSmokePackagesDirectory / "Update_TripleWgt.wgt";
+  bf::path path2_new =
+      kUnifiedSmokePackagesDirectory / "Update_TripleWgt_2.wgt";
+  std::string pkgid2 = "smokeuni11";
+  std::string appid2 = "smokeuni11.UpdateTripleWgt";
+  std::string exec2 = "smokeuni11.UpdateTripleWgt";
+  bf::path path3_old =
+      kUnifiedSmokePackagesDirectory / "Update_TripleHybrid.wgt";
+  bf::path path3_new =
+      kUnifiedSmokePackagesDirectory / "Update_TripleHybrid_2.wgt";
+  std::string pkgid3 = "smokeuni12";
+  std::string appid3 = "smokeuni12.UpdateTripleHybrid";
+  std::string exec3 = "smokeuni12.UpdateTripleHybrid";
+
+  std::vector<bf::path> paths = { path1_old, path2_old, path3_old };
+//  ASSERT_EQ(backend.InstallSuccess(paths), ci::AppInstaller::Result::OK);
+  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
+  paths = { path1_new, path2_new, path3_new };
+  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
+  params.pkg_type = PackageType::TPK;
+  ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
+  params.pkg_type = PackageType::WGT;
+  ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
+  params.pkg_type = PackageType::HYBRID;
+  ASSERT_TRUE(ValidatePackage(pkgid3, {appid3, exec3}, params));
+  ASSERT_TRUE(
+      ValidateFileContentInPackage(pkgid1, "res/VERSION", "2", params));
+  ASSERT_TRUE(
+      ValidateFileContentInPackage(pkgid2, "res/wgt/VERSION", "2", params));
+  ASSERT_TRUE(
+      ValidateFileContentInPackage(pkgid3, "res/wgt/VERSION", "2", params));
+}
+
+TEST_F(SmokeTest, InstallAndUpdate) {
+  bf::path path1_old =
+      kUnifiedSmokePackagesDirectory / "InstallAndUpdate_Tpk.tpk";
+  bf::path path1_new =
+      kUnifiedSmokePackagesDirectory / "InstallAndUpdate_Tpk_2.tpk";
+  std::string pkgid1 = "smokeuni13";
+  std::string appid1 = "smokeuni13.InstallAndUpdateModeTpk";
+  std::string exec1 = "smokeunified";
+  bf::path path2 =
+      kUnifiedSmokePackagesDirectory / "InstallAndUpdate_Wgt.wgt";
+  std::string pkgid2 = "smokeuni14";
+  std::string appid2 = "smokeuni14.InstallAndUpdateWgt";
+  std::string exec2 = "smokeuni14.InstallAndUpdateWgt";
+
+  // install tpk version 1
+  std::vector<bf::path> paths = { path1_old };
+  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
+  // update tpk version 2, install wgt version 1
+  paths = { path1_new, path2 };
+  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
+  params.pkg_type = PackageType::TPK;
+  ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
+  params.pkg_type = PackageType::WGT;
+  ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
+  ASSERT_TRUE(
+      ValidateFileContentInPackage(pkgid1, "res/VERSION", "2", params));
+}
+
+TEST_F(SmokeTest, InstallAndROUpdate) {
+  bf::path path1_old =
+      kUnifiedSmokePackagesDirectory / "InstallAndROUpdate_Tpk.tpk";
+  bf::path path1_new =
+      kUnifiedSmokePackagesDirectory / "InstallAndROUpdate_Tpk_2.tpk";
+  std::string pkgid1 = "smokeuni25";
+  std::string appid1 = "smokeuni25.InstallAndROUpdateModeTpk";
+  std::string exec1 = "smokeunified";
+  bf::path path2 =
+      kUnifiedSmokePackagesDirectory / "InstallAndROUpdate_Wgt.wgt";
+  std::string pkgid2 = "smokeuni26";
+  std::string appid2 = "smokeuni26.InstallAndROUpdateWgt";
+  std::string exec2 = "smokeuni26.InstallAndROUpdateWgt";
+
+  // install tpk version 1
+  ASSERT_EQ(backend.InstallPreload(path1_old), ci::AppInstaller::Result::OK);
+  // update tpk version 2, install wgt version 1
+  std::vector<bf::path> paths = { path1_new, path2 };
+  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
+  params.pkg_type = PackageType::TPK;
+  ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
+  params.pkg_type = PackageType::WGT;
+  ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
+  ASSERT_TRUE(
+      ValidateFileContentInPackage(pkgid1, "res/VERSION", "2", params));
+}
+
+TEST_F(SmokeTest, Uninstall_Single) {
+  bf::path path =
+      kUnifiedSmokePackagesDirectory / "Uninstall_SingleTpk.tpk";
+  std::string pkgid = "smokeuni29";
+  std::string appid = "smokeuni29.UninstallSingleTpk";
+  std::string exec = "smokeunified";
+
+  std::vector<bf::path> paths = { path };
+  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
+  params.pkg_type = PackageType::TPK;
+  ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
+  std::vector<std::string> pkgids = { pkgid };
+  ASSERT_EQ(backend.Uninstall(pkgids), ci::AppInstaller::Result::OK);
+  ASSERT_TRUE(CheckPackageNonExistance(pkgid, params));
+}
+
+TEST_F(SmokeTest, Uninstall_Double) {
+  bf::path path1 =
+      kUnifiedSmokePackagesDirectory / "Uninstall_DoubleTpk.tpk";
+  std::string pkgid1 = "smokeuni30";
+  std::string appid1 = "smokeuni30.UninstallDoubleTpk";
+  std::string exec1 = "smokeunified";
+  bf::path path2 =
+      kUnifiedSmokePackagesDirectory / "Uninstall_DoubleWgt.wgt";
+  std::string pkgid2 = "smokeuni31";
+  std::string appid2 = "smokeuni31.UninstallDoubleWgt";
+  std::string exec2 = "smokeuni31.UninstallDoubleWgt";
+
+  std::vector<bf::path> paths = { path1, path2 };
+  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
+  params.pkg_type = PackageType::TPK;
+  ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
+  params.pkg_type = PackageType::WGT;
+  ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
+  std::vector<std::string> pkgids = { pkgid1, pkgid2 };
+  ASSERT_EQ(backend.Uninstall(pkgids), ci::AppInstaller::Result::OK);
+  ASSERT_TRUE(CheckPackageNonExistance(pkgid1, params));
+  ASSERT_TRUE(CheckPackageNonExistance(pkgid2, params));
+}
+
+TEST_F(SmokeTest, Uninstall_Triple) {
+  bf::path path1 =
+      kUnifiedSmokePackagesDirectory / "Uninstall_TripleTpk.tpk";
+  std::string pkgid1 = "smokeuni32";
+  std::string appid1 = "smokeuni32.UninstallTripleTpk";
+  std::string exec1 = "smokeunified";
+  bf::path path2 =
+      kUnifiedSmokePackagesDirectory / "Uninstall_TripleWgt.wgt";
+  std::string pkgid2 = "smokeuni33";
+  std::string appid2 = "smokeuni33.UninstallTripleWgt";
+  std::string exec2 = "smokeuni33.UninstallTripleWgt";
+  bf::path path3 =
+      kUnifiedSmokePackagesDirectory / "Uninstall_TripleHybrid.wgt";
+  std::string pkgid3 = "smokeuni34";
+  std::string appid3 = "smokeuni34.UninstallTripleHybrid";
+  std::string exec3 = "smokeuni34.UninstallTripleHybrid";
+
+  std::vector<bf::path> paths = { path1, path2, path3 };
+  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
+  params.pkg_type = PackageType::TPK;
+  ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
+  params.pkg_type = PackageType::WGT;
+  ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
+  params.pkg_type = PackageType::HYBRID;
+  ASSERT_TRUE(ValidatePackage(pkgid3, {appid3, exec3}, params));
+  std::vector<std::string> pkgids = { pkgid1, pkgid2, pkgid3 };
+  ASSERT_EQ(backend.Uninstall(pkgids), ci::AppInstaller::Result::OK);
+  ASSERT_TRUE(CheckPackageNonExistance(pkgid1, params));
+  ASSERT_TRUE(CheckPackageNonExistance(pkgid2, params));
+  ASSERT_TRUE(CheckPackageNonExistance(pkgid3, params));
+}
+
+TEST_F(SmokeTest, UninstallAndROUpdateUninstall) {
+  bf::path path1_old =
+      kUnifiedSmokePackagesDirectory / "UninstallAndROUpdateUninstall_Tpk.tpk";
+  bf::path path1_new =
+      kUnifiedSmokePackagesDirectory /
+      "UninstallAndROUpdateUninstall_Tpk_2.tpk";
+  std::string pkgid1 = "smokeuni35";
+  std::string appid1 = "smokeuni35.UninstallAndROUpdateUninstallTpk";
+  std::string exec1 = "smokeunified";
+  bf::path path2 =
+      kUnifiedSmokePackagesDirectory / "UninstallAndROUpdateUninstall_Wgt.wgt";
+  std::string pkgid2 = "smokeuni36";
+  std::string appid2 = "smokeuni36.UninstallAndROUpdateUninstallWgt";
+  std::string exec2 = "smokeuni36.UninstallAndROUpdateUninstallWgt";
+
+  // install tpk version 1
+  ASSERT_EQ(backend.InstallPreload(path1_old), ci::AppInstaller::Result::OK);
+  ci::PkgQueryInterface pkg_query1(pkgid1, params.test_user.uid);
+  PackageAttributes original(pkg_query1);
+  // update tpk version 2, install wgt version 1
+  std::vector<bf::path> paths = { path1_new, path2 };
+  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
+  params.pkg_type = PackageType::TPK;
+  ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
+  params.pkg_type = PackageType::WGT;
+  ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
+  ASSERT_TRUE(
+      ValidateFileContentInPackage(pkgid1, "res/VERSION", "2", params));
+  // uninstall
+  std::vector<std::string> pkgids = { pkgid1, pkgid2 };
+  ASSERT_EQ(backend.Uninstall(pkgids), ci::AppInstaller::Result::OK);
+  ci::PkgQueryInterface pkg_query2(pkgid1, params.test_user.uid, true);
+  PackageAttributes restored(pkg_query2);
+  ASSERT_EQ(original, restored);
+  ASSERT_TRUE(CheckPackageNonExistance(pkgid2, params));
+  params.pkg_type = PackageType::TPK;
+  params.is_readonly = true;
+  ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
+  ASSERT_TRUE(
+      ValidateFileContentInPackage(pkgid1, "res/VERSION", "1", params));
+}
+
+class RollbackSmokeTest : public testing::Test {
+ public:
+  RollbackSmokeTest()
+    : backend(BackendInterface::SmokeInstallerFactoryPtr(
+              new UnifiedSmokeInstallerFactory()),
+              std::to_string(env->test_user.uid),
+              RequestResult::FAIL),
+      params({PackageType::TPK, false}) {
+    params.test_user.uid = env->test_user.uid;
+    params.test_user.gid = env->test_user.gid;
+  }
+ protected:
+  UnifiedBackendInterface backend;
+  TestParameters params;
+};
+
+TEST_F(RollbackSmokeTest, Install_Rollback) {
+  bf::path path1 =
+      kUnifiedSmokePackagesDirectory / "Install_RollbackTpk.tpk";
+  std::string pkgid1 = "smokeuni15";
+  std::string appid1 = "smokeuni15.InstallRollbackTpk";
+  std::string exec1 = "smokeunified";
+  bf::path path2 =
+      kUnifiedSmokePackagesDirectory / "Install_RollbackWgt.wgt";
+  std::string pkgid2 = "smokeuni16";
+  std::string appid2 = "smokeuni16.InstallRollbackWgt";
+  std::string exec2 = "smokeuni16.InstallRollbackWgt";
+
+  std::vector<bf::path> paths = { path1, path2 };
+  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::ERROR);
+  params.pkg_type = PackageType::TPK;
+  ASSERT_TRUE(CheckPackageNonExistance(pkgid1, params));
+  params.pkg_type = PackageType::WGT;
+  ASSERT_TRUE(CheckPackageNonExistance(pkgid2, params));
+}
+
+TEST_F(RollbackSmokeTest, Update_Rollback) {
+  bf::path path1_old =
+      kUnifiedSmokePackagesDirectory / "Update_RollbackTpk.tpk";
+  bf::path path1_new =
+      kUnifiedSmokePackagesDirectory / "Update_RollbackTpk_2.tpk";
+  std::string pkgid1 = "smokeuni17";
+  std::string appid1 = "smokeuni17.UpdateRollbackTpk";
+  std::string exec1 = "smokeunified";
+  bf::path path2_old =
+      kUnifiedSmokePackagesDirectory / "Update_RollbackWgt.wgt";
+  bf::path path2_new =
+      kUnifiedSmokePackagesDirectory / "Update_RollbackWgt_2.wgt";
+  std::string pkgid2 = "smokeuni18";
+  std::string appid2 = "smokeuni18.UpdateRollbackWgt";
+  std::string exec2 = "smokeuni18.UpdateRollbackWgt";
+
+  std::vector<bf::path> paths = { path1_old, path2_old };
+  ASSERT_EQ(backend.InstallSuccess(paths), ci::AppInstaller::Result::OK);
+  paths = { path1_new, path2_new };
+  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::ERROR);
+
+  params.pkg_type = PackageType::TPK;
+  ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
+  params.pkg_type = PackageType::WGT;
+  ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
+  ASSERT_TRUE(
+      ValidateFileContentInPackage(pkgid1, "res/VERSION", "1", params));
+  ASSERT_TRUE(
+      ValidateFileContentInPackage(pkgid2, "res/wgt/VERSION", "1", params));
+}
+
+TEST_F(RollbackSmokeTest, InstallAndUpdate_Rollback) {
+  bf::path path1 =
+      kUnifiedSmokePackagesDirectory / "InstallAndUpdate_RollbackTpk.tpk";
+  std::string pkgid1 = "smokeuni19";
+  std::string appid1 = "smokeuni19.InstallAndUpdateRollbackTpk";
+  std::string exec1 = "smokeunified";
+  bf::path path2_old =
+      kUnifiedSmokePackagesDirectory / "InstallAndUpdate_RollbackWgt.wgt";
+  bf::path path2_new =
+      kUnifiedSmokePackagesDirectory / "InstallAndUpdate_RollbackWgt_2.wgt";
+  std::string pkgid2 = "smokeuni20";
+  std::string appid2 = "smokeuni20.InstallAndUpdateRollbackWgt";
+  std::string exec2 = "smokeuni20.InstallAndUpdateRollbackWgt";
+
+  std::vector<bf::path> paths = { path2_old };
+  ASSERT_EQ(backend.InstallSuccess(paths), ci::AppInstaller::Result::OK);
+  // pkgid1: install, pkgid2: update
+  paths = { path1, path2_new };
+  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::ERROR);
+
+  params.pkg_type = PackageType::TPK;
+  ASSERT_TRUE(CheckPackageNonExistance(pkgid1, params));
+  params.pkg_type = PackageType::WGT;
+  ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
+  ASSERT_TRUE(
+      ValidateFileContentInPackage(pkgid2, "res/wgt/VERSION", "1", params));
+}
+
+TEST_F(RollbackSmokeTest, InstallAndROUpdate_Rollback) {
+  bf::path path1 =
+      kUnifiedSmokePackagesDirectory / "InstallAndROUpdate_RollbackTpk.tpk";
+  std::string pkgid1 = "smokeuni27";
+  std::string appid1 = "smokeuni27.InstallAndROUpdateRollbackTpk";
+  std::string exec1 = "smokeunified";
+  bf::path path2_old =
+      kUnifiedSmokePackagesDirectory / "InstallAndROUpdate_RollbackWgt.wgt";
+  bf::path path2_new =
+      kUnifiedSmokePackagesDirectory / "InstallAndROUpdate_RollbackWgt_2.wgt";
+  std::string pkgid2 = "smokeuni28";
+  std::string appid2 = "smokeuni28.InstallAndROUpdateRollbackWgt";
+  std::string exec2 = "smokeuni28.InstallAndROUpdateRollbackWgt";
+
+  ASSERT_EQ(backend.InstallPreloadSuccess(path2_old),
+        ci::AppInstaller::Result::OK);
+  // pkgid1: install, pkgid2: update
+  std::vector<bf::path> paths = { path1, path2_new };
+  ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::ERROR);
+  params.pkg_type = PackageType::TPK;
+  ASSERT_TRUE(CheckPackageNonExistance(pkgid1, params));
+  params.pkg_type = PackageType::WGT;
+  params.is_readonly = true;
+  ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
+  ASSERT_TRUE(
+      ValidateFileContentInPackage(pkgid2, "res/wgt/VERSION", "1", params));
+}
+
+TEST_F(SmokeTest, Recovery_Install) {
+  bf::path path1 =
+      kUnifiedSmokePackagesDirectory / "Recovery_InstallTpk.tpk";
+  std::string pkgid1 = "smokeuni21";
+  std::string appid1 = "smokeuni21.RecoveryInstallTpk";
+  std::string exec1 = "smokeunified";
+  bf::path path2 =
+      kUnifiedSmokePackagesDirectory / "Recovery_InstallWgt.wgt";
+  std::string pkgid2 = "smokeuni22";
+  std::string appid2 = "smokeuni22.RecoveryInstallWgt";
+  std::string exec2 = "smokeuni22.RecoveryInstallWgt";
+
+  std::vector<std::string> paths = { path1.string(), path2.string() };
+  ci::Subprocess backend_crash(kSmokeTestHelperPath);
+  std::string test_uid_str = std::to_string(params.test_user.uid);
+  std::vector<std::string> argv = { "-u", test_uid_str, "-i" };
+  argv.insert(argv.end(), paths.begin(), paths.end());
+  backend_crash.Run(argv);
+  ASSERT_NE(backend_crash.Wait(), 0);
+
+  bf::path recovery_file =
+      FindRecoveryFile("/tpk-recovery", params.test_user.uid);
+  ASSERT_FALSE(recovery_file.empty());
+  std::unique_ptr<ci::recovery::RecoveryFile> recovery_info =
+      GetRecoverFileInfo(recovery_file);
+  ASSERT_TRUE(recovery_info);
+  ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK);
+  params.pkg_type = PackageType::TPK;
+  ASSERT_TRUE(CheckPackageNonExistance(pkgid1, params));
+  ASSERT_FALSE(bf::exists(recovery_info->unpacked_dir()));
+
+  recovery_file =
+      FindRecoveryFile("/wgt-recovery", params.test_user.uid);
+  ASSERT_FALSE(recovery_file.empty());
+  recovery_info.reset();
+  recovery_info = GetRecoverFileInfo(recovery_file);
+  ASSERT_TRUE(recovery_info);
+  ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK);
+  params.pkg_type = PackageType::WGT;
+  ASSERT_TRUE(CheckPackageNonExistance(pkgid2, params));
+  ASSERT_FALSE(bf::exists(recovery_info->unpacked_dir()));
+}
+
+TEST_F(SmokeTest, Recovery_Update) {
+  bf::path path1_old =
+      kUnifiedSmokePackagesDirectory / "Recovery_UpdateTpk.tpk";
+  bf::path path1_new =
+      kUnifiedSmokePackagesDirectory / "Recovery_UpdateTpk_2.tpk";
+  std::string pkgid1 = "smokeuni23";
+  std::string appid1 = "smokeuni23.RecoveryUpdateTpk";
+  std::string exec1 = "smokeunified";
+  bf::path path2_old =
+      kUnifiedSmokePackagesDirectory / "Recovery_UpdateWgt.wgt";
+  bf::path path2_new =
+      kUnifiedSmokePackagesDirectory / "Recovery_UpdateWgt_2.wgt";
+  std::string pkgid2 = "smokeuni24";
+  std::string appid2 = "smokeuni24.RecoveryUpdateWgt";
+  std::string exec2 = "smokeuni24.RecoveryUpdateWgt";
+
+  std::vector<bf::path> paths_old = { path1_old, path2_old };
+  ASSERT_EQ(backend.Install(paths_old), ci::AppInstaller::Result::OK);
+
+  std::vector<std::string> paths = { path1_new.string(), path2_new.string() };
+  ci::Subprocess backend_crash(kSmokeTestHelperPath);
+  std::string test_uid_str = std::to_string(params.test_user.uid);
+  std::vector<std::string> argv = { "-u", test_uid_str, "-i" };
+  argv.insert(argv.end(), paths.begin(), paths.end());
+  backend_crash.Run(argv);
+  ASSERT_NE(backend_crash.Wait(), 0);
+
+  bf::path recovery_file =
+      FindRecoveryFile("/tpk-recovery", params.test_user.uid);
+  ASSERT_FALSE(recovery_file.empty());
+  std::unique_ptr<ci::recovery::RecoveryFile> recovery_info =
+      GetRecoverFileInfo(recovery_file);
+  ASSERT_TRUE(recovery_info);
+  ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK);
+  params.pkg_type = PackageType::TPK;
+  ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
+  ASSERT_TRUE(
+      ValidateFileContentInPackage(pkgid1, "res/VERSION", "1", params));
+
+  recovery_file =
+      FindRecoveryFile("/wgt-recovery", params.test_user.uid);
+  ASSERT_FALSE(recovery_file.empty());
+  recovery_info.reset();
+  recovery_info = GetRecoverFileInfo(recovery_file);
+  ASSERT_TRUE(recovery_info);
+  ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK);
+  params.pkg_type = PackageType::WGT;
+  ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
+  ASSERT_TRUE(
+      ValidateFileContentInPackage(pkgid2, "res/wgt/VERSION", "1", params));
+}
+
+}  // namespace smoke_test
+
+int main(int argc, char** argv) {
+  try {
+    ci::RequestMode request_mode = smoke_test::ParseRequestMode(argc, argv);
+    if (getuid() != 0 || request_mode != ci::RequestMode::GLOBAL) {
+      std::cout << "Skip tests for preload request" << std::endl;
+      ::testing::GTEST_FLAG(filter) = "SmokeTest.*";
+    }
+    testing::InitGoogleTest(&argc, argv);
+    ::env = static_cast<smoke_test::SmokeEnvironment*>(
+        testing::AddGlobalTestEnvironment(
+          new smoke_test::SmokeEnvironment(request_mode)));
+    signal(SIGINT, ::signalHandler);
+    signal(SIGSEGV, ::signalHandler);
+    return RUN_ALL_TESTS();
+  } catch (...) {
+    std::cout << "Exception occurred during testing" << std::endl;
+    return -1;
+  }
+}
diff --git a/test/smoke_test/smoke_test_helper.cc b/test/smoke_test/smoke_test_helper.cc
new file mode 100644 (file)
index 0000000..78ace41
--- /dev/null
@@ -0,0 +1,79 @@
+// Copyright (c) 2020 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 <common/installer_factory.h>
+#include <common/installer_runner.h>
+#include <common/pkgmgr_interface.h>
+#include <tpk/tpk_app_query_interface.h>
+#include <unit_tests/common/smoke_utils.h>
+#include <unit_tests/tpk_smoke_utils.h>
+#include <unit_tests/wgt_smoke_utils.h>
+#include <wgt/utils/wgt_app_query_interface.h>
+
+#include <algorithm>
+#include <memory>
+#include <string>
+
+namespace ci = common_installer;
+
+namespace {
+
+bool EndsWith(const std::string str, const std::string& to_match) {
+  if (to_match.size() > str.size())
+    return false;
+  return std::equal(to_match.rbegin(), to_match.rend(), str.rbegin());
+}
+
+#if __cplusplus < 201300L
+template<typename T, typename... Args>
+std::unique_ptr<T> make_unique(Args&&... args) {
+  return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
+}
+#endif
+
+}  // namespace
+
+class CrashInstallerFactory : public ci::InstallerFactory {
+ public:
+  std::unique_ptr<ci::AppInstaller> CreateInstaller(ci::PkgMgrPtr pkgmgr,
+      int idx) override {
+    std::string type =
+        EndsWith(pkgmgr->GetRequestInfo(idx), "tpk") ? "tpk" : "wgt";
+    int n_pkgs = pkgmgr->GetRequestInfoCount();
+    std::unique_ptr<ci::AppInstaller> installer;
+    if (type == "tpk") {
+      tpk::TpkAppQueryInterface* tpk_aqi = new tpk::TpkAppQueryInterface();
+      pkgmgr->AddAppQueryInterface(idx, tpk_aqi);
+      installer.reset(
+          idx + 1 == n_pkgs ?
+              new smoke_test::CrashTpkInstaller(pkgmgr, -1, {},
+                  smoke_test::CrashStepType::PROCESS) :
+              new tpk::TpkInstaller(pkgmgr));
+
+    } else {
+      wgt::WgtAppQueryInterface* wgt_aqi = new wgt::WgtAppQueryInterface();
+      pkgmgr->AddAppQueryInterface(idx, wgt_aqi);
+      installer.reset(
+          idx + 1 == n_pkgs ?
+              new smoke_test::CrashWgtInstaller(pkgmgr, -1, {},
+                  smoke_test::CrashStepType::PROCESS) :
+              new wgt::WgtInstaller(pkgmgr));
+    }
+    installer->SetIndex(idx);
+    return installer;
+  }
+};
+
+int main(int argc, char** argv) {
+  ci::PkgmgrInstaller pkgmgr_installer;
+  auto pkgmgr = ci::PkgMgrInterface::Create(argc, argv, &pkgmgr_installer);
+
+#if __cplusplus >= 201300L
+  using std;
+#endif
+  ci::InstallerRunner runner(make_unique<CrashInstallerFactory>(), pkgmgr);
+  ci::AppInstaller::Result result = runner.Run();
+
+  return (result == ci::AppInstaller::Result::OK) ? 0 : 1;
+}
diff --git a/test/smoke_test/smoke_utils.cc b/test/smoke_test/smoke_utils.cc
new file mode 100644 (file)
index 0000000..49221f8
--- /dev/null
@@ -0,0 +1,151 @@
+// Copyright (c) 2020 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 "smoke_test/smoke_utils.h"
+
+#include <unit_tests/common/smoke_utils.h>
+#include <unit_tests/tpk_smoke_utils.h>
+#include <unit_tests/wgt_smoke_utils.h>
+#include <unzip.h>
+
+#include <map>
+#include <string>
+
+namespace bf = boost::filesystem;
+namespace ci = common_installer;
+
+namespace {
+
+std::map<const char*, const char*> kTypeMap = {
+  {"res/wgt/config.xml", "wgt"},
+  {"config.xml", "wgt"},
+  {"tizen-manifest.xml", "tpk"},
+};
+
+std::string GetPkgTypeFromPkgid(const std::string& pkgid, uid_t uid) {
+  ci::PkgQueryInterface query(pkgid, uid);
+  return query.Type();
+}
+
+std::string GetPkgTypeFromPath(const std::string& path) {
+  std::string type;
+  unzFile uf = unzOpen(path.c_str());
+  if (!uf) {
+    LOG(ERROR) << "Failed to open zip file: " << path;
+    return type;
+  }
+  for (auto it : kTypeMap) {
+    if (unzLocateFile(uf, it.first, 0) == UNZ_OK) {
+      LOG(DEBUG) << "Found: " << it.first;
+      type = it.second;
+      break;
+    }
+  }
+  if (type.empty())
+    LOG(ERROR) << "Cannot get pkg type";
+  unzClose(uf);
+  return type;
+}
+
+std::string GetPkgTypeFromRecoveryFile(const std::string& path) {
+  bf::path recovery_file = path;
+  if (recovery_file.filename().string().find("tpk") == 0)
+    return "tpk";
+  else if (recovery_file.filename().string().find("wgt") == 0)
+    return "wgt";
+  return {};
+}
+
+std::string GetPkgType(const std::string& pkginfo, uid_t uid) {
+  std::string type = GetPkgTypeFromPkgid(pkginfo, uid);
+  if (type.empty())
+    type = GetPkgTypeFromPath(pkginfo);
+  // recovery file
+  if (type.empty())
+    type = GetPkgTypeFromRecoveryFile(pkginfo);
+  return type;
+}
+
+}  // namespace
+
+namespace smoke_test {
+
+UnifiedSmokeInstallerFactory::AppInstallerPtr
+UnifiedSmokeInstallerFactory::CreateInstaller(
+    int idx, ci::PkgMgrPtr pkgmgr) const {
+  std::string type = GetPkgType(pkgmgr->GetRequestInfo(idx), pkgmgr->GetUid());
+  if (type.empty())
+    return {};
+
+  std::unique_ptr<ci::AppInstaller> installer;
+  if (type == "tpk") {
+    tpk::TpkAppQueryInterface* tpk_aqi = new tpk::TpkAppQueryInterface();
+    pkgmgr->AddAppQueryInterface(idx, tpk_aqi);
+    installer.reset(new tpk::TpkInstaller(pkgmgr));
+  } else {
+    wgt::WgtAppQueryInterface* wgt_aqi = new wgt::WgtAppQueryInterface();
+    pkgmgr->AddAppQueryInterface(idx, wgt_aqi);
+    if (wgt_aqi->IsHybridApplication(pkgmgr->GetRequestInfo(idx),
+            pkgmgr->GetUid())) {
+      LOG(INFO) << "Hybrid package detected";
+      installer.reset(new hybrid::HybridInstaller(pkgmgr));
+    } else {
+      installer.reset(new wgt::WgtInstaller(pkgmgr));
+    }
+  }
+
+  installer->SetIndex(idx);
+
+  return installer;
+}
+
+UnifiedSmokeInstallerFactory::AppInstallerPtr
+UnifiedSmokeInstallerFactory::CreateFailExpectedInstaller(
+    int idx, ci::PkgMgrPtr pkgmgr, int fail_at) const {
+  std::string type = GetPkgType(pkgmgr->GetRequestInfo(idx), pkgmgr->GetUid());
+  if (type.empty())
+    return {};
+
+  std::unique_ptr<ci::AppInstaller> installer;
+  if (type == "tpk") {
+    tpk::TpkAppQueryInterface* tpk_aqi = new tpk::TpkAppQueryInterface();
+    pkgmgr->AddAppQueryInterface(idx, tpk_aqi);
+    installer.reset(new smoke_test::FailExpectedTpkInstaller(pkgmgr, fail_at));
+  } else {
+    wgt::WgtAppQueryInterface* wgt_aqi = new wgt::WgtAppQueryInterface();
+    pkgmgr->AddAppQueryInterface(idx, wgt_aqi);
+    if (wgt_aqi->IsHybridApplication(pkgmgr->GetRequestInfo(idx),
+            pkgmgr->GetUid())) {
+      LOG(INFO) << "Hybrid package detected";
+      installer.reset(
+          new smoke_test::FailExpectedHybridInstaller(pkgmgr, fail_at));
+    } else {
+      installer.reset(
+          new smoke_test::FailExpectedWgtInstaller(pkgmgr, fail_at));
+    }
+  }
+
+  installer->SetIndex(idx);
+
+  return installer;
+}
+
+UnifiedBackendInterface::AppQueryInterfacePtr
+UnifiedBackendInterface::CreateQueryInterface() const {
+  // this is not used
+  return {};
+}
+
+UnifiedBackendInterface::AppInstallerPtr
+UnifiedBackendInterface::CreateInstaller(ci::PkgMgrPtr pkgmgr) const {
+  return factory_->CreateInstaller(0, pkgmgr);
+}
+
+UnifiedBackendInterface::AppInstallerPtr
+UnifiedBackendInterface::CreateFailExpectedInstaller(
+    ci::PkgMgrPtr pkgmgr, int fail_at) const {
+  return factory_->CreateFailExpectedInstaller(0, pkgmgr, fail_at);;
+}
+
+}  // namespace smoke_test
diff --git a/test/smoke_test/smoke_utils.h b/test/smoke_test/smoke_utils.h
new file mode 100644 (file)
index 0000000..3ce24f5
--- /dev/null
@@ -0,0 +1,36 @@
+// Copyright (c) 2020 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/installer/app_installer.h>
+#include <common/pkgmgr_interface.h>
+#include <unit_tests/common/smoke_utils.h>
+#include <unit_tests/tpk_smoke_utils.h>
+
+namespace smoke_test {
+
+class UnifiedSmokeInstallerFactory : public SmokeInstallerFactory {
+ public:
+  AppInstallerPtr CreateInstaller(
+      int idx, common_installer::PkgMgrPtr pkgmgr) const override;
+  AppInstallerPtr CreateFailExpectedInstaller(
+      int idx, common_installer::PkgMgrPtr pkgmgr, int fail_at) const override;
+};
+
+class UnifiedBackendInterface : public BackendInterface {
+ public:
+  using BackendInterface::BackendInterface;
+
+  AppQueryInterfacePtr CreateQueryInterface() const override;
+  AppInstallerPtr CreateInstaller(
+      common_installer::PkgMgrPtr pkgmgr) const override;
+  AppInstallerPtr CreateFailExpectedInstaller(
+      common_installer::PkgMgrPtr pkgmgr, int fail_at) const override;
+};
+
+}  // namespace smoke_test
+
+#endif  // UNIT_TESTS_SMOKE_UTILS_H_
diff --git a/test/smoke_test/test_samples/smoke/InstallAndROUpdate_RollbackTpk.tpk b/test/smoke_test/test_samples/smoke/InstallAndROUpdate_RollbackTpk.tpk
new file mode 100644 (file)
index 0000000..b9342ca
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/InstallAndROUpdate_RollbackTpk.tpk differ
diff --git a/test/smoke_test/test_samples/smoke/InstallAndROUpdate_RollbackWgt.wgt b/test/smoke_test/test_samples/smoke/InstallAndROUpdate_RollbackWgt.wgt
new file mode 100644 (file)
index 0000000..bad3112
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/InstallAndROUpdate_RollbackWgt.wgt differ
diff --git a/test/smoke_test/test_samples/smoke/InstallAndROUpdate_RollbackWgt_2.wgt b/test/smoke_test/test_samples/smoke/InstallAndROUpdate_RollbackWgt_2.wgt
new file mode 100644 (file)
index 0000000..8d0f6fc
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/InstallAndROUpdate_RollbackWgt_2.wgt differ
diff --git a/test/smoke_test/test_samples/smoke/InstallAndROUpdate_Tpk.tpk b/test/smoke_test/test_samples/smoke/InstallAndROUpdate_Tpk.tpk
new file mode 100644 (file)
index 0000000..df5f2f2
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/InstallAndROUpdate_Tpk.tpk differ
diff --git a/test/smoke_test/test_samples/smoke/InstallAndROUpdate_Tpk_2.tpk b/test/smoke_test/test_samples/smoke/InstallAndROUpdate_Tpk_2.tpk
new file mode 100644 (file)
index 0000000..9fb1f4d
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/InstallAndROUpdate_Tpk_2.tpk differ
diff --git a/test/smoke_test/test_samples/smoke/InstallAndROUpdate_Wgt.wgt b/test/smoke_test/test_samples/smoke/InstallAndROUpdate_Wgt.wgt
new file mode 100644 (file)
index 0000000..08cdb5c
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/InstallAndROUpdate_Wgt.wgt differ
diff --git a/test/smoke_test/test_samples/smoke/InstallAndUpdate_RollbackTpk.tpk b/test/smoke_test/test_samples/smoke/InstallAndUpdate_RollbackTpk.tpk
new file mode 100644 (file)
index 0000000..ed9986f
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/InstallAndUpdate_RollbackTpk.tpk differ
diff --git a/test/smoke_test/test_samples/smoke/InstallAndUpdate_RollbackWgt.wgt b/test/smoke_test/test_samples/smoke/InstallAndUpdate_RollbackWgt.wgt
new file mode 100644 (file)
index 0000000..7b7eec8
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/InstallAndUpdate_RollbackWgt.wgt differ
diff --git a/test/smoke_test/test_samples/smoke/InstallAndUpdate_RollbackWgt_2.wgt b/test/smoke_test/test_samples/smoke/InstallAndUpdate_RollbackWgt_2.wgt
new file mode 100644 (file)
index 0000000..5ce4a31
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/InstallAndUpdate_RollbackWgt_2.wgt differ
diff --git a/test/smoke_test/test_samples/smoke/InstallAndUpdate_Tpk.tpk b/test/smoke_test/test_samples/smoke/InstallAndUpdate_Tpk.tpk
new file mode 100644 (file)
index 0000000..a1962e7
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/InstallAndUpdate_Tpk.tpk differ
diff --git a/test/smoke_test/test_samples/smoke/InstallAndUpdate_Tpk_2.tpk b/test/smoke_test/test_samples/smoke/InstallAndUpdate_Tpk_2.tpk
new file mode 100644 (file)
index 0000000..b89491f
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/InstallAndUpdate_Tpk_2.tpk differ
diff --git a/test/smoke_test/test_samples/smoke/InstallAndUpdate_Wgt.wgt b/test/smoke_test/test_samples/smoke/InstallAndUpdate_Wgt.wgt
new file mode 100644 (file)
index 0000000..9693927
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/InstallAndUpdate_Wgt.wgt differ
diff --git a/test/smoke_test/test_samples/smoke/Install_DoubleTpk.tpk b/test/smoke_test/test_samples/smoke/Install_DoubleTpk.tpk
new file mode 100644 (file)
index 0000000..dd2cacf
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Install_DoubleTpk.tpk differ
diff --git a/test/smoke_test/test_samples/smoke/Install_DoubleWgt.wgt b/test/smoke_test/test_samples/smoke/Install_DoubleWgt.wgt
new file mode 100644 (file)
index 0000000..012ad4b
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Install_DoubleWgt.wgt differ
diff --git a/test/smoke_test/test_samples/smoke/Install_RollbackTpk.tpk b/test/smoke_test/test_samples/smoke/Install_RollbackTpk.tpk
new file mode 100644 (file)
index 0000000..4ccaf24
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Install_RollbackTpk.tpk differ
diff --git a/test/smoke_test/test_samples/smoke/Install_RollbackWgt.wgt b/test/smoke_test/test_samples/smoke/Install_RollbackWgt.wgt
new file mode 100644 (file)
index 0000000..4a13903
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Install_RollbackWgt.wgt differ
diff --git a/test/smoke_test/test_samples/smoke/Install_SingleTpk.tpk b/test/smoke_test/test_samples/smoke/Install_SingleTpk.tpk
new file mode 100644 (file)
index 0000000..6ff90ec
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Install_SingleTpk.tpk differ
diff --git a/test/smoke_test/test_samples/smoke/Install_TripleHybrid.wgt b/test/smoke_test/test_samples/smoke/Install_TripleHybrid.wgt
new file mode 100644 (file)
index 0000000..6da86a3
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Install_TripleHybrid.wgt differ
diff --git a/test/smoke_test/test_samples/smoke/Install_TripleTpk.tpk b/test/smoke_test/test_samples/smoke/Install_TripleTpk.tpk
new file mode 100644 (file)
index 0000000..7fda828
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Install_TripleTpk.tpk differ
diff --git a/test/smoke_test/test_samples/smoke/Install_TripleWgt.wgt b/test/smoke_test/test_samples/smoke/Install_TripleWgt.wgt
new file mode 100644 (file)
index 0000000..bd63e79
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Install_TripleWgt.wgt differ
diff --git a/test/smoke_test/test_samples/smoke/Recovery_InstallTpk.tpk b/test/smoke_test/test_samples/smoke/Recovery_InstallTpk.tpk
new file mode 100644 (file)
index 0000000..b7f3dca
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Recovery_InstallTpk.tpk differ
diff --git a/test/smoke_test/test_samples/smoke/Recovery_InstallWgt.wgt b/test/smoke_test/test_samples/smoke/Recovery_InstallWgt.wgt
new file mode 100644 (file)
index 0000000..66844e2
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Recovery_InstallWgt.wgt differ
diff --git a/test/smoke_test/test_samples/smoke/Recovery_UpdateTpk.tpk b/test/smoke_test/test_samples/smoke/Recovery_UpdateTpk.tpk
new file mode 100644 (file)
index 0000000..8d5ab7b
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Recovery_UpdateTpk.tpk differ
diff --git a/test/smoke_test/test_samples/smoke/Recovery_UpdateTpk_2.tpk b/test/smoke_test/test_samples/smoke/Recovery_UpdateTpk_2.tpk
new file mode 100644 (file)
index 0000000..75f5342
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Recovery_UpdateTpk_2.tpk differ
diff --git a/test/smoke_test/test_samples/smoke/Recovery_UpdateWgt.wgt b/test/smoke_test/test_samples/smoke/Recovery_UpdateWgt.wgt
new file mode 100644 (file)
index 0000000..fcf60aa
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Recovery_UpdateWgt.wgt differ
diff --git a/test/smoke_test/test_samples/smoke/Recovery_UpdateWgt_2.wgt b/test/smoke_test/test_samples/smoke/Recovery_UpdateWgt_2.wgt
new file mode 100644 (file)
index 0000000..8f28138
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Recovery_UpdateWgt_2.wgt differ
diff --git a/test/smoke_test/test_samples/smoke/UninstallAndROUpdateUninstall_Tpk.tpk b/test/smoke_test/test_samples/smoke/UninstallAndROUpdateUninstall_Tpk.tpk
new file mode 100644 (file)
index 0000000..01c4902
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/UninstallAndROUpdateUninstall_Tpk.tpk differ
diff --git a/test/smoke_test/test_samples/smoke/UninstallAndROUpdateUninstall_Tpk_2.tpk b/test/smoke_test/test_samples/smoke/UninstallAndROUpdateUninstall_Tpk_2.tpk
new file mode 100644 (file)
index 0000000..67043eb
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/UninstallAndROUpdateUninstall_Tpk_2.tpk differ
diff --git a/test/smoke_test/test_samples/smoke/UninstallAndROUpdateUninstall_Wgt.wgt b/test/smoke_test/test_samples/smoke/UninstallAndROUpdateUninstall_Wgt.wgt
new file mode 100644 (file)
index 0000000..becb791
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/UninstallAndROUpdateUninstall_Wgt.wgt differ
diff --git a/test/smoke_test/test_samples/smoke/Uninstall_DoubleTpk.tpk b/test/smoke_test/test_samples/smoke/Uninstall_DoubleTpk.tpk
new file mode 100644 (file)
index 0000000..fcd6a1a
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Uninstall_DoubleTpk.tpk differ
diff --git a/test/smoke_test/test_samples/smoke/Uninstall_DoubleWgt.wgt b/test/smoke_test/test_samples/smoke/Uninstall_DoubleWgt.wgt
new file mode 100644 (file)
index 0000000..ac9d7fb
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Uninstall_DoubleWgt.wgt differ
diff --git a/test/smoke_test/test_samples/smoke/Uninstall_SingleTpk.tpk b/test/smoke_test/test_samples/smoke/Uninstall_SingleTpk.tpk
new file mode 100644 (file)
index 0000000..6b59e8d
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Uninstall_SingleTpk.tpk differ
diff --git a/test/smoke_test/test_samples/smoke/Uninstall_TripleHybrid.wgt b/test/smoke_test/test_samples/smoke/Uninstall_TripleHybrid.wgt
new file mode 100644 (file)
index 0000000..5a4fa88
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Uninstall_TripleHybrid.wgt differ
diff --git a/test/smoke_test/test_samples/smoke/Uninstall_TripleTpk.tpk b/test/smoke_test/test_samples/smoke/Uninstall_TripleTpk.tpk
new file mode 100644 (file)
index 0000000..1d348c4
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Uninstall_TripleTpk.tpk differ
diff --git a/test/smoke_test/test_samples/smoke/Uninstall_TripleWgt.wgt b/test/smoke_test/test_samples/smoke/Uninstall_TripleWgt.wgt
new file mode 100644 (file)
index 0000000..9b9f867
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Uninstall_TripleWgt.wgt differ
diff --git a/test/smoke_test/test_samples/smoke/Update_DoubleTpk.tpk b/test/smoke_test/test_samples/smoke/Update_DoubleTpk.tpk
new file mode 100644 (file)
index 0000000..dbee219
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Update_DoubleTpk.tpk differ
diff --git a/test/smoke_test/test_samples/smoke/Update_DoubleTpk_2.tpk b/test/smoke_test/test_samples/smoke/Update_DoubleTpk_2.tpk
new file mode 100644 (file)
index 0000000..5dd7d91
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Update_DoubleTpk_2.tpk differ
diff --git a/test/smoke_test/test_samples/smoke/Update_DoubleWgt.wgt b/test/smoke_test/test_samples/smoke/Update_DoubleWgt.wgt
new file mode 100644 (file)
index 0000000..ba5a98d
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Update_DoubleWgt.wgt differ
diff --git a/test/smoke_test/test_samples/smoke/Update_DoubleWgt_2.wgt b/test/smoke_test/test_samples/smoke/Update_DoubleWgt_2.wgt
new file mode 100644 (file)
index 0000000..58d4039
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Update_DoubleWgt_2.wgt differ
diff --git a/test/smoke_test/test_samples/smoke/Update_RollbackTpk.tpk b/test/smoke_test/test_samples/smoke/Update_RollbackTpk.tpk
new file mode 100644 (file)
index 0000000..2d9065d
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Update_RollbackTpk.tpk differ
diff --git a/test/smoke_test/test_samples/smoke/Update_RollbackTpk_2.tpk b/test/smoke_test/test_samples/smoke/Update_RollbackTpk_2.tpk
new file mode 100644 (file)
index 0000000..96dc4fd
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Update_RollbackTpk_2.tpk differ
diff --git a/test/smoke_test/test_samples/smoke/Update_RollbackWgt.wgt b/test/smoke_test/test_samples/smoke/Update_RollbackWgt.wgt
new file mode 100644 (file)
index 0000000..6d670e1
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Update_RollbackWgt.wgt differ
diff --git a/test/smoke_test/test_samples/smoke/Update_RollbackWgt_2.wgt b/test/smoke_test/test_samples/smoke/Update_RollbackWgt_2.wgt
new file mode 100644 (file)
index 0000000..71e23b0
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Update_RollbackWgt_2.wgt differ
diff --git a/test/smoke_test/test_samples/smoke/Update_SingleTpk.tpk b/test/smoke_test/test_samples/smoke/Update_SingleTpk.tpk
new file mode 100644 (file)
index 0000000..ab44827
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Update_SingleTpk.tpk differ
diff --git a/test/smoke_test/test_samples/smoke/Update_SingleTpk_2.tpk b/test/smoke_test/test_samples/smoke/Update_SingleTpk_2.tpk
new file mode 100644 (file)
index 0000000..e414f11
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Update_SingleTpk_2.tpk differ
diff --git a/test/smoke_test/test_samples/smoke/Update_TripleHybrid.wgt b/test/smoke_test/test_samples/smoke/Update_TripleHybrid.wgt
new file mode 100644 (file)
index 0000000..7ae8eed
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Update_TripleHybrid.wgt differ
diff --git a/test/smoke_test/test_samples/smoke/Update_TripleHybrid_2.wgt b/test/smoke_test/test_samples/smoke/Update_TripleHybrid_2.wgt
new file mode 100644 (file)
index 0000000..10c2ee5
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Update_TripleHybrid_2.wgt differ
diff --git a/test/smoke_test/test_samples/smoke/Update_TripleTpk.tpk b/test/smoke_test/test_samples/smoke/Update_TripleTpk.tpk
new file mode 100644 (file)
index 0000000..9362636
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Update_TripleTpk.tpk differ
diff --git a/test/smoke_test/test_samples/smoke/Update_TripleTpk_2.tpk b/test/smoke_test/test_samples/smoke/Update_TripleTpk_2.tpk
new file mode 100644 (file)
index 0000000..7dac47d
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Update_TripleTpk_2.tpk differ
diff --git a/test/smoke_test/test_samples/smoke/Update_TripleWgt.wgt b/test/smoke_test/test_samples/smoke/Update_TripleWgt.wgt
new file mode 100644 (file)
index 0000000..85bcbe8
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Update_TripleWgt.wgt differ
diff --git a/test/smoke_test/test_samples/smoke/Update_TripleWgt_2.wgt b/test/smoke_test/test_samples/smoke/Update_TripleWgt_2.wgt
new file mode 100644 (file)
index 0000000..1b23d6e
Binary files /dev/null and b/test/smoke_test/test_samples/smoke/Update_TripleWgt_2.wgt differ