Commit 63053359 authored by Barry Perlman's avatar Barry Perlman Committed by Yoni Fogel

[t:2499] loader-cleanup-test: Improve error reporting

git-svn-id: file:///svn/toku/tokudb@20429 c7de825b-a66e-492c-adef-691d508d4ae1
parent b46d876f
...@@ -536,7 +536,7 @@ static int poll_function (void *extra, float progress) { ...@@ -536,7 +536,7 @@ static int poll_function (void *extra, float progress) {
return abort_on_poll; return abort_on_poll;
} }
static void test_loader(enum test_type t, DB **dbs) static void test_loader(enum test_type t, DB **dbs, int trigger)
{ {
int failed_put = 0; int failed_put = 0;
int error_injection; // are we expecting simulated errors from system calls? int error_injection; // are we expecting simulated errors from system calls?
...@@ -632,6 +632,10 @@ static void test_loader(enum test_type t, DB **dbs) ...@@ -632,6 +632,10 @@ static void test_loader(enum test_type t, DB **dbs)
if (verbose) if (verbose)
printf("closing, but expecting abort via poll\n"); printf("closing, but expecting abort via poll\n");
r = loader->close(loader); r = loader->close(loader);
if (r == 0) {
printf("loader->close() returned 0 but should have failed due to non-zero return from polling function.\n");
fflush(stdout);
}
assert(r); // not defined what close() returns when poll function returns non-zero assert(r); // not defined what close() returns when poll function returns non-zero
} }
else if (error_injection && !failed_put) { else if (error_injection && !failed_put) {
...@@ -639,8 +643,14 @@ static void test_loader(enum test_type t, DB **dbs) ...@@ -639,8 +643,14 @@ static void test_loader(enum test_type t, DB **dbs)
if (verbose) if (verbose)
printf("closing, but expecting failure from simulated error (enospc or einval)%s\n", type); printf("closing, but expecting failure from simulated error (enospc or einval)%s\n", type);
r = loader->close(loader); r = loader->close(loader);
if (!USE_PUTS) if (!USE_PUTS) {
if (r == 0) {
printf("loader->close() reutrned 0 but should have failed due to injected error from %s on call %d\n",
err_type_str(t), trigger);
fflush(stdout);
}
assert(r); assert(r);
}
else else
CKERR(r); // if using puts, "outer" loader should close just fine CKERR(r); // if using puts, "outer" loader should close just fine
} }
...@@ -783,7 +793,7 @@ static void run_test(enum test_type t, int trigger) ...@@ -783,7 +793,7 @@ static void run_test(enum test_type t, int trigger)
db_env_set_func_open(bad_open); db_env_set_func_open(bad_open);
db_env_set_func_fclose(bad_fclose); db_env_set_func_fclose(bad_fclose);
test_loader(t, dbs); test_loader(t, dbs, trigger);
for(int i=0;i<NUM_DBS;i++) { for(int i=0;i<NUM_DBS;i++) {
dbs[i]->close(dbs[i], 0); CKERR(r); dbs[i]->close(dbs[i], 0); CKERR(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