bf::path path_new = kSmokePackagesDirectory / "RecoveryMode_Tpk_Update_2.tpk";
RemoveAllRecoveryFiles("/tpk-recovery", params.test_user.uid);
ASSERT_EQ(backend.Install(path_old), ci::AppInstaller::Result::OK);
+
+ std::string pkgid = "smokeapp16";
+ std::string appid = "smokeapp16.RecoveryModeTpkUpdate";
+ std::string exec = "native";
+ ci::PkgQueryInterface pkg_query(pkgid, params.test_user.uid);
+ std::string version_old = pkg_query.Version();
+
ci::Subprocess backend_crash("/usr/bin/tpk-installer-ut/smoke-test-helper");
std::string test_uid_str = std::to_string(params.test_user.uid);
backend_crash.Run("-i", path_new.string(), "-u", test_uid_str.c_str());
ASSERT_NE(backend_crash.Wait(), 0);
- std::string pkgid = "smokeapp16";
- std::string appid = "smokeapp16.RecoveryModeTpkUpdate";
- std::string exec = "native";
bf::path recovery_file = FindRecoveryFile("/tpk-recovery",
params.test_user.uid);
ASSERT_FALSE(recovery_file.empty());
ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK);
- ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
- ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "VERSION", "1\n", params));
+ ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
+ ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/VERSION", "1", params));
+ ci::PkgQueryInterface pkg_query2(pkgid, params.test_user.uid, true);
+ std::string version_recovered = pkg_query2.Version();
+ ASSERT_TRUE(version_old == version_recovered);
}
TEST_F(SmokeTest, MountInstallationMode_Tpk) {
std::string appid = "smoketpk36.UpdateMode_Rollback";
std::string exec = "smoketpk36";
ASSERT_EQ(ci::AppInstaller::Result::OK, backend.InstallSuccess(old_path));
+ ci::PkgQueryInterface pkg_query(pkgid, params.test_user.uid);
+ std::string version_old = pkg_query.Version();
ASSERT_EQ(ci::AppInstaller::Result::ERROR, backend.Install(new_path));
- ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
+ ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/VERSION", "1",
params));
+ ci::PkgQueryInterface pkg_query2(pkgid, params.test_user.uid, true);
+ std::string version_rollbacked = pkg_query2.Version();
+ ASSERT_TRUE(version_old == version_rollbacked);
}
TEST_F(SmokeTest, RecoveryMode_ForMountInstall) {
kSmokePackagesDirectory / "RecoveryMode_ForMountUpdate2.tpk";
RemoveAllRecoveryFiles("/tpk-recovery", params.test_user.uid);
ASSERT_EQ(ci::AppInstaller::Result::OK, backend.MountInstall(path_old));
- ci::Subprocess backend_crash("/usr/bin/tpk-installer-ut/smoke-test-helper");
- std::string test_uid_str = std::to_string(params.test_user.uid);
- backend_crash.Run("-w", path_new.string(), "-u", test_uid_str.c_str());
- ASSERT_NE(0, backend_crash.Wait());
std::string pkgid = "smoketpk38";
std::string appid = "smoketpk38.RecoveryMode_ForMountUpdate";
std::string exec = "smoketpk38";
+ ci::PkgQueryInterface pkg_query(pkgid, params.test_user.uid);
+ std::string version_old = pkg_query.Version();
+
+ ci::Subprocess backend_crash("/usr/bin/tpk-installer-ut/smoke-test-helper");
+ std::string test_uid_str = std::to_string(params.test_user.uid);
+ backend_crash.Run("-w", path_new.string(), "-u", test_uid_str.c_str());
+ ASSERT_NE(0, backend_crash.Wait());
// Filesystem may be mounted after crash
ScopedTzipInterface poweroff_unmount_interface(pkgid, params.test_user.uid);
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));
+ ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/VERSION", "1", params));
+ ci::PkgQueryInterface pkg_query2(pkgid, params.test_user.uid, true);
+ std::string version_recovered = pkg_query2.Version();
+ ASSERT_TRUE(version_old == version_recovered);
}
TEST_F(RollbackSmokeTest, MountInstallationMode) {
std::string exec = "smoketpk40";
ASSERT_EQ(ci::AppInstaller::Result::OK,
backend.MountInstallSuccess(old_path));
+ ci::PkgQueryInterface pkg_query(pkgid, params.test_user.uid);
+ std::string version_old = pkg_query.Version();
ASSERT_EQ(ci::AppInstaller::Result::ERROR, backend.MountInstall(new_path));
ScopedTzipInterface package_mount(pkgid, params.test_user.uid);
- ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
+ ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/VERSION", "1", params));
+ ci::PkgQueryInterface pkg_query2(pkgid, params.test_user.uid, true);
+ std::string version_rollbacked = pkg_query2.Version();
+ ASSERT_TRUE(version_old == version_rollbacked);
}
TEST_F(SmokeTest, ManifestDirectInstallMode) {