Commit 454d6f16 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

Make the cursor delete tests work under bdb. Addresses #788, #789.

git-svn-id: file:///svn/tokudb@3874 c7de825b-a66e-492c-adef-691d508d4ae1
parent ff98e5e1
......@@ -20,6 +20,13 @@ int verbose=0;
#define CKERR2(r,r2) ({ if (r!=r2) fprintf(stderr, "%s:%d error %d %s, expected %d\n", __FILE__, __LINE__, r, db_strerror(r), r2); assert(r==r2); })
#define CKERR2s(r,r2,r3) ({ if (r!=r2 && r!=r3) fprintf(stderr, "%s:%d error %d %s, expected %d or %d\n", __FILE__, __LINE__, r, db_strerror(r), r2,r3); assert(r==r2||r==r3); })
// If the error code depends on BDB vs TDB use this
#ifdef USE_TDB
#define CKERR_depending(r,tdbexpect,bdbexpect) CKERR2(r,tdbexpect)
#else
#define CKERR_depending(r,tdbexpect,bdbexpect) CKERR2(r,bdbexpect)
#endif
void parse_args (int argc, const char *argv[]) {
const char *argv0=argv[0];
while (argc>1) {
......
......@@ -38,7 +38,7 @@ void test_cursor_delete2 () {
r = txn->commit(txn, 0); CKERR(r);
r = dbenv->txn_begin(dbenv, 0, &txn, 0); CKERR(r);
r = db->del(db, txn, dbt_init(&key, "a", 2), DB_DELETE_ANY); CKERR(r);
r = db->del(db, txn, dbt_init(&key, "a", 2), DB_DELETE_ANY); CKERR_depending(r,0,DB_NOTFOUND);
r = txn->commit(txn, 0); CKERR(r);
r = dbenv->txn_begin(dbenv, 0, &txn, 0); CKERR(r);
......@@ -52,7 +52,7 @@ void test_cursor_delete2 () {
r = dbenv->txn_begin(dbenv, 0, &txn, 0); CKERR(r);
r = db->del(db, txn, dbt_init(&key, "a", 2), 0); CKERR(r);
r = db->del(db, txn, dbt_init(&key, "a", 2), DB_DELETE_ANY); CKERR(r);
r = db->del(db, txn, dbt_init(&key, "a", 2), DB_DELETE_ANY); CKERR_depending(r,0,DB_NOTFOUND);
r = txn->commit(txn, 0); CKERR(r);
r = db->close(db, 0); CKERR(r);
......
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