From: Ilho Kim Date: Tue, 3 Dec 2019 05:21:09 +0000 (+0900) Subject: Fix recovery test when recovery file doesn't exist X-Git-Tag: submit/tizen/20191213.074937~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F97%2F219197%2F3;p=platform%2Fcore%2Fappfw%2Ftpk-backend.git Fix recovery test when recovery file doesn't exist If installer is terminated before creating the recovery file The test should be skipped, not failed Change-Id: I9df1d77f2848c5e975596b7d4085700f41a0d6d3 Signed-off-by: Ilho Kim --- diff --git a/src/unit_tests/recovery_test.cc b/src/unit_tests/recovery_test.cc index 4f05345..b8647be 100644 --- a/src/unit_tests/recovery_test.cc +++ b/src/unit_tests/recovery_test.cc @@ -125,8 +125,12 @@ TEST_F(SmokeTest, RecoveryMode_Tpk_Installation) { std::string pkgid = "recoverypkg"; bf::path recovery_file = FindRecoveryFile("/tpk-recovery", params.test_user.uid); + if (recovery_file.empty()) { + std::cout << "recovery file dosen't exist, " + "this test is skipped" << std::endl; + return; + } - ASSERT_FALSE(recovery_file.empty()); ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK); ASSERT_TRUE(CheckPackageNonExistance(pkgid, params)); } else { @@ -153,8 +157,12 @@ TEST_F(SmokeTest, RecoveryMode_Tpk_Update) { std::string exec = "recoverypkg"; bf::path recovery_file = FindRecoveryFile("/tpk-recovery", params.test_user.uid); + if (recovery_file.empty()) { + std::cout << "recovery file dosen't exist, " + "this test is skipped" << std::endl; + return; + } - ASSERT_FALSE(recovery_file.empty()); std::unique_ptr recovery_info = GetRecoverFileInfo(recovery_file); ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK); @@ -187,8 +195,12 @@ TEST_F(SmokeTest, RecoveryMode_ForDelta) { params.test_user.uid); bf::path root_path = ci::GetRootAppPath(params.is_readonly, params.test_user.uid); + if (recovery_file.empty()) { + std::cout << "recovery file dosen't exist, " + "this test is skipped" << std::endl; + return; + } - ASSERT_FALSE(recovery_file.empty()); std::unique_ptr recovery_info = GetRecoverFileInfo(recovery_file); ASSERT_EQ(ci::AppInstaller::Result::OK, backend.Recover(recovery_file)); @@ -219,8 +231,12 @@ TEST_F(SmokeTest, RecoveryMode_ForMountInstall) { std::string pkgid = "recoverypkg"; bf::path recovery_file = FindRecoveryFile("/tpk-recovery", params.test_user.uid); + if (recovery_file.empty()) { + std::cout << "recovery file dosen't exist, " + "this test is skipped" << std::endl; + return; + } - ASSERT_FALSE(recovery_file.empty()); ASSERT_EQ(ci::AppInstaller::Result::OK, backend.Recover(recovery_file)); ASSERT_TRUE(CheckPackageNonExistance(pkgid, params)); } else { @@ -249,12 +265,16 @@ TEST_F(SmokeTest, RecoveryMode_ForMountUpdate) { std::string exec = "recoverypkg"; bf::path recovery_file = FindRecoveryFile("/tpk-recovery", params.test_user.uid); + if (recovery_file.empty()) { + std::cout << "recovery file dosen't exist, " + "this test is skipped" << std::endl; + return; + } // Filesystem may be mounted after crash ScopedTzipInterface poweroff_unmount_interface(pkgid, params.test_user.uid); poweroff_unmount_interface.Release(); - ASSERT_FALSE(recovery_file.empty()); ASSERT_EQ(ci::AppInstaller::Result::OK, backend.Recover(recovery_file)); ScopedTzipInterface interface(pkgid, params.test_user.uid); ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));