Commit e13ce592 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

#4390 speed up loader tests run from the makefile refs[t:4390]

git-svn-id: file:///svn/toku/tokudb@38819 c7de825b-a66e-492c-adef-691d508d4ae1
parent d6b7f734
......@@ -200,6 +200,8 @@ BDB_DONTRUN_TESTS = \
recover-ft6 \
recover-ft7 \
recover-ft8 \
recover-ft9 \
recover-ft10 \
recover-loader-test \
recover-lsn-filter-multiple \
recover-put-multiple \
......@@ -592,12 +594,6 @@ ABORTCODE=137
fi \
$(MAYBEINVERTER) $(SUMMARIZE_CMD)
.PHONY: %.loader
# Generally these subtests cannot run in parallel unless they support an environment arg
%.loader: %.tdb$(BINSUF) $(PTHREAD_LOCAL)
$(TDBVGRIND) ./$< $(EXTRA_ARGS) $(VERBVERBOSE) $(MAYBEINVERTER) $(SUMMARIZE_CMD)
$(TDBVGRIND) ./$< $(EXTRA_ARGS) -p $(VERBVERBOSE) $(MAYBEINVERTER) $(SUMMARIZE_CMD)
.PHONY: %.recover
all.recover: $(patsubst %,test_log%.recover,$(TLRECOVER)) $(PTHREAD_LOCAL) ;
......@@ -906,54 +902,48 @@ test3039.tdbrun: test3039.tdb
( ($(VGRIND) ./$< -v -n 1000 ) && ./$< -v ) $(SUMMARIZE_CMD)
# loader tests
.PHONY: %.loader
%.loader: %.nop.loader %.p.loader
true
%.nop.loader: %.tdb$(BINSUF) $(PTHREAD_LOCAL)
$(TDBVGRIND) ./$< $(EXTRA_ARGS) -e dir.$@ $(VERBVERBOSE) $(MAYBEINVERTER) $(SUMMARIZE_CMD)
%.p.loader: %.tdb$(BINSUF) $(PTHREAD_LOCAL)
$(TDBVGRIND) ./$< $(EXTRA_ARGS) -p -e dir.$@ $(VERBVERBOSE) $(MAYBEINVERTER) $(SUMMARIZE_CMD)
# re-enable loader-stress-test3 when upgrade is complete
#loader-stress-test.loader: $(patsubst %,loader-stress-test%.tdbrun, 0 1 2 3)
loader-stress-test.loader: $(patsubst %,loader-stress-test%.tdbrun, 0 1 2)
true
true
loader-stress-test0.tdbrun: loader-stress-test.tdb$(BINSUF)
$(TDBVGRIND) ./$< $(EXTRA_ARGS) -e 0 -c $(VERBVERBOSE) $(MAYBEINVERTER) $(SUMMARIZE_CMD)
$(TDBVGRIND) ./$< $(EXTRA_ARGS) -c -e dir.$@ $(VERBVERBOSE) $(MAYBEINVERTER) $(SUMMARIZE_CMD)
loader-stress-test1.tdbrun: loader-stress-test.tdb$(BINSUF)
$(TDBVGRIND) ./$< $(EXTRA_ARGS) -e 1 -c -p $(VERBVERBOSE) $(MAYBEINVERTER) $(SUMMARIZE_CMD)
$(TDBVGRIND) ./$< $(EXTRA_ARGS) -c -p -e dir.$@ $(VERBVERBOSE) $(MAYBEINVERTER) $(SUMMARIZE_CMD)
loader-stress-test2.tdbrun: loader-stress-test.tdb$(BINSUF)
$(TDBVGRIND) ./$< $(EXTRA_ARGS) -e 2 -r 5000 -s $(VERBVERBOSE) $(MAYBEINVERTER) $(SUMMARIZE_CMD) # to manifest #2717.
$(TDBVGRIND) ./$< $(EXTRA_ARGS) -r 5000 -s -e dir.$@ $(VERBVERBOSE) $(MAYBEINVERTER) $(SUMMARIZE_CMD) # to manifest #2717.
loader-stress-test3.tdbrun: loader-stress-test.tdb$(BINSUF)
$(TDBVGRIND) ./$< $(EXTRA_ARGS) -e 3 -u -c $(VERBVERBOSE) $(MAYBEINVERTER) $(SUMMARIZE_CMD)
$(TDBVGRIND) ./$< $(EXTRA_ARGS) -u -c -e dir.$@ $(VERBVERBOSE) $(MAYBEINVERTER) $(SUMMARIZE_CMD)
loader-dup-test.loader loader-dup-test.tdbrun: $(patsubst %,loader-dup-test%.tdbrun, 0 1 2 3 4 5)
true $(SUMMARIZE_CMD) #State that this has passed. Override the default rule.
loader-dup-test0.tdbrun: loader-dup-test.tdb$(BINSUF)
$(VGRIND) ./loader-dup-test.tdb -e 0 $(SUMMARIZE_CMD)
$(VGRIND) ./loader-dup-test.tdb -e dir.$@ $(SUMMARIZE_CMD)
loader-dup-test1.tdbrun: loader-dup-test.tdb$(BINSUF)
$(VGRIND) ./loader-dup-test.tdb -d 1 -r 500000 -e 1 $(SUMMARIZE_CMD)
$(VGRIND) ./loader-dup-test.tdb -d 1 -r 500000 -e dir.$@ $(SUMMARIZE_CMD)
loader-dup-test2.tdbrun: loader-dup-test.tdb$(BINSUF)
$(VGRIND) ./loader-dup-test.tdb -d 1 -r 1000000 -e 2 $(SUMMARIZE_CMD)
$(VGRIND) ./loader-dup-test.tdb -d 1 -r 1000000 -e dir.$@ $(SUMMARIZE_CMD)
loader-dup-test3.tdbrun: loader-dup-test.tdb$(BINSUF)
$(VGRIND) ./loader-dup-test.tdb -d 1 -s -r 100 -e 3 $(SUMMARIZE_CMD)
$(VGRIND) ./loader-dup-test.tdb -d 1 -s -r 100 -e dir.$@ $(SUMMARIZE_CMD)
loader-dup-test4.tdbrun: loader-dup-test.tdb$(BINSUF)
$(VGRIND) ./loader-dup-test.tdb -d 1 -s -r 1000 -e 4 $(SUMMARIZE_CMD)
$(VGRIND) ./loader-dup-test.tdb -d 1 -s -r 1000 -e dir.$@ $(SUMMARIZE_CMD)
loader-dup-test5.tdbrun: loader-dup-test.tdb$(BINSUF)
$(VGRIND) ./loader-dup-test.tdb -d 1 -s -r 1000 -E -e 5 $(SUMMARIZE_CMD)
$(VGRIND) ./loader-dup-test.tdb -d 1 -s -r 1000 -E -e dir.$@ $(SUMMARIZE_CMD)
loader-cleanup-test.loader: $(patsubst %,loader-cleanup-test%.tdbrun, 0 1)
true
loader-cleanup-test0.tdbrun: loader-cleanup-test.tdb$(BINSUF)
$(VGRIND) ./$< -s -r 8000 -e 0 $(SUMMARIZE_CMD)
$(VGRIND) ./$< -s -r 8000 -e dir.$@ $(SUMMARIZE_CMD)
loader-cleanup-test1.tdbrun: loader-cleanup-test.tdb$(BINSUF)
$(VGRIND) ./$< -s -r 8000 -p -e 1 $(SUMMARIZE_CMD)
LOADER_USE_DEFAULT_TESTS = create-abort create-close no-puts reference-test stress-test tpch-load
$(VGRIND) ./$< -s -r 8000 -p -e dir.$@ $(SUMMARIZE_CMD)
loader-tests: $(LOADER_TESTS)
echo $(LOADER_TESTS)
......@@ -964,7 +954,6 @@ CHECK_HOTINDEXER_UNDO_TESTS = $(patsubst %.test,%.run,$(HOTINDEXER_UNDO_TESTS))
hotindexer-undo-do-test.tdbrun: $(CHECK_HOTINDEXER_UNDO_TESTS)
true
$(CHECK_HOTINDEXER_UNDO_TESTS): %.run: %.test hotindexer-undo-do-test.tdb$(BINSUF)
./run-hotindexer-undo-do-tests.bash $< $(SUMMARIZE_CMD)
......@@ -998,36 +987,27 @@ stress_tests.drdrun: $(TINY_STRESS_TESTS) \
large_test_stress1.drdrun large_test_stress3.drdrun \
test_4015.drdrun
true
tiny_stress_tests.drdrun: $(TINY_STRESS_TESTS)
true
mid_stress_tests.drdrun: $(MID_STRESS_TESTS)
true
large_stress_tests.drdrun: $(LARGE_STRESS_TESTS)
true
tiny_%.drdrun: %.tdb
$(VALGRIND) --tool=drd --quiet --suppressions=drd.suppressions --error-exitcode=1 ./$< $(VERBVERBOSE) --num_seconds 5 --num_elements 150 --envdir dir.$@ \
$(MAYBEINVERTER) $(SUMMARIZE_CMD)
mid_%.drdrun: %.tdb
./$< --only_create --envdir dir.$@ --num_elements 10000 && \
$(VALGRIND) --tool=drd --quiet --suppressions=drd.suppressions --error-exitcode=1 ./$< $(VERBVERBOSE) --only_stress --num_seconds 100 --envdir dir.$@ --num_elements 10000 \
$(MAYBEINVERTER) $(SUMMARIZE_CMD)
large_%.drdrun: %.tdb
./$< --only_create --envdir dir.$@ && \
$(VALGRIND) --tool=drd --quiet --suppressions=drd.suppressions --error-exitcode=1 ./$< $(VERBVERBOSE) --only_stress --num_seconds 1000 --envdir dir.$@ \
$(MAYBEINVERTER) $(SUMMARIZE_CMD)
test_4015.drdrun: test_4015.tdb
$(VALGRIND) --tool=drd --quiet --suppressions=drd.suppressions --error-exitcode=1 ./$< --envdir dir.tdb.$@ \
$(MAYBEINVERTER) $(SUMMARIZE_CMD)
# upgrade tests
UPGRADE_TEST_SRCS = $(wildcard upgrade-test-*.c)
UPGRADE_TESTS = $(patsubst %.c,%,$(UPGRADE_TEST_SRCS))
......@@ -1036,7 +1016,6 @@ UPGRADE_TESTS_VALGRIND = $(patsubst upgrade-test-%,upgrade-test-%.valgrind,$(UPG
upgrade-tests.tdbrun: $(UPGRADE_TESTS_VALGRIND)
echo $(UPGRADE_TESTS_VALGRIND)
true
upgrade-test-%.valgrind: upgrade-test-%.tdb
$(VGRIND) ./$< $(VERBVERBOSE) $(SUMMARIZE_CMD)
......@@ -1045,22 +1024,16 @@ keyrange.tdbrun: keyrange-get0.tdbrun keyrange-get1.tdbrun \
keyrange-random-get0.tdbrun keyrange-random-get1.tdbrun \
keyrange-loader-get0.tdbrun keyrange-loader-get1.tdbrun
true
keyrange-get0.tdbrun: keyrange.tdb
$(TDBVGRIND) ./$< $(VERBVERBOSE) --get 0 --envdir dir.$@ $(MAYBEINVERTER) $(SUMMARIZE_CMD)
keyrange-get1.tdbrun: keyrange.tdb
$(TDBVGRIND) ./$< $(VERBVERBOSE) --get 1 --envdir dir.$@ $(MAYBEINVERTER) $(SUMMARIZE_CMD)
keyrange-random-get0.tdbrun: keyrange.tdb
$(TDBVGRIND) ./$< $(VERBVERBOSE) --get 0 --random_keys 1 --envdir dir.$@ $(MAYBEINVERTER) $(SUMMARIZE_CMD)
keyrange-random-get1.tdbrun: keyrange.tdb
$(TDBVGRIND) ./$< $(VERBVERBOSE) --get 1 --random_keys 1 --envdir dir.$@ $(MAYBEINVERTER) $(SUMMARIZE_CMD)
keyrange-loader-get0.tdbrun: keyrange.tdb
$(TDBVGRIND) ./$< $(VERBVERBOSE) --get 0 --loader 1 --envdir dir.$@ $(MAYBEINVERTER) $(SUMMARIZE_CMD)
keyrange-loader-get1.tdbrun: keyrange.tdb
$(TDBVGRIND) ./$< $(VERBVERBOSE) --get 1 --loader 1 --envdir dir.$@ $(MAYBEINVERTER) $(SUMMARIZE_CMD)
......
......@@ -751,8 +751,7 @@ static void test_loader(enum test_type t, DB **dbs, int trigger)
static int run_test_count = 0;
static char *free_me = NULL;
static char *env_dir = ENVDIR;
static char *envdir = ENVDIR;
static void run_test(enum test_type t, int trigger)
{
......@@ -765,10 +764,10 @@ static void run_test(enum test_type t, int trigger)
fflush(stdout);
}
char rm_cmd[strlen("rm -rf ") + strlen(env_dir) + 1];
sprintf(rm_cmd, "rm -rf %s", env_dir);
char rm_cmd[strlen("rm -rf ") + strlen(envdir) + 1];
sprintf(rm_cmd, "rm -rf %s", envdir);
r = system(rm_cmd); CKERR(r);
r = toku_os_mkdir(env_dir, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = toku_os_mkdir(envdir, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = db_env_create(&env, 0); CKERR(r);
r = env->set_redzone(env, 0); CKERR(r);
......@@ -777,7 +776,7 @@ static void run_test(enum test_type t, int trigger)
CKERR(r);
int envflags = DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN | DB_CREATE | DB_PRIVATE;
r = env->open(env, env_dir, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = env->open(env, envdir, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
env->set_errfile(env, stderr);
//Disable auto-checkpointing
r = env->checkpointing_set_period(env, 0); CKERR(r);
......@@ -961,7 +960,6 @@ int test_main(int argc, char * const *argv) {
else
run_all_tests();
printf("run_test_count=%d\n", run_test_count);
if (free_me) toku_free(free_me);
return 0;
}
......@@ -1020,12 +1018,7 @@ static void do_args(int argc, char * const argv[]) {
db_env_set_loader_size_factor(1);
} else if (strcmp(argv[0],"-e") == 0 && argc > 1) {
argc--; argv++;
if (free_me) toku_free(free_me);
int len = strlen(ENVDIR) + strlen(argv[0]) + 2;
char full_env_dir[len];
int r = snprintf(full_env_dir, len, "%s.%s", ENVDIR, argv[0]);
assert(r<len);
free_me = env_dir = toku_strdup(full_env_dir);
envdir = argv[0];
} else {
fprintf(stderr, "Unknown arg: %s\n", argv[0]);
resultcode=1;
......
......@@ -9,6 +9,7 @@
#include <db.h>
static int loader_flags = 0;
static char *envdir = ENVDIR;
static int put_multiple_generate(DB *UU(dest_db), DB *UU(src_db), DBT *UU(dest_key), DBT *UU(dest_val), const DBT *UU(src_key), const DBT *UU(src_val)) {
return ENOMEM;
......@@ -17,15 +18,17 @@ static int put_multiple_generate(DB *UU(dest_db), DB *UU(src_db), DBT *UU(dest_k
static void loader_open_abort(void) {
int r;
r = system("rm -rf " ENVDIR); CKERR(r);
r = toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
char rmcmd[32 + strlen(envdir)];
snprintf(rmcmd, sizeof rmcmd, "rm -rf %s", envdir);
r = system(rmcmd); CKERR(r);
r = toku_os_mkdir(envdir, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
DB_ENV *env;
r = db_env_create(&env, 0); CKERR(r);
r = env->set_generate_row_callback_for_put(env, put_multiple_generate);
CKERR(r);
int envflags = DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN | DB_CREATE | DB_PRIVATE;
r = env->open(env, ENVDIR, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = env->open(env, envdir, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
env->set_errfile(env, stderr);
DB_TXN *txn;
......@@ -58,6 +61,10 @@ static void do_args(int argc, char * const argv[]) {
if (verbose<0) verbose=0;
} else if (strcmp(argv[0], "-p") == 0) {
loader_flags = LOADER_USE_PUTS;
} else if (strcmp(argv[0], "-e") == 0) {
argc--; argv++;
if (argc > 0)
envdir = argv[0];
} else {
fprintf(stderr, "Unknown arg: %s\n", argv[0]);
resultcode=1;
......
......@@ -9,6 +9,7 @@
#include <db.h>
static int loader_flags = 0;
static char *envdir = ENVDIR;
static int put_multiple_generate(DB *UU(dest_db), DB *UU(src_db), DBT *UU(dest_key), DBT *UU(dest_val), const DBT *UU(src_key), const DBT *UU(src_val)) {
return ENOMEM;
......@@ -17,15 +18,17 @@ static int put_multiple_generate(DB *UU(dest_db), DB *UU(src_db), DBT *UU(dest_k
static void loader_open_abort(int ndb) {
int r;
r = system("rm -rf " ENVDIR); CKERR(r);
r = toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
char rmcmd[32 + strlen(envdir)];
snprintf(rmcmd, sizeof rmcmd, "rm -rf %s", envdir);
r = system(rmcmd); CKERR(r);
r = toku_os_mkdir(envdir, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
DB_ENV *env;
r = db_env_create(&env, 0); CKERR(r);
r = env->set_generate_row_callback_for_put(env, put_multiple_generate);
CKERR(r);
int envflags = DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN | DB_CREATE | DB_PRIVATE;
r = env->open(env, ENVDIR, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = env->open(env, envdir, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
env->set_errfile(env, stderr);
DB *dbs[ndb];
......@@ -74,6 +77,10 @@ static void do_args(int argc, char * const argv[]) {
if (verbose<0) verbose=0;
} else if (strcmp(argv[0], "-p") == 0) {
loader_flags = LOADER_USE_PUTS;
} else if (strcmp(argv[0], "-e") == 0) {
argc--; argv++;
if (argc > 0)
envdir = argv[0];
} else {
fprintf(stderr, "Unknown arg: %s\n", argv[0]);
resultcode=1;
......
......@@ -8,6 +8,7 @@
#include <db.h>
static int loader_flags = 0;
static char *envdir = ENVDIR;
static int put_multiple_generate(DB *UU(dest_db), DB *UU(src_db), DBT *UU(dest_key), DBT *UU(dest_val), const DBT *UU(src_key), const DBT *UU(src_val)) {
return ENOMEM;
......@@ -16,15 +17,17 @@ static int put_multiple_generate(DB *UU(dest_db), DB *UU(src_db), DBT *UU(dest_k
static void loader_open_abort(int ndb) {
int r;
r = system("rm -rf " ENVDIR); CKERR(r);
r = toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
char rmcmd[32 + strlen(envdir)];
snprintf(rmcmd, sizeof rmcmd, "rm -rf %s", envdir);
r = system(rmcmd); CKERR(r);
r = toku_os_mkdir(envdir, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
DB_ENV *env;
r = db_env_create(&env, 0); CKERR(r);
r = env->set_generate_row_callback_for_put(env, put_multiple_generate);
CKERR(r);
int envflags = DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN | DB_CREATE | DB_PRIVATE;
r = env->open(env, ENVDIR, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = env->open(env, envdir, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
env->set_errfile(env, stderr);
DB *dbs[ndb];
......@@ -78,6 +81,10 @@ static void do_args(int argc, char * const argv[]) {
if (verbose<0) verbose=0;
} else if (strcmp(argv[0], "-p") == 0) {
loader_flags = LOADER_USE_PUTS;
} else if (strcmp(argv[0], "-e") == 0) {
argc--; argv++;
if (argc > 0)
envdir = argv[0];
} else {
fprintf(stderr, "Unknown arg: %s\n", argv[0]);
resultcode=1;
......
......@@ -7,6 +7,8 @@
#include <db.h>
#include <sys/stat.h>
static char *envdir = ENVDIR;
DB_ENV *env;
int USE_PUTS=0;
enum {MAX_NAME=128};
......@@ -102,8 +104,10 @@ static void test_loader(DB **dbs)
static void run_test(void)
{
int r;
r = system("rm -rf " ENVDIR); CKERR(r);
r = toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
char rmcmd[32 + strlen(envdir)];
snprintf(rmcmd, sizeof rmcmd, "rm -rf %s", envdir);
r = system(rmcmd); CKERR(r);
r = toku_os_mkdir(envdir, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = db_env_create(&env, 0); CKERR(r);
r = env->set_default_bt_compare(env, int64_dbt_cmp); CKERR(r);
......@@ -111,7 +115,7 @@ static void run_test(void)
CKERR(r);
// int envflags = DB_INIT_LOCK | DB_INIT_MPOOL | DB_INIT_TXN | DB_CREATE | DB_PRIVATE | DB_INIT_LOG;
int envflags = DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN | DB_CREATE | DB_PRIVATE | DB_INIT_LOG;
r = env->open(env, ENVDIR, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = env->open(env, envdir, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
env->set_errfile(env, stderr);
//Disable auto-checkpointing
r = env->checkpointing_set_period(env, 0); CKERR(r);
......@@ -175,6 +179,10 @@ static void do_args(int argc, char * const argv[]) {
if (verbose<0) verbose=0;
} else if (strcmp(argv[0], "-p")==0) {
USE_PUTS = 1;
} else if (strcmp(argv[0], "-e") == 0) {
argc--; argv++;
if (argc > 0)
envdir = argv[0];
} else {
fprintf(stderr, "Unknown arg: %s\n", argv[0]);
resultcode=1;
......
......@@ -7,6 +7,8 @@
#include <db.h>
#include <sys/stat.h>
static char *envdir = ENVDIR;
DB_ENV *env;
int USE_PUTS=0;
enum {MAX_NAME=128};
......@@ -104,9 +106,13 @@ static void test_loader(DB **dbs)
static void run_test(void)
{
int r;
r = system("rm -rf " ENVDIR); CKERR(r);
r = toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = toku_os_mkdir(ENVDIR "/log", S_IRWXU+S_IRWXG+S_IRWXO);
char rmcmd[32 + strlen(envdir)];
snprintf(rmcmd, sizeof rmcmd, "rm -rf %s", envdir);
r = system(rmcmd); CKERR(r);
r = toku_os_mkdir(envdir, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
char logdir[8 + strlen(envdir)];
snprintf(logdir, sizeof logdir, "%s/log", envdir);
r = toku_os_mkdir(logdir, S_IRWXU+S_IRWXG+S_IRWXO);
CKERR(r);
r = db_env_create(&env, 0); CKERR(r);
......@@ -117,7 +123,7 @@ static void run_test(void)
CKERR(r);
// int envflags = DB_INIT_LOCK | DB_INIT_MPOOL | DB_INIT_TXN | DB_CREATE | DB_PRIVATE | DB_INIT_LOG;
int envflags = DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN | DB_CREATE | DB_PRIVATE | DB_INIT_LOG;
r = env->open(env, ENVDIR, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = env->open(env, envdir, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
env->set_errfile(env, stderr);
//Disable auto-checkpointing
r = env->checkpointing_set_period(env, 0); CKERR(r);
......@@ -182,6 +188,10 @@ static void do_args(int argc, char * const argv[]) {
} else if (strcmp(argv[0], "--block_size") == 0) {
argc--; argv++;
block_size = atoi(argv[0]);
} else if (strcmp(argv[0], "-e") == 0) {
argc--; argv++;
if (argc > 0)
envdir = argv[0];
} else {
fprintf(stderr, "Unknown arg: %s\n", argv[0]);
resultcode=1;
......
......@@ -460,9 +460,7 @@ static void test_loader(DB **dbs)
}
}
char *free_me = NULL;
char *env_dir = ENVDIR; // the default env_dir.
static char *envdir = ENVDIR;
char *tmp_subdir = "tmp.subdir";
#define OLDDATADIR "../../../../tokudb.data/"
......@@ -476,7 +474,7 @@ static void setup(void) {
src_db_dir = db_v4_dir;
r = snprintf(syscmd, len, "cp -r %s %s", src_db_dir, env_dir);
r = snprintf(syscmd, len, "cp -r %s %s", src_db_dir, envdir);
assert(r<len);
r = system(syscmd);
CKERR(r);
......@@ -486,16 +484,16 @@ static void run_test(void)
{
int r;
int cmdlen = strlen(env_dir) + strlen(tmp_subdir) + 10;
int cmdlen = strlen(envdir) + strlen(tmp_subdir) + 10;
char tmpdir[cmdlen];
r = snprintf(tmpdir, cmdlen, "%s/%s", env_dir, tmp_subdir);
r = snprintf(tmpdir, cmdlen, "%s/%s", envdir, tmp_subdir);
assert(r<cmdlen);
// first delete anything left from previous run of this test
{
int len = strlen(env_dir) + 20;
int len = strlen(envdir) + 20;
char syscmd[len];
r = snprintf(syscmd, len, "rm -rf %s", env_dir);
r = snprintf(syscmd, len, "rm -rf %s", envdir);
assert(r<len);
r = system(syscmd); CKERR(r);
}
......@@ -503,7 +501,7 @@ static void run_test(void)
setup();
}
else {
r = toku_os_mkdir(env_dir, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = toku_os_mkdir(envdir, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = toku_os_mkdir(tmpdir, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
}
......@@ -519,7 +517,7 @@ static void run_test(void)
r = env->set_generate_row_callback_for_put(env, put_multiple_generate);
CKERR(r);
int envflags = DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN | DB_CREATE | DB_PRIVATE;
r = env->open(env, env_dir, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = env->open(env, envdir, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
env->set_errfile(env, stderr);
r = env->checkpointing_set_period(env, 60); CKERR(r);
......@@ -565,7 +563,6 @@ int test_main(int argc, char * const *argv) {
do_args(argc, argv);
run_test();
if (free_me) toku_free(free_me);
if (progress_infos) {
if (verbose>=2) {
......@@ -631,12 +628,7 @@ static void do_args(int argc, char * const argv[]) {
}
} else if (strcmp(argv[0], "-e")==0) {
argc--; argv++;
if (free_me) toku_free(free_me);
int len = strlen(ENVDIR) + strlen(argv[0]) + 2;
char full_env_dir[len];
int r = snprintf(full_env_dir, len, "%s.%s", ENVDIR, argv[0]);
assert(r<len);
free_me = env_dir = toku_strdup(full_env_dir);
envdir = argv[0];
} else if (strcmp(argv[0], "-v")==0) {
verbose++;
} else if (strcmp(argv[0],"-q")==0) {
......
......@@ -443,9 +443,7 @@ static void test_loader(DB **dbs)
}
}
char *free_me = NULL;
char *env_dir = ENVDIR; // the default env_dir.
static char *envdir = ENVDIR;
char *tmp_subdir = "tmp.subdir";
#define OLDDATADIR "../../../../tokudb.data/"
......@@ -459,7 +457,7 @@ static void setup(void) {
src_db_dir = db_v4_dir;
r = snprintf(syscmd, len, "cp -r %s %s", src_db_dir, env_dir);
r = snprintf(syscmd, len, "cp -r %s %s", src_db_dir, envdir);
assert(r<len);
r = system(syscmd);
CKERR(r);
......@@ -469,16 +467,16 @@ static void run_test(void)
{
int r;
int cmdlen = strlen(env_dir) + strlen(tmp_subdir) + 10;
int cmdlen = strlen(envdir) + strlen(tmp_subdir) + 10;
char tmpdir[cmdlen];
r = snprintf(tmpdir, cmdlen, "%s/%s", env_dir, tmp_subdir);
r = snprintf(tmpdir, cmdlen, "%s/%s", envdir, tmp_subdir);
assert(r<cmdlen);
// first delete anything left from previous run of this test
{
int len = strlen(env_dir) + 20;
int len = strlen(envdir) + 20;
char syscmd[len];
r = snprintf(syscmd, len, "rm -rf %s", env_dir);
r = snprintf(syscmd, len, "rm -rf %s", envdir);
assert(r<len);
r = system(syscmd); CKERR(r);
}
......@@ -486,7 +484,7 @@ static void run_test(void)
setup();
}
else {
r = toku_os_mkdir(env_dir, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = toku_os_mkdir(envdir, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = toku_os_mkdir(tmpdir, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
}
......@@ -503,7 +501,7 @@ static void run_test(void)
r = env->set_generate_row_callback_for_put(env, put_multiple_generate);
CKERR(r);
int envflags = DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN | DB_CREATE | DB_PRIVATE;
r = env->open(env, env_dir, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = env->open(env, envdir, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
env->set_errfile(env, stderr);
r = env->checkpointing_set_period(env, 60); CKERR(r);
......@@ -549,7 +547,6 @@ int test_main(int argc, char * const *argv) {
do_args(argc, argv);
run_test();
if (free_me) toku_free(free_me);
if (progress_infos) {
if (verbose>=2) {
......@@ -615,12 +612,7 @@ static void do_args(int argc, char * const argv[]) {
}
} else if (strcmp(argv[0], "-e")==0) {
argc--; argv++;
if (free_me) toku_free(free_me);
int len = strlen(ENVDIR) + strlen(argv[0]) + 2;
char full_env_dir[len];
int r = snprintf(full_env_dir, len, "%s.%s", ENVDIR, argv[0]);
assert(r<len);
free_me = env_dir = toku_strdup(full_env_dir);
envdir = argv[0];
} else if (strcmp(argv[0], "-v")==0) {
verbose++;
} else if (strcmp(argv[0],"-q")==0) {
......
......@@ -11,9 +11,10 @@ DB_ENV *env;
enum {MAX_NAME=128};
enum {MAX_DBS=16};
enum {MAX_ROW_LEN=1024};
int NUM_DBS=10;
int USE_PUTS=0;
int USE_REGION=0;
static int NUM_DBS=10;
static int USE_PUTS=0;
static int USE_REGION=0;
static char *envdir = ENVDIR;
static int generate_rows_for_region(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_val, const DBT *src_key, const DBT *src_val) __attribute__((unused));
static int generate_rows_for_lineitem(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_val, const DBT *src_key, const DBT *src_val) __attribute__((unused));
......@@ -361,8 +362,10 @@ static int test_loader(DB **dbs)
static int run_test(void)
{
int r;
r = system("rm -rf " ENVDIR); CKERR(r);
r = toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
char rmcmd[32 + strlen(envdir)];
snprintf(rmcmd, sizeof rmcmd, "rm -rf %s", envdir);
r = system(rmcmd); CKERR(r);
r = toku_os_mkdir(envdir, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = db_env_create(&env, 0); CKERR(r);
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
......@@ -378,7 +381,7 @@ static int run_test(void)
}
int envflags = DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN | DB_CREATE | DB_PRIVATE;
r = env->open(env, ENVDIR, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = env->open(env, envdir, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
env->set_errfile(env, stderr);
//Disable auto-checkpointing
r = env->checkpointing_set_period(env, 0); CKERR(r);
......@@ -443,6 +446,10 @@ static void do_args(int argc, char * const argv[]) {
USE_PUTS = 1;
} else if (strcmp(argv[0], "-g")==0) {
USE_REGION = 1;
} else if (strcmp(argv[0], "-e") == 0) {
argc--; argv++;
if (argc > 0)
envdir = argv[0];
} else {
fprintf(stderr, "Unknown arg: %s\n", argv[0]);
resultcode=1;
......
......@@ -86,7 +86,7 @@ else ifeq ($(VERBOSE),1)
MAYBEATSIGN=@
endif
CPPFLAGS = $(INCLUDEDIRS) -I$(PORTABILITY_HEADERS) -I$(TOKUROOT)toku_include
CPPFLAGS = $(INCLUDEDIRS) -I$(PORTABILITY_HEADERS) -I$(TOKUROOT)toku_include $(EXTRA_INCLUDES)
ifeq ($(SYSTEM),freebsd)
CPPFLAGS += -DTOKU_ALLOW_DEPRECATED
endif
......
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