Commit 39d8f5ef authored by Rich Prohaska's avatar Rich Prohaska

fix the bdb truncate with cursors test. addresses #968

git-svn-id: file:///svn/tokudb@5244 c7de825b-a66e-492c-adef-691d508d4ae1
parent 39d3494c
// truncate a database with open cursors // truncate a database with open cursors
// verify that the truncate returns EINVAL // verify that the truncate returns EINVAL
// BDB returns 0 but calls the error callback
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -10,6 +11,16 @@ ...@@ -10,6 +11,16 @@
#include <db.h> #include <db.h>
#include "test.h" #include "test.h"
#if USE_BDB
int test_errors = 0;
void test_errcall(const DB_ENV *emv, const char *errpfx, const char *msg) {
if (verbose) printf("%s %s\n", errpfx, msg);
test_errors++;
}
#endif
// try to truncate with cursors active // try to truncate with cursors active
int test_truncate_with_cursors(int n) { int test_truncate_with_cursors(int n) {
int r; int r;
...@@ -53,8 +64,17 @@ int test_truncate_with_cursors(int n) { ...@@ -53,8 +64,17 @@ int test_truncate_with_cursors(int n) {
assert(i == n); assert(i == n);
// try to truncate with an active cursor // try to truncate with an active cursor
#if USE_BDB
db->set_errcall(db, test_errcall);
assert(test_errors == 0);
#endif
u_int32_t row_count = 0; u_int32_t row_count = 0;
r = db->truncate(db, 0, &row_count, 0); assert(r == EINVAL); r = db->truncate(db, 0, &row_count, 0);
#if USE_BDB
assert(r == 0 && test_errors);
#else
assert(r == EINVAL);
#endif
r = cursor->c_close(cursor); assert(r == 0); r = cursor->c_close(cursor); assert(r == 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