From: Ilho Kim Date: Fri, 8 Nov 2019 00:45:19 +0000 (+0900) Subject: Modify recovery test to handle cleanup type X-Git-Tag: submit/tizen/20191112.050420~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=da3a7a559fc4212c4e9f47258f83a30de044599b;p=platform%2Fcore%2Fappfw%2Ftpk-backend.git Modify recovery test to handle cleanup type When recovery file set cleanup, recovery package is updated So in this case, it is necessary to compare updated content -Reference [app-installers]https://review.tizen.org/gerrit/#/c/platform/core/appfw/app-installers/+/216457/ Change-Id: Id005fcb3ec495822c90e00f7fd4a396b31f9ff56 Signed-off-by: Ilho Kim --- diff --git a/src/unit_tests/recovery_test.cc b/src/unit_tests/recovery_test.cc index 4fd4383..3df4a94 100644 --- a/src/unit_tests/recovery_test.cc +++ b/src/unit_tests/recovery_test.cc @@ -154,10 +154,12 @@ TEST_F(SmokeTest, RecoveryMode_Tpk_Update) { 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\n", params)); + ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/VERSION", + recovery_info->cleanup() ? "2\n" : "1\n", params)); } else { std::cout << "update finished before process killed" << std::endl; } @@ -188,12 +190,16 @@ TEST_F(SmokeTest, RecoveryMode_ForDelta) { 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)); - ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/VERSION", "1\n", - params)); - ASSERT_TRUE(bf::exists(root_path / pkgid / "res/DELETED")); - ASSERT_FALSE(bf::exists(root_path / pkgid / "res/ADDED")); + ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/VERSION", + recovery_info->cleanup() ? "2\n" : "1\n", params)); + bool deleted_exist = bf::exists(root_path / pkgid / "res/DELETED"); + bool added_exist = bf::exists(root_path / pkgid / "res/ADDED"); + ASSERT_NE(deleted_exist, added_exist); + ASSERT_TRUE(recovery_info->cleanup() ? added_exist : deleted_exist); } else { std::cout << "delta finished before process killed" << std::endl; }