}
return RunInstallerWithPkgrmgr(pkgmgr, mode);
}
+
ci::AppInstaller::Result Install(const bf::path& path,
RequestResult mode = RequestResult::NORMAL) {
const char* argv[] = {"", "-i", path.c_str(), "-u", kTestUserIdStr.c_str()};
return CallBackend(SIZEOFARRAY(argv), argv, mode);
}
+ci::AppInstaller::Result InstallWithTEP(
+ const bf::path& path,
+ const bf::path& tep,
+ RequestResult mode = RequestResult::NORMAL) {
+ const char* argv[] = {"", "-i", path.c_str(), "-u", kTestUserIdStr.c_str(),
+ "-e", tep.c_str()};
+ return CallBackend(SIZEOFARRAY(argv), argv, mode);
+}
+
ci::AppInstaller::Result Update(const bf::path& path_old,
const bf::path& path_new,
RequestResult mode = RequestResult::NORMAL) {
return CallBackend(SIZEOFARRAY(argv), argv, mode);
}
+ci::AppInstaller::Result MountInstallWithTEP(
+ const bf::path& path,
+ const bf::path& tep,
+ RequestResult mode = RequestResult::NORMAL) {
+ const char* argv[] = {"", "-w", path.c_str(), "-u", kTestUserIdStr.c_str(),
+ "-e", tep.c_str()};
+ return CallBackend(SIZEOFARRAY(argv), argv, mode);
+}
+
ci::AppInstaller::Result MountUpdate(const bf::path& path_old,
const bf::path& path_new,
RequestResult mode = RequestResult::NORMAL) {
ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/VERSION", "2\n"));
}
+#define TEP_TEST_STARTING_BLOCK(NUMBER) \
+ bf::path path = kSmokePackagesDirectory / "TEP_Tpk"; \
+ path += #NUMBER; \
+ path += ".tpk"; \
+ bf::path tep1 = kSmokePackagesDirectory / "tep1.tep"; \
+ bf::path tep2 = kSmokePackagesDirectory / "tep2.tep"; \
+ std::string number = std::to_string(50 + NUMBER - 1); \
+ std::string pkgid = std::string("smokeapp") + number; \
+ std::string appid = pkgid + ".TEP"; \
+
+TEST_F(SmokeTest, TEP_Tpk_TepInstall) {
+ TEP_TEST_STARTING_BLOCK(1)
+ ASSERT_EQ(InstallWithTEP(path, tep1), ci::AppInstaller::Result::OK);
+ ValidatePackage(pkgid, appid);
+ ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "tep/tep1.tep", "tep1\n"));
+}
+
+TEST_F(SmokeTest, TEP_Tpk_TepInstallTepUpdate) {
+ TEP_TEST_STARTING_BLOCK(2)
+ ASSERT_EQ(InstallWithTEP(path, tep1), ci::AppInstaller::Result::OK);
+ ASSERT_EQ(InstallWithTEP(path, tep2), ci::AppInstaller::Result::OK);
+ ValidatePackage(pkgid, appid);
+ ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "tep/tep2.tep", "tep2\n"));
+}
+
+TEST_F(SmokeTest, TEP_Tpk_NoTepInstallTepUpdate) {
+ TEP_TEST_STARTING_BLOCK(3)
+ ASSERT_EQ(Install(path), ci::AppInstaller::Result::OK);
+ ASSERT_EQ(InstallWithTEP(path, tep2), ci::AppInstaller::Result::OK);
+ ValidatePackage(pkgid, appid);
+ ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "tep/tep2.tep", "tep2\n"));
+}
+
+TEST_F(SmokeTest, TEP_Tpk_TepInstallNoTepUpdate) {
+ TEP_TEST_STARTING_BLOCK(4)
+ ASSERT_EQ(InstallWithTEP(path, tep1), ci::AppInstaller::Result::OK);
+ ASSERT_EQ(Install(path), ci::AppInstaller::Result::OK);
+ ValidatePackage(pkgid, appid);
+ ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "tep/tep1.tep", "tep1\n"));
+}
+
+TEST_F(SmokeTest, TEP_Tpk_TepInstallTepUpdateRollback) {
+ TEP_TEST_STARTING_BLOCK(5)
+ ASSERT_EQ(InstallWithTEP(path, tep1), ci::AppInstaller::Result::OK);
+ ASSERT_EQ(InstallWithTEP(path, tep2, RequestResult::FAIL),
+ ci::AppInstaller::Result::ERROR);
+ ValidatePackage(pkgid, appid);
+ ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "tep/tep1.tep", "tep1\n"));
+}
+
+TEST_F(SmokeTest, TEP_Tpk_NoTepInstallTepUpdateRollback) {
+ TEP_TEST_STARTING_BLOCK(6)
+ ASSERT_EQ(Install(path), ci::AppInstaller::Result::OK);
+ ASSERT_EQ(InstallWithTEP(path, tep2, RequestResult::FAIL),
+ ci::AppInstaller::Result::ERROR);
+ ValidatePackage(pkgid, appid);
+ bf::path root_path = ci::GetRootAppPath(false,
+ kTestUserId);
+ bf::path tep_file = root_path / pkgid / "tep" / "tep2.tep";
+ ASSERT_FALSE(bf::exists(tep_file));
+}
+
+TEST_F(SmokeTest, TEP_Tpk_TepInstallNoTepUpdateRollback) {
+ TEP_TEST_STARTING_BLOCK(7)
+ ASSERT_EQ(InstallWithTEP(path, tep1), ci::AppInstaller::Result::OK);
+ ASSERT_EQ(Install(path, RequestResult::FAIL),
+ ci::AppInstaller::Result::ERROR);
+ ValidatePackage(pkgid, appid);
+ ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "tep/tep1.tep", "tep1\n"));
+}
+
+TEST_F(SmokeTest, TEP_Tpk_Mount_TepInstall) {
+ TEP_TEST_STARTING_BLOCK(8)
+ ASSERT_EQ(MountInstallWithTEP(path, tep1), ci::AppInstaller::Result::OK);
+ ScopedTzipInterface package_mount(pkgid);
+ ValidatePackage(pkgid, appid);
+ ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "tep/tep1.tep", "tep1\n"));
+}
+
+TEST_F(SmokeTest, TEP_Tpk_Mount_TepInstallTepUpdate) {
+ TEP_TEST_STARTING_BLOCK(9)
+ ASSERT_EQ(MountInstallWithTEP(path, tep1), ci::AppInstaller::Result::OK);
+ ASSERT_EQ(MountInstallWithTEP(path, tep2), ci::AppInstaller::Result::OK);
+ ScopedTzipInterface package_mount(pkgid);
+ ValidatePackage(pkgid, appid);
+ ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "tep/tep2.tep", "tep2\n"));
+}
+
+TEST_F(SmokeTest, TEP_Tpk_Mount_NoTepInstallTepUpdate) {
+ TEP_TEST_STARTING_BLOCK(10)
+ ASSERT_EQ(MountInstall(path), ci::AppInstaller::Result::OK);
+ ASSERT_EQ(MountInstallWithTEP(path, tep2), ci::AppInstaller::Result::OK);
+ ScopedTzipInterface package_mount(pkgid);
+ ValidatePackage(pkgid, appid);
+ ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "tep/tep2.tep", "tep2\n"));
+}
+
+TEST_F(SmokeTest, TEP_Tpk_Mount_TepInstallNoTepUpdate) {
+ TEP_TEST_STARTING_BLOCK(11)
+ ASSERT_EQ(MountInstallWithTEP(path, tep1), ci::AppInstaller::Result::OK);
+ ASSERT_EQ(MountInstall(path), ci::AppInstaller::Result::OK);
+ ScopedTzipInterface package_mount(pkgid);
+ ValidatePackage(pkgid, appid);
+ ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "tep/tep1.tep", "tep1\n"));
+}
+
+TEST_F(SmokeTest, TEP_Tpk_Mount_TepInstallTepUpdateRollback) {
+ TEP_TEST_STARTING_BLOCK(12)
+ ASSERT_EQ(MountInstallWithTEP(path, tep1), ci::AppInstaller::Result::OK);
+ ASSERT_EQ(MountInstallWithTEP(path, tep2, RequestResult::FAIL),
+ ci::AppInstaller::Result::ERROR);
+ ScopedTzipInterface package_mount(pkgid);
+ ValidatePackage(pkgid, appid);
+ ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "tep/tep1.tep", "tep1\n"));
+}
+
+TEST_F(SmokeTest, TEP_Tpk_Mount_NoTepInstallTepUpdateRollback) {
+ TEP_TEST_STARTING_BLOCK(13)
+ ASSERT_EQ(MountInstall(path), ci::AppInstaller::Result::OK);
+ ASSERT_EQ(MountInstallWithTEP(path, tep2, RequestResult::FAIL),
+ ci::AppInstaller::Result::ERROR);
+ ScopedTzipInterface package_mount(pkgid);
+ ValidatePackage(pkgid, appid);
+ bf::path root_path = ci::GetRootAppPath(false,
+ kTestUserId);
+ bf::path tep_file = root_path / pkgid / "tep" / "tep2.tep";
+ ASSERT_FALSE(bf::exists(tep_file));
+}
+
+TEST_F(SmokeTest, TEP_Tpk_Mount_TepInstallNoTepUpdateRollback) {
+ TEP_TEST_STARTING_BLOCK(14)
+ ASSERT_EQ(MountInstallWithTEP(path, tep1), ci::AppInstaller::Result::OK);
+ ASSERT_EQ(MountInstall(path, RequestResult::FAIL),
+ ci::AppInstaller::Result::ERROR);
+ ScopedTzipInterface package_mount(pkgid);
+ ValidatePackage(pkgid, appid);
+ ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "tep/tep1.tep", "tep1\n"));
+}
+
} // namespace common_installer
int main(int argc, char** argv) {