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

refs[t:2591] a better brtloader open test

git-svn-id: file:///svn/toku/tokudb@20418 c7de825b-a66e-492c-adef-691d508d4ae1
parent 1ba93a61
...@@ -33,17 +33,33 @@ static void *my_malloc(size_t n) { ...@@ -33,17 +33,33 @@ static void *my_malloc(size_t n) {
return malloc(n); return malloc(n);
} }
static void test_loader_open(void) { static int my_compare(DB *UU(db), const DBT *UU(akey), const DBT *UU(bkey)) {
return EINVAL;
}
static void test_loader_open(int ndbs) {
int r; int r;
BRTLOADER loader; BRTLOADER loader;
// open the brtloader. this runs the extractor.
DB *dbs[ndbs];
const struct descriptor *descriptors[ndbs];
const char *fnames[ndbs];
brt_compare_func compares[ndbs];
for (int i = 0; i < ndbs; i++) {
dbs[i] = NULL;
descriptors[i] = NULL;
fnames[i] = "";
compares[i] = my_compare;
}
toku_set_func_malloc(my_malloc); toku_set_func_malloc(my_malloc);
int i; int i;
for (i = 0; ; i++) { for (i = 0; ; i++) {
set_my_malloc_trigger(i+1); set_my_malloc_trigger(i+1);
r = toku_brt_loader_open(&loader, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, "", ZERO_LSN); r = toku_brt_loader_open(&loader, NULL, NULL, NULL, ndbs, dbs, descriptors, fnames, compares, "", ZERO_LSN);
if (r == 0) if (r == 0)
break; break;
} }
...@@ -72,7 +88,8 @@ int test_main (int argc, const char *argv[]) { ...@@ -72,7 +88,8 @@ int test_main (int argc, const char *argv[]) {
argc--; argv++; argc--; argv++;
} }
test_loader_open(); test_loader_open(0);
test_loader_open(1);
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