From 95e8ac768f30470c7763991db4820cae8df514e1 Mon Sep 17 00:00:00 2001 From: "Bradley C. Kuszmaul" Date: Tue, 22 Jul 2008 21:42:22 +0000 Subject: [PATCH] Fiddle with the error code for truncate under bdb. Addresses #968. git-svn-id: file:///svn/tokudb@5269 c7de825b-a66e-492c-adef-691d508d4ae1 --- src/tests/test_truncate_with_cursors.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/tests/test_truncate_with_cursors.c b/src/tests/test_truncate_with_cursors.c index da49fe823fc..73a49cbbaf0 100644 --- a/src/tests/test_truncate_with_cursors.c +++ b/src/tests/test_truncate_with_cursors.c @@ -15,7 +15,7 @@ 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); + if (verbose) fprintf(stderr, "%s %s\n", errpfx, msg); test_errors++; } @@ -71,7 +71,14 @@ int test_truncate_with_cursors(int n) { u_int32_t row_count = 0; r = db->truncate(db, 0, &row_count, 0); #if USE_BDB - assert(r == 0 && test_errors); + // It looks like for 4.6 there's no error code, even though the documentation says "it is an error to truncate with open cursors". + // For 4.3 the error code is EINVAL + // I don't know where the boundary really is: Is it an error in 4.5 or 4.4? + if (DB_VERSION_MAJOR==4 && DB_VERSION_MINOR>=6) { + assert(r == 0 && test_errors); + } else { + assert(r == EINVAL && test_errors); + } #else assert(r == EINVAL); #endif