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

#4045 run some test_stress1 variations with drd refs[t:4045]

git-svn-id: file:///svn/toku/tokudb@35828 c7de825b-a66e-492c-adef-691d508d4ae1
parent ddee7456
...@@ -965,17 +965,17 @@ check_blocking_tdb: $(BLOCKING_TDB_TESTS) ...@@ -965,17 +965,17 @@ check_blocking_tdb: $(BLOCKING_TDB_TESTS)
check_blocking_bdb: $(BLOCKING_BDB_TESTS) check_blocking_bdb: $(BLOCKING_BDB_TESTS)
check_drd: drd_tiny_test_stress1.tdbrun drd_test_stress1.tdbrun drd_test_stress1.1000.tdbrun check_drd: drd_tiny_test_stress1.tdbrun drd_mid_test_stress1.tdbrun drd_test_stress1.tdbrun
true true
drd_tiny_test_stress1.tdbrun: test_stress1.tdb drd_tiny_test_stress1.tdbrun: test_stress1.tdb
$(VALGRIND) --tool=drd --quiet --suppressions=drd.suppressions ./test_stress1.tdb --num_seconds 5 --num_elements 150 --envdir dir.$@ $(VALGRIND) --tool=drd --quiet --suppressions=drd.suppressions ./test_stress1.tdb $(VERBVERBOSE) --num_seconds 5 --num_elements 150 --envdir dir.$@
drd_test_stress1.tdbrun: test_stress1.tdb drd_mid_test_stress1.tdbrun: test_stress1.tdb
./test_stress1.tdb --only_create --envdir dir.$@ && \ ./test_stress1.tdb --only_create --envdir dir.$@ --num_elements 10000 && \
$(VALGRIND) --tool=drd --quiet --suppressions=drd.suppressions ./test_stress1.tdb --verbose --only_stress --num_seconds 10 --envdir dir.$@ $(VALGRIND) --tool=drd --quiet --suppressions=drd.suppressions ./test_stress1.tdb $(VERBVERBOSE) --only_stress --num_seconds 100 --envdir dir.$@ --num_elements 10000
drd_test_stress1.1000.tdbrun: test_stress1.tdb drd_test_stress1.tdbrun: test_stress1.tdb
./test_stress1.tdb --only_create --envdir dir.$@ && \ ./test_stress1.tdb --only_create --envdir dir.$@ && \
$(VALGRIND) --tool=drd --quiet --suppressions=drd.suppressions ./test_stress1.tdb --verbose --only_stress --num_seconds 1000 --envdir dir.$@ $(VALGRIND) --tool=drd --quiet --suppressions=drd.suppressions ./test_stress1.tdb $(VERBVERBOSE) --only_stress --num_seconds 1000 --envdir dir.$@
...@@ -73,6 +73,8 @@ static void *worker(void *arg_v) { ...@@ -73,6 +73,8 @@ static void *worker(void *arg_v) {
DB_ENV *env = arg->env; DB_ENV *env = arg->env;
DB** dbp = arg->dbp; DB** dbp = arg->dbp;
DB_TXN *txn = NULL; DB_TXN *txn = NULL;
if (verbose)
printf("%lu starting %p\n", toku_pthread_self(), arg->operation);
while (run_test) { while (run_test) {
if (arg->lock_type != STRESS_LOCK_NONE) { if (arg->lock_type != STRESS_LOCK_NONE) {
toku_pthread_mutex_lock(arg->broadcast_lock_mutex); toku_pthread_mutex_lock(arg->broadcast_lock_mutex);
...@@ -104,6 +106,8 @@ static void *worker(void *arg_v) { ...@@ -104,6 +106,8 @@ static void *worker(void *arg_v) {
usleep(arg->sleep_ms * 1000); usleep(arg->sleep_ms * 1000);
} }
} }
if (verbose)
printf("%lu returning\n", toku_pthread_self());
return arg; return arg;
} }
...@@ -519,10 +523,14 @@ static void *test_time(void *arg) { ...@@ -519,10 +523,14 @@ static void *test_time(void *arg) {
// if num_Seconds is set to 0, run indefinitely // if num_Seconds is set to 0, run indefinitely
// //
if (num_seconds != 0) { if (num_seconds != 0) {
if (verbose) printf("Sleeping for %d seconds\n", num_seconds); if (verbose)
printf("Sleeping for %d seconds\n", num_seconds);
usleep(num_seconds*1000*1000); usleep(num_seconds*1000*1000);
if (verbose) printf("should now end test\n"); if (verbose)
printf("should now end test\n");
__sync_bool_compare_and_swap(&run_test, true, false); // make this atomic to make valgrind --tool=drd happy. __sync_bool_compare_and_swap(&run_test, true, false); // make this atomic to make valgrind --tool=drd happy.
if (verbose)
printf("run_test %d\n", run_test);
if (tte->crash_at_end) { if (tte->crash_at_end) {
toku_hard_crash_on_purpose(); toku_hard_crash_on_purpose();
} }
...@@ -546,16 +554,24 @@ static int run_workers(struct arg *thread_args, int num_threads, u_int32_t num_s ...@@ -546,16 +554,24 @@ static int run_workers(struct arg *thread_args, int num_threads, u_int32_t num_s
thread_args[i].broadcast_lock = &rwlock; thread_args[i].broadcast_lock = &rwlock;
thread_args[i].broadcast_lock_mutex = &mutex; thread_args[i].broadcast_lock_mutex = &mutex;
CHK(toku_pthread_create(&tids[i], NULL, worker, &thread_args[i])); CHK(toku_pthread_create(&tids[i], NULL, worker, &thread_args[i]));
if (verbose)
printf("%lu created\n", tids[i]);
} }
CHK(toku_pthread_create(&time_tid, NULL, test_time, &tte)); CHK(toku_pthread_create(&time_tid, NULL, test_time, &tte));
if (verbose)
printf("%lu created\n", time_tid);
void *ret; void *ret;
r = toku_pthread_join(time_tid, &ret); assert_zero(r); r = toku_pthread_join(time_tid, &ret); assert_zero(r);
if (verbose) printf("%lu joined\n", time_tid);
for (int i = 0; i < num_threads; ++i) { for (int i = 0; i < num_threads; ++i) {
r = toku_pthread_join(tids[i], &ret); assert_zero(r); r = toku_pthread_join(tids[i], &ret); assert_zero(r);
if (verbose)
printf("%lu joined\n", tids[i]);
} }
rwlock_destroy(&rwlock); rwlock_destroy(&rwlock);
if (verbose) printf("ending test, pthreads have joined\n"); if (verbose)
printf("ending test, pthreads have joined\n");
toku_pthread_mutex_destroy(&mutex); toku_pthread_mutex_destroy(&mutex);
return r; return r;
} }
......
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