Smoke tests for TEP 94/87494/3
authorTomasz Iwanek <t.iwanek@samsung.com>
Wed, 7 Sep 2016 14:11:44 +0000 (16:11 +0200)
committerTomasz Iwanek <t.iwanek@samsung.com>
Fri, 9 Sep 2016 13:02:32 +0000 (06:02 -0700)
Run new tests to verify.

Requires:
 - https://review.tizen.org/gerrit/87493

Change-Id: Ie6a24c2e90b8a762d3d71356f4ba3cacecc11cbb

17 files changed:
src/unit_tests/smoke_test.cc
src/unit_tests/test_samples/smoke/TEP_Tpk1.tpk [new file with mode: 0644]
src/unit_tests/test_samples/smoke/TEP_Tpk10.tpk [new file with mode: 0644]
src/unit_tests/test_samples/smoke/TEP_Tpk11.tpk [new file with mode: 0644]
src/unit_tests/test_samples/smoke/TEP_Tpk12.tpk [new file with mode: 0644]
src/unit_tests/test_samples/smoke/TEP_Tpk13.tpk [new file with mode: 0644]
src/unit_tests/test_samples/smoke/TEP_Tpk14.tpk [new file with mode: 0644]
src/unit_tests/test_samples/smoke/TEP_Tpk2.tpk [new file with mode: 0644]
src/unit_tests/test_samples/smoke/TEP_Tpk3.tpk [new file with mode: 0644]
src/unit_tests/test_samples/smoke/TEP_Tpk4.tpk [new file with mode: 0644]
src/unit_tests/test_samples/smoke/TEP_Tpk5.tpk [new file with mode: 0644]
src/unit_tests/test_samples/smoke/TEP_Tpk6.tpk [new file with mode: 0644]
src/unit_tests/test_samples/smoke/TEP_Tpk7.tpk [new file with mode: 0644]
src/unit_tests/test_samples/smoke/TEP_Tpk8.tpk [new file with mode: 0644]
src/unit_tests/test_samples/smoke/TEP_Tpk9.tpk [new file with mode: 0644]
src/unit_tests/test_samples/smoke/tep1.tep [new file with mode: 0644]
src/unit_tests/test_samples/smoke/tep2.tep [new file with mode: 0644]

index de42c5e..b502ed2 100644 (file)
@@ -251,12 +251,22 @@ ci::AppInstaller::Result CallBackend(int argc,
   }
   return RunInstallerWithPkgrmgr(pkgmgr, mode);
 }
+
 ci::AppInstaller::Result Install(const bf::path& path,
                                  RequestResult mode = RequestResult::NORMAL) {
   const char* argv[] = {"", "-i", path.c_str(), "-u", kTestUserIdStr.c_str()};
   return CallBackend(SIZEOFARRAY(argv), argv, mode);
 }
 
