From: Sangyoon Jang Date: Thu, 4 Jun 2020 10:37:55 +0000 (+0900) Subject: Validate unpacked_dir not exists when recovery done X-Git-Tag: submit/tizen/20200612.081636~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a6103ac5b953d9cfe9eaacd76455e92ea059da74;p=platform%2Fcore%2Fappfw%2Ftpk-backend.git Validate unpacked_dir not exists when recovery done Change-Id: I6ff9f1e84b57f431df67f9e9dd5e6abed78b0f4c Signed-off-by: Sangyoon Jang --- diff --git a/src/unit_tests/smoke_test.cc b/src/unit_tests/smoke_test.cc index a00ffd6..9fac935 100644 --- a/src/unit_tests/smoke_test.cc +++ b/src/unit_tests/smoke_test.cc @@ -263,8 +263,11 @@ TEST_F(SmokeTest, RecoveryMode_Tpk_Installation) { bf::path recovery_file = FindRecoveryFile("/tpk-recovery", params.test_user.uid); ASSERT_FALSE(recovery_file.empty()); + std::unique_ptr recovery_info = + GetRecoverFileInfo(recovery_file); ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK); ASSERT_TRUE(CheckPackageNonExistance(pkgid, params)); + ASSERT_FALSE(bf::exists(recovery_info->unpacked_dir())); } TEST_F(SmokeTest, RecoveryMode_Tpk_Update) { @@ -287,10 +290,13 @@ TEST_F(SmokeTest, RecoveryMode_Tpk_Update) { bf::path recovery_file = FindRecoveryFile("/tpk-recovery", params.test_user.uid); ASSERT_FALSE(recovery_file.empty()); + std::unique_ptr recovery_info = + GetRecoverFileInfo(recovery_file); ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK); ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params)); ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/VERSION", "1", params)); + ASSERT_FALSE(bf::exists(recovery_info->unpacked_dir())); ci::PkgQueryInterface pkg_query2(pkgid, params.test_user.uid, true); std::string version_recovered = pkg_query2.Version(); ASSERT_TRUE(version_old == version_recovered); @@ -579,6 +585,8 @@ TEST_F(SmokeTest, RecoveryMode_ForDelta) { bf::path recovery_file = FindRecoveryFile("/tpk-recovery", params.test_user.uid); ASSERT_FALSE(recovery_file.empty()); + std::unique_ptr recovery_info = + GetRecoverFileInfo(recovery_file); ASSERT_EQ(ci::AppInstaller::Result::OK, backend.Recover(recovery_file)); ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params)); @@ -588,6 +596,7 @@ TEST_F(SmokeTest, RecoveryMode_ForDelta) { params.test_user.uid); ASSERT_TRUE(bf::exists(root_path / pkgid / "res/DELETED")); ASSERT_FALSE(bf::exists(root_path / pkgid / "res/ADDED")); + ASSERT_FALSE(bf::exists(recovery_info->unpacked_dir())); } TEST_F(RollbackSmokeTest, UpdateMode) { @@ -621,8 +630,11 @@ TEST_F(SmokeTest, RecoveryMode_ForMountInstall) { bf::path recovery_file = FindRecoveryFile("/tpk-recovery", params.test_user.uid); ASSERT_FALSE(recovery_file.empty()); + std::unique_ptr recovery_info = + GetRecoverFileInfo(recovery_file); ASSERT_EQ(ci::AppInstaller::Result::OK, backend.Recover(recovery_file)); ASSERT_TRUE(CheckPackageNonExistance(pkgid, params)); + ASSERT_FALSE(bf::exists(recovery_info->unpacked_dir())); } TEST_F(SmokeTest, RecoveryMode_ForMountUpdate) { @@ -651,6 +663,8 @@ TEST_F(SmokeTest, RecoveryMode_ForMountUpdate) { bf::path recovery_file = FindRecoveryFile("/tpk-recovery", params.test_user.uid); ASSERT_FALSE(recovery_file.empty()); + std::unique_ptr recovery_info = + GetRecoverFileInfo(recovery_file); ASSERT_EQ(ci::AppInstaller::Result::OK, backend.Recover(recovery_file)); ScopedTzipInterface interface(pkgid, params.test_user.uid); @@ -658,6 +672,7 @@ TEST_F(SmokeTest, RecoveryMode_ForMountUpdate) { ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/VERSION", "1", params)); ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "shared/res/VERSION", "1", params)); + ASSERT_FALSE(bf::exists(recovery_info->unpacked_dir())); ci::PkgQueryInterface pkg_query2(pkgid, params.test_user.uid, true); std::string version_recovered = pkg_query2.Version(); ASSERT_TRUE(version_old == version_recovered); @@ -838,10 +853,13 @@ TEST_F(SmokeTest, RecoveryMode_SharedDataUpdate) { bf::path recovery_file = FindRecoveryFile("/tpk-recovery", params.test_user.uid); ASSERT_FALSE(recovery_file.empty()); + std::unique_ptr recovery_info = + GetRecoverFileInfo(recovery_file); ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK); ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params)); ASSERT_TRUE(CheckSharedDataExistance(pkgid, params)); + ASSERT_FALSE(bf::exists(recovery_info->unpacked_dir())); } TEST_F(SmokeTest, RecoveryMode_NonSharedDataUpdate) { @@ -862,10 +880,13 @@ TEST_F(SmokeTest, RecoveryMode_NonSharedDataUpdate) { bf::path recovery_file = FindRecoveryFile("/tpk-recovery", params.test_user.uid); ASSERT_FALSE(recovery_file.empty()); + std::unique_ptr recovery_info = + GetRecoverFileInfo(recovery_file); ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK); ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params)); ASSERT_TRUE(CheckSharedDataNonExistance(pkgid, params)); + ASSERT_FALSE(bf::exists(recovery_info->unpacked_dir())); } } // namespace smoke_test