enum class ReqType : int {
UNKNOWN_REQ,
INSTALL_REQ,
+ UNINSTALL_REQ,
UPDATE_REQ,
DELTA_REQ,
MOUNT_INSTALL_REQ,
std::map<ReqType, std::string> install_req_filter = {
{ ReqType::INSTALL_REQ,
"--gtest_filter=SmokeTest.RecoveryMode_Tpk_Installation" },
+ { ReqType::UNINSTALL_REQ,
+ "--gtest_filter=SmokeTest.RecoveryMode_Tpk_Uninstallation" },
{ ReqType::UPDATE_REQ,
"--gtest_filter=SmokeTest.RecoveryMode_Tpk_Update" },
{ ReqType::DELTA_REQ,
ASSERT_TRUE(CheckPackageNonExistance(pkgid, params));
}
+TEST_F(SmokeTest, RecoveryMode_Tpk_Uninstallation) {
+ RemoveAllRecoveryFiles("/tpk-recovery", params.test_user.uid);
+ bf::path path = kSmokePackagesDirectory / "RecoveryPkg.tpk";
+
+ SmokeTestHelperRunner::Result ret = backend.InstallWithSubprocess(
+ path, params.test_user.uid);
+ if (ret != SmokeTestHelperRunner::Result::SUCCESS) {
+ std::cout << "failed to install package before uninstall" << std::endl;
+ return;
+ }
+
+ std::string pkgid = "recoverypkg";
+ int wait_time = delay + interval * test_count;
+ ret = backend.UninstallWithSubprocessAndKill(
+ pkgid, params.test_user.uid, wait_time);
+ if (ret == SmokeTestHelperRunner::Result::SUCCESS) {
+ std::cout << "uninstall finished before process killed" << std::endl;
+ return;
+ }
+ ASSERT_EQ(ret, SmokeTestHelperRunner::Result::KILLED);
+
+ 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_EQ(backend.RecoveryWithSubprocess(recovery_file, params.test_user.uid),
+ SmokeTestHelperRunner::Result::SUCCESS);
+ ASSERT_TRUE(CheckPackageNonExistance(pkgid, params));
+}
+
TEST_F(SmokeTest, RecoveryMode_Tpk_Update) {
RemoveAllRecoveryFiles("/tpk-recovery", params.test_user.uid);
("install",
"recovery test for forced termination "
"during package installing")
+ ("uninstall",
+ "recovery test for forced termination "
+ "during package uninstallation")
("update",
"recovery test for forced termination "
"during package updating")
if (opt_map.count("install"))
req_type = ReqType::INSTALL_REQ;
+ if (opt_map.count("uninstall"))
+ req_type = ReqType::UNINSTALL_REQ;
else if (opt_map.count("update"))
req_type = ReqType::UPDATE_REQ;
else if (opt_map.count("delta"))