Smoke tests for DeltaMode_Rollback and DeltaMode_Rollback_Hybrid 04/110704/8
authorBartlomiej Kunikowski <b.kunikowski@partner.samsung.com>
Mon, 16 Jan 2017 13:53:08 +0000 (14:53 +0100)
committerjongmyeong ko <jongmyeong.ko@samsung.com>
Mon, 6 Feb 2017 12:11:23 +0000 (04:11 -0800)
Requires:
 - https://review.tizen.org/gerrit/#/c/110703/

Verification:
 $ /usr/bin/wgt-backend-ut/smoke-tests
        --gtest_filter=SmokeTest.DeltaMode_Rollback*

Change-Id: I7fd3eabdabab3ea9fac476a8840e603526d80320

src/unit_tests/smoke_test.cc
src/unit_tests/test_samples/smoke/DeltaMode_Rollback.delta [new file with mode: 0644]
src/unit_tests/test_samples/smoke/DeltaMode_Rollback.wgt [new file with mode: 0644]
src/unit_tests/test_samples/smoke/DeltaMode_Rollback_2.wgt [new file with mode: 0644]
src/unit_tests/test_samples/smoke/DeltaMode_Rollback_Hybrid.delta [new file with mode: 0644]
src/unit_tests/test_samples/smoke/DeltaMode_Rollback_Hybrid.wgt [new file with mode: 0644]
src/unit_tests/test_samples/smoke/DeltaMode_Rollback_Hybrid_2.wgt [new file with mode: 0644]

index 38193da..7a2aabf 100644 (file)
@@ -920,6 +920,26 @@ TEST_F(SmokeTest, UpdateMode_Rollback) {
   ValidateDataFiles(pkgid, kTestUserId);
 }
 
+TEST_F(SmokeTest, DeltaMode_Rollback) {
+  bf::path path = kSmokePackagesDirectory / "DeltaMode_Rollback.wgt";
+  bf::path delta_package = kSmokePackagesDirectory / "DeltaMode_Rollback.delta";
+  std::string pkgid = "smokeapp37";
+  std::string appid = "smokeapp37.DeltaMode";
+  ASSERT_EQ(Install(path, PackageType::WGT), ci::AppInstaller::Result::OK);
+  AddDataFiles(pkgid, kTestUserId);
+  ASSERT_EQ(Install(delta_package, PackageType::WGT, RequestResult::FAIL),
+            ci::AppInstaller::Result::ERROR);
+
+  ValidatePackage(pkgid, {appid});
+  ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/wgt/MODIFIED",
+                                           "version 1\n"));
+  ValidateDataFiles(pkgid, kTestUserId);
+  ASSERT_TRUE(bf::exists(GetPackageRoot(pkgid, kTestUserId) /
+                         "res/wgt/DELETED"));
+  ASSERT_FALSE(bf::exists(GetPackageRoot(pkgid, kTestUserId) /
+                          "res/wgt/ADDED"));
+}
+
 TEST_F(SmokeTest, InstallationMode_Hybrid) {
   bf::path path = kSmokePackagesDirectory / "InstallationMode_Hybrid.wgt";
   std::string pkgid = "smokehyb01";
@@ -1037,6 +1057,31 @@ TEST_F(SmokeTest, UpdateMode_Rollback_Hybrid) {
   ValidateDataFiles(pkgid, kTestUserId);
 }
 
+TEST_F(SmokeTest, DeltaMode_Rollback_Hybrid) {
+  bf::path path = kSmokePackagesDirectory / "DeltaMode_Rollback_Hybrid.wgt";
+  bf::path delta_package = kSmokePackagesDirectory /
+      "DeltaMode_Rollback_Hybrid.delta";
+  std::string pkgid = "smokehyb11";
+  std::string appid1 = "smokehyb11.web";
+  ASSERT_EQ(Install(path, PackageType::HYBRID), ci::AppInstaller::Result::OK);
+  AddDataFiles(pkgid, kTestUserId);
+  ASSERT_EQ(Install(delta_package, PackageType::HYBRID, RequestResult::FAIL),
+            ci::AppInstaller::Result::ERROR);
+
+  ValidatePackage(pkgid, {appid1});
+  // Check delta modifications
+  bf::path root_path = GetPackageRoot(pkgid, kTestUserId);
+  ASSERT_TRUE(bf::exists(root_path / "res" / "wgt" / "DELETED"));
+  ASSERT_FALSE(bf::exists(root_path / "res" / "wgt" / "ADDED"));
+  ASSERT_TRUE(bf::exists(root_path / "lib" / "DELETED"));
+  ASSERT_FALSE(bf::exists(root_path / "lib" / "ADDED"));
+  ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/wgt/MODIFIED",
+                                           "version 1\n"));
+  ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "lib/MODIFIED",
+                                           "version 1\n"));
+  ValidateDataFiles(pkgid, kTestUserId);
+}
+
 TEST_F(SmokeTest, MountInstallationMode_Rollback_Hybrid) {
   bf::path path = kSmokePackagesDirectory /
       "MountInstallationMode_Rollback_Hybrid.wgt";
diff --git a/src/unit_tests/test_samples/smoke/DeltaMode_Rollback.delta b/src/unit_tests/test_samples/smoke/DeltaMode_Rollback.delta
new file mode 100644 (file)
index 0000000..b4a756b
Binary files /dev/null and b/src/unit_tests/test_samples/smoke/DeltaMode_Rollback.delta differ
diff --git a/src/unit_tests/test_samples/smoke/DeltaMode_Rollback.wgt b/src/unit_tests/test_samples/smoke/DeltaMode_Rollback.wgt
new file mode 100644 (file)
index 0000000..8a787f8
Binary files /dev/null and b/src/unit_tests/test_samples/smoke/DeltaMode_Rollback.wgt differ
diff --git a/src/unit_tests/test_samples/smoke/DeltaMode_Rollback_2.wgt b/src/unit_tests/test_samples/smoke/DeltaMode_Rollback_2.wgt
new file mode 100644 (file)
index 0000000..c26c9c8
Binary files /dev/null and b/src/unit_tests/test_samples/smoke/DeltaMode_Rollback_2.wgt differ
diff --git a/src/unit_tests/test_samples/smoke/DeltaMode_Rollback_Hybrid.delta b/src/unit_tests/test_samples/smoke/DeltaMode_Rollback_Hybrid.delta
new file mode 100644 (file)
index 0000000..b5f7a9a
Binary files /dev/null and b/src/unit_tests/test_samples/smoke/DeltaMode_Rollback_Hybrid.delta differ
diff --git a/src/unit_tests/test_samples/smoke/DeltaMode_Rollback_Hybrid.wgt b/src/unit_tests/test_samples/smoke/DeltaMode_Rollback_Hybrid.wgt
new file mode 100644 (file)
index 0000000..0811e57
Binary files /dev/null and b/src/unit_tests/test_samples/smoke/DeltaMode_Rollback_Hybrid.wgt differ
diff --git a/src/unit_tests/test_samples/smoke/DeltaMode_Rollback_Hybrid_2.wgt b/src/unit_tests/test_samples/smoke/DeltaMode_Rollback_Hybrid_2.wgt
new file mode 100644 (file)
index 0000000..884f97d
Binary files /dev/null and b/src/unit_tests/test_samples/smoke/DeltaMode_Rollback_Hybrid_2.wgt differ