+ci::AppInstaller::Result InstallWithTEP(
+    const bf::path& path,
+    const bf::path& tep,
+    RequestResult mode = RequestResult::NORMAL) {
+  const char* argv[] = {"", "-i", path.c_str(), "-u", kTestUserIdStr.c_str(),
+                        "-e", tep.c_str()};
+  return CallBackend(SIZEOFARRAY(argv), argv, mode);
+}
+
 ci::AppInstaller::Result Update(const bf::path& path_old,
                                 const bf::path& path_new,
                                 RequestResult mode = RequestResult::NORMAL) {
@@ -273,6 +283,15 @@ ci::AppInstaller::Result MountInstall(const bf::path& path,
   return CallBackend(SIZEOFARRAY(argv), argv, mode);
 }
 
+ci::AppInstaller::Result MountInstallWithTEP(
+    const bf::path& path,
+    const bf::path& tep,
+    RequestResult mode = RequestResult::NORMAL) {
+  const char* argv[] = {"", "-w", path.c_str(), "-u", kTestUserIdStr.c_str(),
+                        "-e", tep.c_str()};
+  return CallBackend(SIZEOFARRAY(argv), argv, mode);
+}
+
 ci::AppInstaller::Result MountUpdate(const bf::path& path_old,
                                 const bf::path& path_new,
                                 RequestResult mode = RequestResult::NORMAL) {
@@ -560,6 +579,145 @@ TEST_F(SmokeTest, MountUpdateMode_Tpk) {
   ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/VERSION", "2\n"));
 }
 
+#define TEP_TEST_STARTING_BLOCK(NUMBER)                                        \
+  bf::path path = kSmokePackagesDirectory / "TEP_Tpk";                         \
+  path += #NUMBER;                                                             \
+  path += ".tpk";                                                              \
+  bf::path tep1 = kSmokePackagesDirectory / "tep1.tep";                        \
+  bf::path tep2 = kSmokePackagesDirectory / "tep2.tep";                        \
+  std::string number = std::to_string(50 + NUMBER - 1);                        \
+  std::string pkgid = std::string("smokeapp") + number;                        \
+  std::string appid = pkgid + ".TEP";                                          \
+
+TEST_F(SmokeTest, TEP_Tpk_TepInstall) {
+  TEP_TEST_STARTING_BLOCK(1)
+  ASSERT_EQ(InstallWithTEP(path, tep1), ci::AppInstaller::Result::OK);
+  ValidatePackage(pkgid, appid);
+  ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "tep/tep1.tep", "tep1\n"));
+}
+
+TEST_F(SmokeTest, TEP_Tpk_TepInstallTepUpdate) {
+  TEP_TEST_STARTING_BLOCK(2)
+  ASSERT_EQ(InstallWithTEP(path, tep1), ci::AppInstaller::Result::OK);
+  ASSERT_EQ(InstallWithTEP(path, tep2), ci::AppInstaller::Result::OK);
+  ValidatePackage(pkgid, appid);
+  ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "tep/tep2.tep", "tep2\n"));
+}
+
+TEST_F(SmokeTest, TEP_Tpk_NoTepInstallTepUpdate) {
+  TEP_TEST_STARTING_BLOCK(3)
+  ASSERT_EQ(Install(path), ci::AppInstaller::Result::OK);
+  ASSERT_EQ(InstallWithTEP(path, tep2), ci::AppInstaller::Result::OK);
+  ValidatePackage(pkgid, appid);
+  ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "tep/tep2.tep", "tep2\n"));
+}
+
+TEST_F(SmokeTest, TEP_Tpk_TepInstallNoTepUpdate) {
+  TEP_TEST_STARTING_BLOCK(4)
+  ASSERT_EQ(InstallWithTEP(path, tep1), ci::AppInstaller::Result::OK);
+  ASSERT_EQ(Install(path), ci::AppInstaller::Result::OK);
+  ValidatePackage(pkgid, appid);
+  ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "tep/tep1.tep", "tep1\n"));
+}
+
+TEST_F(SmokeTest, TEP_Tpk_TepInstallTepUpdateRollback) {
+  TEP_TEST_STARTING_BLOCK(5)
+  ASSERT_EQ(InstallWithTEP(path, tep1), ci::AppInstaller::Result::OK);
+  ASSERT_EQ(InstallWithTEP(path, tep2, RequestResult::FAIL),
+            ci::AppInstaller::Result::ERROR);
+  ValidatePackage(pkgid, appid);
+  ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "tep/tep1.tep", "tep1\n"));
+}
+
+TEST_F(SmokeTest, TEP_Tpk_NoTepInstallTepUpdateRollback) {
+  TEP_TEST_STARTING_BLOCK(6)
+  ASSERT_EQ(Install(path), ci::AppInstaller::Result::OK);
+  ASSERT_EQ(InstallWithTEP(path, tep2, RequestResult::FAIL),
+            ci::AppInstaller::Result::ERROR);
+  ValidatePackage(pkgid, appid);
+  bf::path root_path = ci::GetRootAppPath(false,
+      kTestUserId);
+  bf::path tep_file = root_path / pkgid / "tep" / "tep2.tep";
+  ASSERT_FALSE(bf::exists(tep_file));
+}
+
+TEST_F(SmokeTest, TEP_Tpk_TepInstallNoTepUpdateRollback) {
+  TEP_TEST_STARTING_BLOCK(7)
+  ASSERT_EQ(InstallWithTEP(path, tep1), ci::AppInstaller::Result::OK);
+  ASSERT_EQ(Install(path, RequestResult::FAIL),
+            ci::AppInstaller::Result::ERROR);
+  ValidatePackage(pkgid, appid);
+  ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "tep/tep1.tep", "tep1\n"));
+}
+
+TEST_F(SmokeTest, TEP_Tpk_Mount_TepInstall) {
+  TEP_TEST_STARTING_BLOCK(8)
+  ASSERT_EQ(MountInstallWithTEP(path, tep1), ci::AppInstaller::Result::OK);
+  ScopedTzipInterface package_mount(pkgid);
+  ValidatePackage(pkgid, appid);
+  ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "tep/tep1.tep", "tep1\n"));
+}
+
+TEST_F(SmokeTest, TEP_Tpk_Mount_TepInstallTepUpdate) {
+  TEP_TEST_STARTING_BLOCK(9)
+  ASSERT_EQ(MountInstallWithTEP(path, tep1), ci::AppInstaller::Result::OK);
+  ASSERT_EQ(MountInstallWithTEP(path, tep2), ci::AppInstaller::Result::OK);
+  ScopedTzipInterface package_mount(pkgid);
+  ValidatePackage(pkgid, appid);
+  ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "tep/tep2.tep", "tep2\n"));
+}
+
+TEST_F(SmokeTest, TEP_Tpk_Mount_NoTepInstallTepUpdate) {
+  TEP_TEST_STARTING_BLOCK(10)
+  ASSERT_EQ(MountInstall(path), ci::AppInstaller::Result::OK);
+  ASSERT_EQ(MountInstallWithTEP(path, tep2), ci::AppInstaller::Result::OK);
+  ScopedTzipInterface package_mount(pkgid);
+  ValidatePackage(pkgid, appid);
+  ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "tep/tep2.tep", "tep2\n"));
+}
+
+TEST_F(SmokeTest, TEP_Tpk_Mount_TepInstallNoTepUpdate) {
+  TEP_TEST_STARTING_BLOCK(11)
+  ASSERT_EQ(MountInstallWithTEP(path, tep1), ci::AppInstaller::Result::OK);
+  ASSERT_EQ(MountInstall(path), ci::AppInstaller::Result::OK);
+  ScopedTzipInterface package_mount(pkgid);
+  ValidatePackage(pkgid, appid);
+  ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "tep/tep1.tep", "tep1\n"));
+}
+
+TEST_F(SmokeTest, TEP_Tpk_Mount_TepInstallTepUpdateRollback) {
+  TEP_TEST_STARTING_BLOCK(12)
+  ASSERT_EQ(MountInstallWithTEP(path, tep1), ci::AppInstaller::Result::OK);
+  ASSERT_EQ(MountInstallWithTEP(path, tep2, RequestResult::FAIL),
+            ci::AppInstaller::Result::ERROR);
+  ScopedTzipInterface package_mount(pkgid);
+  ValidatePackage(pkgid, appid);
+  ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "tep/tep1.tep", "tep1\n"));
+}
+
+TEST_F(SmokeTest, TEP_Tpk_Mount_NoTepInstallTepUpdateRollback) {
+  TEP_TEST_STARTING_BLOCK(13)
+  ASSERT_EQ(MountInstall(path), ci::AppInstaller::Result::OK);
+  ASSERT_EQ(MountInstallWithTEP(path, tep2, RequestResult::FAIL),
+            ci::AppInstaller::Result::ERROR);
+  ScopedTzipInterface package_mount(pkgid);
+  ValidatePackage(pkgid, appid);
+  bf::path root_path = ci::GetRootAppPath(false,
+      kTestUserId);
+  bf::path tep_file = root_path / pkgid / "tep" / "tep2.tep";
+  ASSERT_FALSE(bf::exists(tep_file));
+}
+
+TEST_F(SmokeTest, TEP_Tpk_Mount_TepInstallNoTepUpdateRollback) {
+  TEP_TEST_STARTING_BLOCK(14)
+  ASSERT_EQ(MountInstallWithTEP(path, tep1), ci::AppInstaller::Result::OK);
+  ASSERT_EQ(MountInstall(path, RequestResult::FAIL),
+      ci::AppInstaller::Result::ERROR);
+  ScopedTzipInterface package_mount(pkgid);
+  ValidatePackage(pkgid, appid);
+  ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "tep/tep1.tep", "tep1\n"));
+}
+
 }  // namespace common_installer
 
 int main(int argc,  char** argv) {
diff --git a/src/unit_tests/test_samples/smoke/TEP_Tpk1.tpk b/src/unit_tests/test_samples/smoke/TEP_Tpk1.tpk
new file mode 100644 (file)
index 0000000..f380e81
Binary files /dev/null and b/src/unit_tests/test_samples/smoke/TEP_Tpk1.tpk differ
diff --git a/src/unit_tests/test_samples/smoke/TEP_Tpk10.tpk b/src/unit_tests/test_samples/smoke/TEP_Tpk10.tpk
new file mode 100644 (file)
index 0000000..c059e16
Binary files /dev/null and b/src/unit_tests/test_samples/smoke/TEP_Tpk10.tpk differ
diff --git a/src/unit_tests/test_samples/smoke/TEP_Tpk11.tpk b/src/unit_tests/test_samples/smoke/TEP_Tpk11.tpk
new file mode 100644 (file)
index 0000000..80e3706
Binary files /dev/null and b/src/unit_tests/test_samples/smoke/TEP_Tpk11.tpk differ
diff --git a/src/unit_tests/test_samples/smoke/TEP_Tpk12.tpk b/src/unit_tests/test_samples/smoke/TEP_Tpk12.tpk
new file mode 100644 (file)
index 0000000..ba2574c
Binary files /dev/null and b/src/unit_tests/test_samples/smoke/TEP_Tpk12.tpk differ
diff --git a/src/unit_tests/test_samples/smoke/TEP_Tpk13.tpk b/src/unit_tests/test_samples/smoke/TEP_Tpk13.tpk
new file mode 100644 (file)
index 0000000..a63da3f
Binary files /dev/null and b/src/unit_tests/test_samples/smoke/TEP_Tpk13.tpk differ
diff --git a/src/unit_tests/test_samples/smoke/TEP_Tpk14.tpk b/src/unit_tests/test_samples/smoke/TEP_Tpk14.tpk
new file mode 100644 (file)
index 0000000..b2ad7a0
Binary files /dev/null and b/src/unit_tests/test_samples/smoke/TEP_Tpk14.tpk differ
diff --git a/src/unit_tests/test_samples/smoke/TEP_Tpk2.tpk b/src/unit_tests/test_samples/smoke/TEP_Tpk2.tpk
new file mode 100644 (file)
index 0000000..1aa3798
Binary files /dev/null and b/src/unit_tests/test_samples/smoke/TEP_Tpk2.tpk differ
diff --git a/src/unit_tests/test_samples/smoke/TEP_Tpk3.tpk b/src/unit_tests/test_samples/smoke/TEP_Tpk3.tpk
new file mode 100644 (file)
index 0000000..6d113d8
Binary files /dev/null and b/src/unit_tests/test_samples/smoke/TEP_Tpk3.tpk differ
diff --git a/src/unit_tests/test_samples/smoke/TEP_Tpk4.tpk b/src/unit_tests/test_samples/smoke/TEP_Tpk4.tpk
new file mode 100644 (file)
index 0000000..50a766c
Binary files /dev/null and b/src/unit_tests/test_samples/smoke/TEP_Tpk4.tpk differ
diff --git a/src/unit_tests/test_samples/smoke/TEP_Tpk5.tpk b/src/unit_tests/test_samples/smoke/TEP_Tpk5.tpk
new file mode 100644 (file)
index 0000000..b8bf161
Binary files /dev/null and b/src/unit_tests/test_samples/smoke/TEP_Tpk5.tpk differ
diff --git a/src/unit_tests/test_samples/smoke/TEP_Tpk6.tpk b/src/unit_tests/test_samples/smoke/TEP_Tpk6.tpk
new file mode 100644 (file)
index 0000000..bea5c30
Binary files /dev/null and b/src/unit_tests/test_samples/smoke/TEP_Tpk6.tpk differ
diff --git a/src/unit_tests/test_samples/smoke/TEP_Tpk7.tpk b/src/unit_tests/test_samples/smoke/TEP_Tpk7.tpk
new file mode 100644 (file)
index 0000000..ac4e6ea
Binary files /dev/null and b/src/unit_tests/test_samples/smoke/TEP_Tpk7.tpk differ
diff --git a/src/unit_tests/test_samples/smoke/TEP_Tpk8.tpk b/src/unit_tests/test_samples/smoke/TEP_Tpk8.tpk
new file mode 100644 (file)
index 0000000..8b05078
Binary files /dev/null and b/src/unit_tests/test_samples/smoke/TEP_Tpk8.tpk differ
diff --git a/src/unit_tests/test_samples/smoke/TEP_Tpk9.tpk b/src/unit_tests/test_samples/smoke/TEP_Tpk9.tpk
new file mode 100644 (file)
index 0000000..bcaa55e
Binary files /dev/null and b/src/unit_tests/test_samples/smoke/TEP_Tpk9.tpk differ
diff --git a/src/unit_tests/test_samples/smoke/tep1.tep b/src/unit_tests/test_samples/smoke/tep1.tep
new file mode 100644 (file)
index 0000000..e0002c8
--- /dev/null
@@ -0,0 +1 @@
+tep1
diff --git a/src/unit_tests/test_samples/smoke/tep2.tep b/src/unit_tests/test_samples/smoke/tep2.tep
new file mode 100644 (file)
index 0000000..d7786cf
--- /dev/null
@@ -0,0 +1 @@
+tep2