Smoke test of delta package installation 42/50542/5
authorTomasz Iwanek <t.iwanek@samsung.com>
Thu, 29 Oct 2015 15:34:42 +0000 (16:34 +0100)
committerPawel Sikorski <p.sikorski@samsung.com>
Thu, 5 Nov 2015 16:15:34 +0000 (08:15 -0800)
Change-Id: Ic23d97126509c3e91c2235b2bfae1a3f5a047527

src/unit_tests/smoke_test.cc
src/unit_tests/test_samples/smoke/DeltaMode.delta [new file with mode: 0644]
src/unit_tests/test_samples/smoke/DeltaMode.wgt [new file with mode: 0644]
src/unit_tests/test_samples/smoke/DeltaMode_Tpk.delta [new file with mode: 0644]
src/unit_tests/test_samples/smoke/DeltaMode_Tpk.tpk [new file with mode: 0644]

index 6aaae8f..29a0973 100644 (file)
@@ -293,6 +293,15 @@ ci::AppInstaller::Result Reinstall(const bf::path& path,
   return RunInstallerWithPkgrmgr(pkgmgr, type, mode);
 }
 
+ci::AppInstaller::Result DeltaInstall(const bf::path& path,
+    const bf::path& delta_package, PackageType type) {
+  if (Install(path, type) != ci::AppInstaller::Result::OK) {
+    LOG(ERROR) << "Failed to install application. Cannot perform RDS";
+    return ci::AppInstaller::Result::UNKNOWN;
+  }
+  return Install(delta_package, type);
+}
+
 ci::AppInstaller::Result Recover(const bf::path& recovery_file,
                                  PackageType type,
                                  RequestResult mode = RequestResult::NORMAL) {
@@ -393,6 +402,43 @@ TEST_F(SmokeTest, RDSMode) {
   ValidateFileContentInPackage(pkgid, "res/wgt/MODIFIED", "2\n");
 }
 
+TEST_F(SmokeTest, DeltaMode) {
+  bf::path path = "/usr/share/app-installers-ut/test_samples/smoke/DeltaMode.wgt";  // NOLINT
+  std::string delta_package = "/usr/share/app-installers-ut/test_samples/smoke/DeltaMode.delta"; // NOLINT
+  std::string pkgid = "smokeapp17";
+  std::string appid = "smokeapp17.DeltaMode";
+  ASSERT_EQ(DeltaInstall(path, delta_package, PackageType::WGT),
+            ci::AppInstaller::Result::OK);
+  ValidatePackage(pkgid, appid, PackageType::WGT);
+
+  // Check delta modifications
+  bf::path root_path = ci::GetRootAppPath();
+  ASSERT_FALSE(bf::exists(root_path / pkgid / "res" / "wgt" / "DELETED"));
+  ASSERT_TRUE(bf::exists(root_path / pkgid / "res" / "wgt" / "ADDED"));
+  ASSERT_TRUE(bf::exists(root_path / pkgid / "res" / "wgt" / "css" / "style.css"));  // NOLINT
+  ASSERT_TRUE(bf::exists(root_path / pkgid / "res" / "wgt" / "images" / "tizen_32.png"));  // NOLINT
+  ASSERT_TRUE(bf::exists(root_path / pkgid / "res" / "wgt" / "js" / "main.js"));
+  ValidateFileContentInPackage(pkgid, "res/wgt/MODIFIED", "version 2\n");
+}
+
+TEST_F(SmokeTest, DeltaMode_Tpk) {
+  bf::path path = "/usr/share/app-installers-ut/test_samples/smoke/DeltaMode_Tpk.tpk";  // NOLINT
+  std::string delta_package = "/usr/share/app-installers-ut/test_samples/smoke/DeltaMode_Tpk.delta"; // NOLINT
+  std::string pkgid = "smokeapp18";
+  std::string appid = "smokeapp18.DeltaModeTpk";
+  ASSERT_EQ(DeltaInstall(path, delta_package, PackageType::TPK),
+            ci::AppInstaller::Result::OK);
+  ValidatePackage(pkgid, appid, PackageType::TPK);
+
+  // Check delta modifications
+  bf::path root_path = ci::GetRootAppPath();
+  ASSERT_FALSE(bf::exists(root_path / pkgid / "DELETED"));
+  ASSERT_TRUE(bf::exists(root_path / pkgid / "ADDED"));
+  ASSERT_TRUE(bf::exists(root_path / pkgid / "bin" / "native"));
+  ASSERT_TRUE(bf::exists(root_path / pkgid / "shared" / "res" / "native.png"));
+  ValidateFileContentInPackage(pkgid, "MODIFIED", "version 2\n");
+}
+
 TEST_F(SmokeTest, RecoveryMode_ForInstallation) {
   bf::path path = "/usr/share/app-installers-ut/test_samples/smoke/RecoveryMode_ForInstallation.wgt";  // NOLINT
   ASSERT_DEATH(Install(path, PackageType::WGT, RequestResult::CRASH), ".*");
diff --git a/src/unit_tests/test_samples/smoke/DeltaMode.delta b/src/unit_tests/test_samples/smoke/DeltaMode.delta
new file mode 100644 (file)
index 0000000..2cf6105
Binary files /dev/null and b/src/unit_tests/test_samples/smoke/DeltaMode.delta differ
diff --git a/src/unit_tests/test_samples/smoke/DeltaMode.wgt b/src/unit_tests/test_samples/smoke/DeltaMode.wgt
new file mode 100644 (file)
index 0000000..2837000
Binary files /dev/null and b/src/unit_tests/test_samples/smoke/DeltaMode.wgt differ
diff --git a/src/unit_tests/test_samples/smoke/DeltaMode_Tpk.delta b/src/unit_tests/test_samples/smoke/DeltaMode_Tpk.delta
new file mode 100644 (file)
index 0000000..bae36e2
Binary files /dev/null and b/src/unit_tests/test_samples/smoke/DeltaMode_Tpk.delta differ
diff --git a/src/unit_tests/test_samples/smoke/DeltaMode_Tpk.tpk b/src/unit_tests/test_samples/smoke/DeltaMode_Tpk.tpk
new file mode 100644 (file)
index 0000000..b0a04ec
Binary files /dev/null and b/src/unit_tests/test_samples/smoke/DeltaMode_Tpk.tpk differ