Commit 22c8ad8f authored by Yoni Fogel's avatar Yoni Fogel

Addresses #1531 Port test_db_env_open_dir_priority to windows

git-svn-id: file:///svn/toku/tokudb@9977 c7de825b-a66e-492c-adef-691d508d4ae1
parent e74c5fb8
...@@ -30,22 +30,25 @@ do { ...@@ -30,22 +30,25 @@ do {
#define DB_HOME "DB_HOME" #define DB_HOME "DB_HOME"
#define DBNAME "test.db" #define DBNAME "test.db"
int rootfd;
char* db_dir; char* db_dir;
char db_name[PATH_MAX]; char db_name[PATH_MAX];
int extra_flags; int extra_flags;
char* home; char* home;
BOOL inside_env = FALSE;
static void static void
reinit_config (int set_home, int set_DB_ENVIRON, int set_DB_HOME) { reinit_config (int set_home, int set_DB_ENVIRON, int set_DB_HOME) {
int r = 0; int r = 0;
//Return to base dir //Return to base dir
r = fchdir(rootfd); assert(r == 0); if (inside_env) {
r = chdir("../"); CKERR(r);
}
r = system("rm -rf " ENVDIR); assert(r == 0); r = system("rm -rf " ENVDIR); assert(r == 0);
r = toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); assert(r == 0); r = toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); assert(r == 0);
r = chdir(ENVDIR); assert(r == 0); r = chdir(ENVDIR); assert(r == 0);
inside_env = TRUE;
unsetenv(DB_HOME); unsetenv(DB_HOME);
if (set_home) { if (set_home) {
...@@ -73,8 +76,6 @@ test_main(int argc, const char *argv[]) { ...@@ -73,8 +76,6 @@ test_main(int argc, const char *argv[]) {
int r; int r;
int i; int i;
rootfd = open(".", O_RDONLY, 0); assert(rootfd >= 0);
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
int set_home = i & 0x1; int set_home = i & 0x1;
int set_DB_ENVIRON = i & 0x2; int set_DB_ENVIRON = i & 0x2;
...@@ -122,6 +123,5 @@ cleanup: ...@@ -122,6 +123,5 @@ cleanup:
CKERR(r); CKERR(r);
} }
r = close(rootfd); assert(r == 0);
return 0; return 0;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment