const char kApplicationDirBackup[] = ".applications.bck";
const char KUserAppsDir[] = "apps_rw";
const char KUserAppsDirBackup[] = "apps_rw.bck";
+const char kUserDataBaseDir[] = "/opt/dbspace/user";
enum class RequestResult {
NORMAL,
}
void PackageCheckCleanup(const std::string& pkgid,
- const std::vector<std::string>& appids) {
+ const std::vector<std::string>&) {
bf::path root_path = ci::GetRootAppPath(false);
bf::path package_path = root_path / pkgid;
ASSERT_FALSE(bf::exists(package_path));
explicit SmokeEnvironment(const bf::path& home) : home_(home) {
}
void SetUp() override {
+ bf::path UserDBDir = bf::path(kUserDataBaseDir) / std::to_string(getuid());
+ bf::path UserDBDirBackup = UserDBDir.string() + std::string(".bck");
+
bs::error_code error;
bf::remove_all(home_ / kApplicationDirBackup, error);
bf::remove_all(home_ / KUserAppsDirBackup, error);
+ bf::remove_all(UserDBDirBackup, error);
if (bf::exists(home_ / KUserAppsDir)) {
bf::rename(home_ / KUserAppsDir, home_ / KUserAppsDirBackup, error);
if (error)
<< (home_ / kApplicationDirBackup) << " should not exist.";
assert(!error);
}
+ if (bf::exists(UserDBDir)) {
+ bf::rename(UserDBDir, UserDBDirBackup, error);
+ if (error)
+ LOG(ERROR) << "Failed to setup test environment. Does some previous"
+ << " test crashed? Directory: "
+ << UserDBDirBackup << " should not exist.";
+ assert(!error);
+ }
}
void TearDown() override {
+ bf::path UserDBDir = bf::path(kUserDataBaseDir) / std::to_string(getuid());
+ bf::path UserDBDirBackup = UserDBDir.string() + std::string(".bck");
+
bs::error_code error;
bf::remove_all(home_ / kApplicationDir, error);
bf::remove_all(home_ / KUserAppsDir, error);
+ bf::remove_all(UserDBDir, error);
if (bf::exists(home_ / KUserAppsDirBackup))
bf::rename(home_ / KUserAppsDirBackup, home_ / KUserAppsDir, error);
if (bf::exists(home_ / kApplicationDirBackup))
bf::rename(home_ / kApplicationDirBackup, home_ / kApplicationDir, error);
+ if (bf::exists(UserDBDirBackup))
+ bf::rename(UserDBDirBackup, UserDBDir, error);
}
private: