ci::PkgQueryInterface pkg_query("recoverypkg", test_user.uid, true);
if (pkg_query.IsPackageInstalled()) {
- TpkSmokeTestHelperRunner backend;
- SmokeTestHelperRunner::Result ret =
- backend.UninstallWithSubprocess("recoverypkg", test_user.uid);
- ASSERT_EQ(ret, SmokeTestHelperRunner::Result::SUCCESS);
+ TpkBackendInterface backend(std::to_string(test_user.uid));
+ BackendInterface::SubProcessResult ret =
+ backend.UninstallWithSubprocess("recoverypkg");
+ ASSERT_EQ(ret, BackendInterface::SubProcessResult::SUCCESS);
}
if (request_mode_ == ci::RequestMode::USER) {
class SmokeTest : public testing::Test {
public:
- SmokeTest() : params{PackageType::TPK, false} {
+ SmokeTest() : backend(std::to_string(env->test_user.uid)),
+ params{PackageType::TPK, false} {
params.test_user.uid = env->test_user.uid;
params.test_user.gid = env->test_user.gid;
}
protected:
- TpkSmokeTestHelperRunner backend;
+ TpkBackendInterface backend;
TestParameters params;
};
bf::path path = kSmokePackagesDirectory / "RecoveryPkg.tpk";
int wait_time = delay + interval * test_count;
- SmokeTestHelperRunner::Result ret = backend.InstallWithSubprocessAndKill(
- path, params.test_user.uid, wait_time);
- if (ret == SmokeTestHelperRunner::Result::SUCCESS) {
+ BackendInterface::SubProcessResult ret = backend.InstallWithSubprocessAndKill(
+ path, wait_time);
+ if (ret == BackendInterface::SubProcessResult::SUCCESS) {
std::cout << "install finished before process killed" << std::endl;
return;
}
- ASSERT_EQ(ret, SmokeTestHelperRunner::Result::KILLED);
+ ASSERT_EQ(ret, BackendInterface::SubProcessResult::KILLED);
std::string pkgid = "recoverypkg";
bf::path recovery_file = FindRecoveryFile("/tpk-recovery",
params.test_user.uid);
"this test is skipped" << std::endl;
return;
}
- ASSERT_EQ(backend.RecoveryWithSubprocess(recovery_file, params.test_user.uid),
- SmokeTestHelperRunner::Result::SUCCESS);
+ ASSERT_EQ(backend.RecoveryWithSubprocess(recovery_file),
+ BackendInterface::SubProcessResult::SUCCESS);
ASSERT_TRUE(CheckPackageNonExistance(pkgid, params));
}
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) {
+ BackendInterface::SubProcessResult ret = backend.InstallWithSubprocess(path);
+ if (ret != BackendInterface::SubProcessResult::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) {
+ ret = backend.UninstallWithSubprocessAndKill(pkgid, wait_time);
+ if (ret == BackendInterface::SubProcessResult::SUCCESS) {
std::cout << "uninstall finished before process killed" << std::endl;
return;
}
- ASSERT_EQ(ret, SmokeTestHelperRunner::Result::KILLED);
+ ASSERT_EQ(ret, BackendInterface::SubProcessResult::KILLED);
bf::path recovery_file = FindRecoveryFile("/tpk-recovery",
params.test_user.uid);
"this test is skipped" << std::endl;
return;
}
- ASSERT_EQ(backend.RecoveryWithSubprocess(recovery_file, params.test_user.uid),
- SmokeTestHelperRunner::Result::SUCCESS);
+ ASSERT_EQ(backend.RecoveryWithSubprocess(recovery_file),
+ BackendInterface::SubProcessResult::SUCCESS);
ASSERT_TRUE(CheckPackageNonExistance(pkgid, params));
}
bf::path path_new = kSmokePackagesDirectory / "RecoveryPkg2.tpk";
int wait_time = delay + interval * test_count;
- ASSERT_EQ(backend.InstallWithSubprocess(path_old, params.test_user.uid),
- SmokeTestHelperRunner::Result::SUCCESS);
+ ASSERT_EQ(backend.InstallWithSubprocess(path_old),
+ BackendInterface::SubProcessResult::SUCCESS);
- SmokeTestHelperRunner::Result ret = backend.InstallWithSubprocessAndKill(
- path_new, params.test_user.uid, wait_time);
- if (ret == SmokeTestHelperRunner::Result::SUCCESS) {
+ BackendInterface::SubProcessResult ret = backend.InstallWithSubprocessAndKill(
+ path_new, wait_time);
+ if (ret == BackendInterface::SubProcessResult::SUCCESS) {
std::cout << "update finished before process killed" << std::endl;
return;
}
- ASSERT_EQ(ret, SmokeTestHelperRunner::Result::KILLED);
+ ASSERT_EQ(ret, BackendInterface::SubProcessResult::KILLED);
std::string pkgid = "recoverypkg";
std::string appid = "recoverypkg";
std::unique_ptr<ci::recovery::RecoveryFile> recovery_info =
GetRecoverFileInfo(recovery_file);
- ASSERT_EQ(backend.RecoveryWithSubprocess(recovery_file, params.test_user.uid),
- SmokeTestHelperRunner::Result::SUCCESS);
+ ASSERT_EQ(backend.RecoveryWithSubprocess(recovery_file),
+ BackendInterface::SubProcessResult::SUCCESS);
ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/VERSION",
recovery_info->cleanup() ? "2\n" : "1\n", params));
bf::path path_new = kSmokePackagesDirectory / "RecoveryPkg.delta";
int wait_time = delay + interval * test_count;
- ASSERT_EQ(backend.InstallWithSubprocess(path_old, params.test_user.uid),
- SmokeTestHelperRunner::Result::SUCCESS);
+ ASSERT_EQ(backend.InstallWithSubprocess(path_old),
+ BackendInterface::SubProcessResult::SUCCESS);
- SmokeTestHelperRunner::Result ret = backend.InstallWithSubprocessAndKill(
- path_new, params.test_user.uid, wait_time);
- if (ret == SmokeTestHelperRunner::Result::SUCCESS) {
+ BackendInterface::SubProcessResult ret = backend.InstallWithSubprocessAndKill(
+ path_new, wait_time);
+ if (ret == BackendInterface::SubProcessResult::SUCCESS) {
std::cout << "delta finished before process killed" << std::endl;
return;
}
- ASSERT_EQ(ret, SmokeTestHelperRunner::Result::KILLED);
+ ASSERT_EQ(ret, BackendInterface::SubProcessResult::KILLED);
std::string pkgid = "recoverypkg";
std::string appid = "recoverypkg";
std::unique_ptr<ci::recovery::RecoveryFile> recovery_info =
GetRecoverFileInfo(recovery_file);
- ASSERT_EQ(backend.RecoveryWithSubprocess(recovery_file, params.test_user.uid),
- SmokeTestHelperRunner::Result::SUCCESS);
+ ASSERT_EQ(backend.RecoveryWithSubprocess(recovery_file),
+ BackendInterface::SubProcessResult::SUCCESS);
ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/VERSION",
recovery_info->cleanup() ? "2\n" : "1\n", params));
bf::path path = kSmokePackagesDirectory / "RecoveryPkg.tpk";
int wait_time = delay + interval * test_count;
- SmokeTestHelperRunner::Result ret = backend.MountInstallWithSubprocessAndKill(
- path, params.test_user.uid, wait_time);
- if (ret == SmokeTestHelperRunner::Result::SUCCESS) {
+ BackendInterface::SubProcessResult ret = backend.MountInstallWithSubprocessAndKill(
+ path, wait_time);
+ if (ret == BackendInterface::SubProcessResult::SUCCESS) {
std::cout << "mount install finished before process killed" << std::endl;
return;
}
"this test is skipped" << std::endl;
return;
}
- ASSERT_EQ(backend.RecoveryWithSubprocess(recovery_file, params.test_user.uid),
- SmokeTestHelperRunner::Result::SUCCESS);
+ ASSERT_EQ(backend.RecoveryWithSubprocess(recovery_file),
+ BackendInterface::SubProcessResult::SUCCESS);
ASSERT_TRUE(CheckPackageNonExistance(pkgid, params));
}
kSmokePackagesDirectory / "RecoveryPkg2.tpk";
int wait_time = delay + interval * test_count;
- ASSERT_EQ(backend.MountInstallWithSubprocess(path_old, params.test_user.uid),
- SmokeTestHelperRunner::Result::SUCCESS);
+ ASSERT_EQ(backend.MountInstallWithSubprocess(path_old),
+ BackendInterface::SubProcessResult::SUCCESS);
- SmokeTestHelperRunner::Result ret = backend.MountInstallWithSubprocessAndKill(
- path_new, params.test_user.uid, wait_time);
- if (ret == SmokeTestHelperRunner::Result::SUCCESS) {
+ BackendInterface::SubProcessResult ret = backend.MountInstallWithSubprocessAndKill(
+ path_new, wait_time);
+ if (ret == BackendInterface::SubProcessResult::SUCCESS) {
std::cout << "mount update finished before process killed" << std::endl;
return;
}
ScopedTzipInterface poweroff_unmount_interface(pkgid, params.test_user.uid);
poweroff_unmount_interface.Release();
- ASSERT_EQ(backend.RecoveryWithSubprocess(recovery_file, params.test_user.uid),
- SmokeTestHelperRunner::Result::SUCCESS);
+ ASSERT_EQ(backend.RecoveryWithSubprocess(recovery_file),
+ BackendInterface::SubProcessResult::SUCCESS);
ScopedTzipInterface interface(pkgid, params.test_user.uid);
ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));