TEST_F(SmokeTest, RecoveryMode_Tpk_Installation) {
bf::path path = kSmokePackagesDirectory / "RecoveryMode_Tpk_Installation.tpk";
std::string pkgid = "smokeapp15";
+ std::string appid = "smokeapp15.RecoveryModeTpkInstallation";
+ std::string exec = "native";
RemoveAllRecoveryFiles("/tpk-recovery", params.test_user.uid);
std::string test_uid_str = std::to_string(params.test_user.uid);
bf::path recovery_file = FindRecoveryFile("/tpk-recovery",
params.test_user.uid);
EXTENDED_ASSERT_FALSE(recovery_file.empty());
+ std::unique_ptr<ci::recovery::RecoveryFile> recovery_info =
+ GetRecoverFileInfo(recovery_file);
EXTENDED_ASSERT_EQ(backend.Recover(recovery_file),
ci::AppInstaller::Result::OK);
- EXTENDED_ASSERT_TRUE(CheckPackageNonExistance(pkgid, params));
+ if (recovery_info->cleanup()) {
+ EXTENDED_ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
+ EXTENDED_ASSERT_EQ(backend.Uninstall(pkgid),
+ ci::AppInstaller::Result::OK);
+ } else {
+ EXTENDED_ASSERT_TRUE(CheckPackageNonExistance(pkgid, params));
+ }
}
return true;
}, params.pkg_type);
bf::path recovery_file = FindRecoveryFile("/tpk-recovery",
params.test_user.uid);
EXTENDED_ASSERT_FALSE(recovery_file.empty());
+ std::unique_ptr<ci::recovery::RecoveryFile> recovery_info =
+ GetRecoverFileInfo(recovery_file);
EXTENDED_ASSERT_EQ(backend.Recover(recovery_file),
ci::AppInstaller::Result::OK);
EXTENDED_ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
-
+ std::string version = recovery_info->cleanup() ? "2" : "1";
EXTENDED_ASSERT_TRUE(
- ValidateFileContentInPackage(pkgid, "VERSION", "1\n", params));
+ ValidateFileContentInPackage(pkgid, "res/VERSION", version, params));
+ if (recovery_info->cleanup()) {
+ EXTENDED_ASSERT_EQ(backend.Uninstall(pkgid),
+ ci::AppInstaller::Result::OK);
+ EXTENDED_ASSERT_EQ(backend.Install(path_old),
+ ci::AppInstaller::Result::OK);
+ }
}
return true;
}, params.pkg_type);
bf::path recovery_file = FindRecoveryFile("/tpk-recovery",
params.test_user.uid);
EXTENDED_ASSERT_FALSE(recovery_file.empty());
+ std::unique_ptr<ci::recovery::RecoveryFile> recovery_info =
+ GetRecoverFileInfo(recovery_file);
EXTENDED_ASSERT_EQ(backend.Recover(recovery_file),
ci::AppInstaller::Result::OK);
EXTENDED_ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
-
+ std::string contents = recovery_info->cleanup() ?
+ "version 2" : "version 1";
EXTENDED_ASSERT_TRUE(
- ValidateFileContentInPackage(pkgid, "res/MODIFIED", "version 1",
+ ValidateFileContentInPackage(pkgid, "res/MODIFIED", contents,
params));
bf::path root_path = ci::GetRootAppPath(params.is_readonly,
params.test_user.uid);
- EXTENDED_ASSERT_TRUE(bf::exists(root_path / pkgid / "res/DELETED"));
- EXTENDED_ASSERT_FALSE(bf::exists(root_path / pkgid / "res/ADDED"));
+
+ if (recovery_info->cleanup()) {
+ EXTENDED_ASSERT_FALSE(bf::exists(root_path / pkgid / "res/DELETED"));
+ EXTENDED_ASSERT_TRUE(bf::exists(root_path / pkgid / "res/ADDED"));
+ EXTENDED_ASSERT_EQ(backend.Uninstall(pkgid),
+ ci::AppInstaller::Result::OK);
+ EXTENDED_ASSERT_EQ(backend.Install(path_old),
+ ci::AppInstaller::Result::OK);
+ } else {
+ EXTENDED_ASSERT_TRUE(bf::exists(root_path / pkgid / "res/DELETED"));
+ EXTENDED_ASSERT_FALSE(bf::exists(root_path / pkgid / "res/ADDED"));
+ }
}
return true;
}, params.pkg_type);
TEST_F(SmokeTest, RecoveryMode_ForMountInstall) {
bf::path path = kSmokePackagesDirectory / "RecoveryMode_ForMountInstall.tpk";
+ std::string pkgid = "smoketpk37";
+ std::string appid = "smoketpk37.RecoveryMode_ForMountInstall";
+ std::string exec = "smoketpk37";
RemoveAllRecoveryFiles("/tpk-recovery", params.test_user.uid);
std::string test_uid_str = std::to_string(params.test_user.uid);
{"", "-w", path.string(), "-u", test_uid_str.c_str()};
backend.CrashAfterEachStep(&args, [&](int step) -> bool {
if (step >= 2) {
- std::string pkgid = "smoketpk37";
- std::string appid = "smoketpk37.RecoveryMode_ForMountInstall";
bf::path recovery_file = FindRecoveryFile("/tpk-recovery",
params.test_user.uid);
EXTENDED_ASSERT_FALSE(recovery_file.empty());
+ std::unique_ptr<ci::recovery::RecoveryFile> recovery_info =
+ GetRecoverFileInfo(recovery_file);
EXTENDED_ASSERT_EQ(backend.Recover(recovery_file),
ci::AppInstaller::Result::OK);
- EXTENDED_ASSERT_TRUE(CheckPackageNonExistance(pkgid, params));
+ ScopedTzipInterface interface(pkgid, params.test_user.uid);
+ if (recovery_info->cleanup()) {
+ EXTENDED_ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
+ EXTENDED_ASSERT_EQ(backend.Uninstall(pkgid),
+ ci::AppInstaller::Result::OK);
+ } else {
+ EXTENDED_ASSERT_TRUE(CheckPackageNonExistance(pkgid, params));
+ }
}
return true;
}, params.pkg_type);
bf::path recovery_file = FindRecoveryFile("/tpk-recovery",
params.test_user.uid);
EXTENDED_ASSERT_FALSE(recovery_file.empty());
+ std::unique_ptr<ci::recovery::RecoveryFile> recovery_info =
+ GetRecoverFileInfo(recovery_file);
EXTENDED_ASSERT_EQ(backend.Recover(recovery_file),
ci::AppInstaller::Result::OK);
ScopedTzipInterface interface(pkgid, params.test_user.uid);
EXTENDED_ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
+ std::string version = recovery_info->cleanup() ? "2" : "1";
EXTENDED_ASSERT_TRUE(ValidateFileContentInPackage(pkgid,
- "res/VERSION", "1", params));
+ "res/VERSION", version, params));
+ if (recovery_info->cleanup()) {
+ interface.Release();
+ EXTENDED_ASSERT_EQ(backend.Uninstall(pkgid),
+ ci::AppInstaller::Result::OK);
+ EXTENDED_ASSERT_EQ(backend.MountInstall(path_old),
+ ci::AppInstaller::Result::OK);
+ }
}
return true;
}, params.pkg_type);