Commit 387bfff4 authored by Rich Prohaska's avatar Rich Prohaska

#205 run test_block_allocator_merge with valgrind

parent 397a5361
...@@ -197,16 +197,25 @@ test_big_merge (void) { ...@@ -197,16 +197,25 @@ test_big_merge (void) {
uint64_t an = twoG; uint64_t an = twoG;
uint64_t bn = 1; uint64_t bn = 1;
struct block_allocator_blockpair *MALLOC_N(an+bn, a); struct block_allocator_blockpair *MALLOC_N(an+bn, a);
struct block_allocator_blockpair *MALLOC_N(bn, b);
if (a == nullptr) {
fprintf(stderr, "%s:%u malloc failed, continuing\n", __FUNCTION__, __LINE__);
goto malloc_failed;
}
if (b == nullptr) {
fprintf(stderr, "%s:%u malloc failed, continuing\n", __FUNCTION__, __LINE__);
goto malloc_failed;
}
assert(a); assert(a);
struct block_allocator_blockpair *MALLOC_N(bn, b);
assert(b); assert(b);
for (uint64_t i=0; i<an; i++) a[i].offset=i+1; for (uint64_t i=0; i<an; i++) a[i].offset=i+1;
b[0].offset = 0; b[0].offset = 0;
block_allocator_merge_blockpairs_into(an, a, bn, b); block_allocator_merge_blockpairs_into(an, a, bn, b);
for (uint64_t i=0; i<an+bn; i++) assert(a[i].offset == i); for (uint64_t i=0; i<an+bn; i++) assert(a[i].offset == i);
toku_free(a); malloc_failed:
toku_free(b); toku_free(a);
toku_free(b);
} }
} }
......
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