Commit 2e3262a9 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

fix some more root fifo tests for bdb. closes #1721

git-svn-id: file:///svn/toku/tokudb@11488 c7de825b-a66e-492c-adef-691d508d4ae1
parent 13a3499a
...@@ -85,6 +85,9 @@ BDB_DONTRUN_TESTS = \ ...@@ -85,6 +85,9 @@ BDB_DONTRUN_TESTS = \
test_db_descriptor_named_db \ test_db_descriptor_named_db \
test_heaviside_straddle_1622 \ test_heaviside_straddle_1622 \
test_dbremove_old \ test_dbremove_old \
root_fifo_2 \
root_fifo_32 \
root_fifo_41 \
checkpoint_1 \ checkpoint_1 \
checkpoint_stress \ checkpoint_stress \
#\ ends prev line #\ ends prev line
......
...@@ -11,14 +11,15 @@ DBC *null_cursor = NULL; ...@@ -11,14 +11,15 @@ DBC *null_cursor = NULL;
static void root_fifo_verify(DB_ENV *env, int n) { static void root_fifo_verify(DB_ENV *env, int n) {
if (verbose) printf("%s:%d %d\n", __FUNCTION__, __LINE__, n); if (verbose) printf("%s:%d %d\n", __FUNCTION__, __LINE__, n);
int r; int r;
DB *db = null_db;
r = db_create(&db, env, 0); assert(r == 0); assert(db != NULL);
r = db->open(db, null_txn, "test.db", 0, DB_BTREE, DB_CREATE, S_IRWXU+S_IRWXG+S_IRWXO);
assert(r == 0);
DB_TXN *txn = null_txn; DB_TXN *txn = null_txn;
r = env->txn_begin(env, null_txn, &txn, 0); assert(r == 0); assert(txn != NULL); r = env->txn_begin(env, null_txn, &txn, 0); assert(r == 0); assert(txn != NULL);
DB *db = null_db;
r = db_create(&db, env, 0); assert(r == 0); assert(db != NULL);
r = db->open(db, txn, "test.db", 0, DB_BTREE, DB_CREATE, S_IRWXU+S_IRWXG+S_IRWXO);
assert(r == 0);
DBC *cursor = null_cursor; DBC *cursor = null_cursor;
r = db->cursor(db, txn, &cursor, 0); assert(r == 0); r = db->cursor(db, txn, &cursor, 0); assert(r == 0);
int i; int i;
...@@ -41,7 +42,7 @@ static void root_fifo_verify(DB_ENV *env, int n) { ...@@ -41,7 +42,7 @@ static void root_fifo_verify(DB_ENV *env, int n) {
r = db->close(db, 0); assert(r == 0); db = null_db; r = db->close(db, 0); assert(r == 0); db = null_db;
} }
static void root_fifo_1(int n) { static void root_fifo_2(int n) {
if (verbose) printf("%s:%d %d\n", __FUNCTION__, __LINE__, n); if (verbose) printf("%s:%d %d\n", __FUNCTION__, __LINE__, n);
int r; int r;
...@@ -84,7 +85,12 @@ static void root_fifo_1(int n) { ...@@ -84,7 +85,12 @@ static void root_fifo_1(int n) {
root_fifo_verify(env, n); root_fifo_verify(env, n);
// cleanup // cleanup
r = env->close(env, 0); assert(r == 0); env = null_env; r = env->close(env, 0);
#if TOKUDB
assert(r == 0); env = null_env;
#else
printf("%s:%d env close r=%d\n", __FUNCTION__, __LINE__, r);
#endif
} }
int test_main(int argc, char *argv[]) { int test_main(int argc, char *argv[]) {
...@@ -105,10 +111,10 @@ int test_main(int argc, char *argv[]) { ...@@ -105,10 +111,10 @@ int test_main(int argc, char *argv[]) {
} }
if (n >= 0) if (n >= 0)
root_fifo_1(n); root_fifo_2(n);
else else
for (i=0; i<100; i++) for (i=0; i<100; i++)
root_fifo_1(i); root_fifo_2(i);
return 0; return 0;
} }
...@@ -48,14 +48,14 @@ static void root_fifo_verify(DB_ENV *env, int n) { ...@@ -48,14 +48,14 @@ static void root_fifo_verify(DB_ENV *env, int n) {
if (verbose) printf("%s:%d %d\n", __FUNCTION__, __LINE__, n); if (verbose) printf("%s:%d %d\n", __FUNCTION__, __LINE__, n);
int r; int r;
DB_TXN *txn = null_txn;
r = env->txn_begin(env, null_txn, &txn, 0); assert(r == 0); assert(txn != NULL);
DB *db = null_db; DB *db = null_db;
r = db_create(&db, env, 0); assert(r == 0); assert(db != NULL); r = db_create(&db, env, 0); assert(r == 0); assert(db != NULL);
r = db->open(db, null_txn, "test.db", 0, DB_BTREE, DB_CREATE, S_IRWXU+S_IRWXG+S_IRWXO); r = db->open(db, txn, "test.db", 0, DB_BTREE, DB_CREATE, S_IRWXU+S_IRWXG+S_IRWXO);
assert(r == 0); assert(r == 0);
DB_TXN *txn = null_txn;
r = env->txn_begin(env, null_txn, &txn, 0); assert(r == 0); assert(txn != NULL);
DBC *cursor = null_cursor; DBC *cursor = null_cursor;
r = db->cursor(db, txn, &cursor, 0); assert(r == 0); r = db->cursor(db, txn, &cursor, 0); assert(r == 0);
int i; int i;
......
...@@ -48,14 +48,14 @@ static void root_fifo_verify(DB_ENV *env, int n, int expectn) { ...@@ -48,14 +48,14 @@ static void root_fifo_verify(DB_ENV *env, int n, int expectn) {
if (verbose) printf("%s:%d %d %d\n", __FUNCTION__, __LINE__, n, expectn); if (verbose) printf("%s:%d %d %d\n", __FUNCTION__, __LINE__, n, expectn);
int r; int r;
DB_TXN *txn = null_txn;
r = env->txn_begin(env, null_txn, &txn, 0); assert(r == 0); assert(txn != NULL);
DB *db = null_db; DB *db = null_db;
r = db_create(&db, env, 0); assert(r == 0); assert(db != NULL); r = db_create(&db, env, 0); assert(r == 0); assert(db != NULL);
r = db->open(db, null_txn, "test.db", 0, DB_BTREE, DB_CREATE, S_IRWXU+S_IRWXG+S_IRWXO); r = db->open(db, txn, "test.db", 0, DB_BTREE, DB_CREATE, S_IRWXU+S_IRWXG+S_IRWXO);
assert(r == 0); assert(r == 0);
DB_TXN *txn = null_txn;
r = env->txn_begin(env, null_txn, &txn, 0); assert(r == 0); assert(txn != NULL);
DBC *cursor = null_cursor; DBC *cursor = null_cursor;
r = db->cursor(db, txn, &cursor, 0); assert(r == 0); r = db->cursor(db, txn, &cursor, 0); assert(r == 0);
int i; int i;
......
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