Commit cae93165 authored by Yoni Fogel's avatar Yoni Fogel

addresses #479 fix test 25 to work with

git-svn-id: file:///svn/tokudb@2718 c7de825b-a66e-492c-adef-691d508d4ae1
parent 2277a29b
...@@ -15,7 +15,7 @@ static void* malloc_fail(size_t size) { ...@@ -15,7 +15,7 @@ static void* malloc_fail(size_t size) {
return malloc(size); return malloc(size);
} }
int main(int argc, const char *argv[]) { void RunTest (BOOL f_overlaps_allowed) {
int i, j; int i, j;
int r; int r;
toku_range_tree *tree; toku_range_tree *tree;
...@@ -26,11 +26,10 @@ int main(int argc, const char *argv[]) { ...@@ -26,11 +26,10 @@ int main(int argc, const char *argv[]) {
for (i = 0; i < 1024; i++) for (i = 0; i < 1024; i++)
nums[i] = i; nums[i] = i;
parse_args(argc, argv);
/* Insert and delete lots of ranges to force memory increase and decrease */ /* Insert and delete lots of ranges to force memory increase and decrease */
r = toku_rt_create(&tree, int_cmp, char_cmp, TRUE, malloc, free, realloc); r = toku_rt_create(&tree, int_cmp, char_cmp, f_overlaps_allowed, malloc, free, realloc);
CKERR(r); CKERR(r);
/* Insert lots of ranges */ /* Insert lots of ranges */
...@@ -61,16 +60,26 @@ int main(int argc, const char *argv[]) { ...@@ -61,16 +60,26 @@ int main(int argc, const char *argv[]) {
/* Failure when allocating the tree */ /* Failure when allocating the tree */
malloc_cnt = 0; malloc_cnt = 0;
malloc_cntl = 1; malloc_cntl = 1;
r = toku_rt_create(&tree, int_cmp, char_cmp, TRUE, malloc_fail, free, r = toku_rt_create(&tree, int_cmp, char_cmp, f_overlaps_allowed, malloc_fail, free,
realloc); realloc);
CKERR2(r, ENOMEM); CKERR2(r, ENOMEM);
/* Failure when allocating the tree ranges */ /* Failure when allocating the tree ranges */
malloc_cnt = 0; malloc_cnt = 0;
malloc_cntl = 2; malloc_cntl = 2;
r = toku_rt_create(&tree, int_cmp, char_cmp, TRUE, malloc_fail, free, r = toku_rt_create(&tree, int_cmp, char_cmp, f_overlaps_allowed, malloc_fail, free,
realloc); realloc);
CKERR2(r, ENOMEM); CKERR2(r, ENOMEM);
}
int main(int argc, const char *argv[]) {
parse_args(argc, argv);
#ifndef TOKU_RT_NOOVERLAPS
RunTest(TRUE);
#endif
RunTest(FALSE);
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