Commit c42703fd authored by Vincenzo Liberatore's avatar Vincenzo Liberatore

Addresses #337

Modify test cases to support lock bound

git-svn-id: file:///svn/tokudb@2106 c7de825b-a66e-492c-adef-691d508d4ae1
parent 3277dbc8
...@@ -4,12 +4,13 @@ int main() { ...@@ -4,12 +4,13 @@ int main() {
int r; int r;
toku_lock_tree* lt = NULL; toku_lock_tree* lt = NULL;
DB* db = (DB*)1; DB* db = (DB*)1;
size_t mem = 4096 * 1000; u_int32_t mem = 4096 * 1000;
u_int32_t memcnt;
BOOL duplicates; BOOL duplicates;
for (duplicates = 0; duplicates < 2; duplicates++) { for (duplicates = 0; duplicates < 2; duplicates++) {
r = toku_lt_create(&lt, db, duplicates, dbpanic, mem, dbcmp, dbcmp, r = toku_lt_create(&lt, db, duplicates, dbpanic, mem, &memcnt,
toku_malloc, toku_free, toku_realloc); dbcmp, dbcmp, toku_malloc, toku_free, toku_realloc);
CKERR(r); CKERR(r);
assert(lt); assert(lt);
r = toku_lt_close(lt); r = toku_lt_close(lt);
......
...@@ -6,7 +6,8 @@ static DBT _key; ...@@ -6,7 +6,8 @@ static DBT _key;
static DBT _data; static DBT _data;
DBT* key; DBT* key;
DBT* data; DBT* data;
size_t mem = 4096 * 1000; u_int32_t mem = 4096 * 1000;
u_int32_t memcnt;
static void do_range_test(int (*acquire)(toku_lock_tree*, DB_TXN*, static void do_range_test(int (*acquire)(toku_lock_tree*, DB_TXN*,
const DBT*, const DBT*, const DBT*, const DBT*,
...@@ -39,8 +40,8 @@ static void do_range_test(int (*acquire)(toku_lock_tree*, DB_TXN*, ...@@ -39,8 +40,8 @@ static void do_range_test(int (*acquire)(toku_lock_tree*, DB_TXN*,
reverse_data_l = &_data_l; reverse_data_l = &_data_l;
reverse_data_r = &_data_r; reverse_data_r = &_data_r;
} }
r = toku_lt_create(&lt, db, duplicates, dbpanic, mem, dbcmp, dbcmp, r = toku_lt_create(&lt, db, duplicates, dbpanic, mem, &memcnt,
toku_malloc, toku_free, toku_realloc); dbcmp, dbcmp, toku_malloc, toku_free, toku_realloc);
CKERR(r); CKERR(r);
assert(lt); assert(lt);
...@@ -141,8 +142,8 @@ static void do_point_test(int (*acquire)(toku_lock_tree*, DB_TXN*, ...@@ -141,8 +142,8 @@ static void do_point_test(int (*acquire)(toku_lock_tree*, DB_TXN*,
reverse_data = &_data; reverse_data = &_data;
data = NULL; data = NULL;
} }
r = toku_lt_create(&lt, db, duplicates, dbpanic, mem, dbcmp, dbcmp, r = toku_lt_create(&lt, db, duplicates, dbpanic, mem, &memcnt,
toku_malloc, toku_free, toku_realloc); dbcmp, dbcmp, toku_malloc, toku_free, toku_realloc);
CKERR(r); CKERR(r);
assert(lt); assert(lt);
...@@ -194,37 +195,44 @@ int main(int argc, const char *argv[]) { ...@@ -194,37 +195,44 @@ int main(int argc, const char *argv[]) {
/* create tests. */ /* create tests. */
for (duplicates = 0; duplicates < 2; duplicates++) { for (duplicates = 0; duplicates < 2; duplicates++) {
r = toku_lt_create(NULL, db, duplicates, dbpanic, mem, dbcmp, dbcmp, r = toku_lt_create(NULL, db, duplicates, dbpanic, mem, &memcnt,
toku_malloc, toku_free, toku_realloc); dbcmp, dbcmp, toku_malloc, toku_free, toku_realloc);
CKERR2(r, EINVAL); CKERR2(r, EINVAL);
r = toku_lt_create(&lt, NULL, duplicates, dbpanic, mem, dbcmp, dbcmp, r = toku_lt_create(&lt, NULL, duplicates, dbpanic, mem, &memcnt,
toku_malloc, toku_free, toku_realloc); dbcmp, dbcmp, toku_malloc, toku_free, toku_realloc);
CKERR2(r, EINVAL); CKERR2(r, EINVAL);
r = toku_lt_create(&lt, db, duplicates, NULL, mem, dbcmp, dbcmp, r = toku_lt_create(&lt, db, duplicates, NULL, mem, &memcnt,
toku_malloc, toku_free, toku_realloc); dbcmp, dbcmp, toku_malloc, toku_free, toku_realloc);
CKERR2(r, EINVAL); CKERR2(r, EINVAL);
size_t old_mem = mem; u_int32_t old_mem = mem;
mem = 0; mem = 0;
r = toku_lt_create(&lt, db, duplicates, dbpanic, mem, dbcmp, dbcmp, r = toku_lt_create(&lt, db, duplicates, dbpanic, mem, &memcnt,
toku_malloc, toku_free, toku_realloc); dbcmp, dbcmp, toku_malloc, toku_free, toku_realloc);
CKERR2(r, EINVAL); CKERR2(r, EINVAL);
mem = old_mem; mem = old_mem;
r = toku_lt_create(&lt, db, duplicates, dbpanic, mem, NULL, dbcmp, r = toku_lt_create(&lt, db, duplicates, dbpanic, mem, NULL,
toku_malloc, toku_free, toku_realloc); NULL, dbcmp, toku_malloc, toku_free, toku_realloc);
CKERR2(r, EINVAL); CKERR2(r, EINVAL);
r = toku_lt_create(&lt, db, duplicates, dbpanic, mem, dbcmp, NULL,
r = toku_lt_create(&lt, db, duplicates, dbpanic, mem, &memcnt,
NULL, dbcmp, toku_malloc, toku_free, toku_realloc);
CKERR2(r, EINVAL);
r = toku_lt_create(&lt, db, duplicates, dbpanic, mem, &memcnt,
dbcmp, NULL,
toku_malloc, toku_free, toku_realloc); toku_malloc, toku_free, toku_realloc);
CKERR2(r, EINVAL); CKERR2(r, EINVAL);
r = toku_lt_create(&lt, db, duplicates, dbpanic, mem, dbcmp, dbcmp, r = toku_lt_create(&lt, db, duplicates, dbpanic, mem, &memcnt,
dbcmp, dbcmp,
NULL, toku_free, toku_realloc); NULL, toku_free, toku_realloc);
CKERR2(r, EINVAL); CKERR2(r, EINVAL);
r = toku_lt_create(&lt, db, duplicates, dbpanic, mem, dbcmp, dbcmp, r = toku_lt_create(&lt, db, duplicates, dbpanic, mem, &memcnt,
toku_malloc, NULL, toku_realloc); dbcmp, dbcmp, toku_malloc, NULL, toku_realloc);
CKERR2(r, EINVAL); CKERR2(r, EINVAL);
r = toku_lt_create(&lt, db, duplicates, dbpanic, mem, dbcmp, dbcmp, r = toku_lt_create(&lt, db, duplicates, dbpanic, mem, &memcnt,
toku_malloc, toku_free, NULL); dbcmp, dbcmp, toku_malloc, toku_free, NULL);
CKERR2(r, EINVAL); CKERR2(r, EINVAL);
} }
......
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