Commit 261cb4ff authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

Remove those annoying error messages. Fixes #375.

git-svn-id: file:///svn/tokudb@2238 c7de825b-a66e-492c-adef-691d508d4ae1
parent cfa6c03f
......@@ -32,6 +32,7 @@ void test_cursor_current() {
unlink(fname);
r = db_create(&db, null_env, 0); assert(r == 0);
db->set_errfile(db,0); // Turn off those annoying errors
r = db->open(db, null_txn, fname, "main", DB_BTREE, DB_CREATE, 0666); assert(r == 0);
int k = 42, v = 42000;
......@@ -103,6 +104,7 @@ void test_reopen() {
int r;
r = db_create(&db, null_env, 0); assert(r == 0);
db->set_errfile(db,0); // Turn off those annoying errors
r = db->open(db, null_txn, fname, "main", DB_BTREE, 0, 0666); assert(r == 0);
db_get(db, 1, 1, DB_NOTFOUND);
......
......@@ -58,6 +58,7 @@ void test_cursor_delete(int dup_mode) {
/* create the dup database file */
r = db_create(&db, null_env, 0); assert(r == 0);
db->set_errfile(db,0); // Turn off those annoying errors
r = db->set_flags(db, dup_mode); assert(r == 0);
r = db->set_pagesize(db, pagesize); assert(r == 0);
r = db->open(db, null_txn, fname, "main", DB_BTREE, DB_CREATE, 0666); assert(r == 0);
......@@ -104,6 +105,7 @@ void test_cursor_delete_dupsort() {
/* create the dup database file */
r = db_create(&db, null_env, 0); assert(r == 0);
db->set_errfile(db,0); // Turn off those annoying errors
r = db->set_flags(db, DB_DUP + DB_DUPSORT); assert(r == 0);
r = db->set_pagesize(db, pagesize); assert(r == 0);
r = db->open(db, null_txn, fname, "main", DB_BTREE, DB_CREATE, 0666); assert(r == 0);
......
......@@ -25,6 +25,7 @@ void test_cursor_flags(int cursor_flags, int expectr) {
unlink(fname);
r = db_create(&db, null_env, 0); assert(r == 0);
db->set_errfile(db,0); // Turn off those annoying errors
r = db->open(db, null_txn, fname, "main", DB_BTREE, DB_CREATE, 0666); assert(r == 0);
DBC *cursor;
......
......@@ -25,22 +25,27 @@ int main() {
r=chdir(DIR); assert(r==0);
r = db_create(&db, null_env, 0); CKERR(r);
db->set_errfile(db,0); // Turn off those annoying errors
// r = db->set_flags(db, DB_DUP); CKERR(r);
r = db->open(db, null_txn, fname, "main", DB_BTREE, DB_CREATE, 0666); CKERR(r);
r = db->close(db, 0); CKERR(r);
r = db_create(&db, null_env, 0); CKERR(r);
db->set_errfile(db,0); // Turn off those annoying errors
r = db->open(db, null_txn, fname, "main", DB_BTREE, DB_CREATE, 0666); CKERR(r);
r = db->close(db, 0); CKERR(r);
r = db_create(&db, null_env, 0); CKERR(r);
db->set_errfile(db,0); // Turn off those annoying errors
r = db->open(db, null_txn, fname, "main", DB_BTREE, 0, 0666); CKERR(r);
r = db->close(db, 0); CKERR(r);
r = db_create(&db, null_env, 0); CKERR(r);
db->set_errfile(db,0); // Turn off those annoying errors
r = db->open(db, null_txn, fname, "main", DB_BTREE, DB_EXCL, 0666);
assert(r == EINVAL);
r = db->close(db, 0); CKERR(r);
r = db_create(&db, null_env, 0); CKERR(r);
db->set_errfile(db,0); // Turn off those annoying errors
r = db->open(db, null_txn, fname, "main", DB_BTREE, DB_CREATE | DB_EXCL, 0666);
assert(r == EEXIST);
......
......@@ -60,6 +60,7 @@ void setup(u_int32_t flags) {
mkdir(DIR, 0777);
/* Open/create primary */
r = db_create(&dbp, dbenv, 0); CKERR(r);
dbp->set_errfile(dbp,0); // Turn off those annoying errors
if (flags) {
r = dbp->set_flags(dbp, flags); CKERR(r);
}
......@@ -219,6 +220,7 @@ void setup_secondary(u_int32_t flags) {
/* Open/create primary */
r = db_create(&sdbp, dbenv, 0); CKERR(r);
sdbp->set_errfile(sdbp,0); // Turn off those annoying errors
if (flags) {
r = sdbp->set_flags(dbp, flags); CKERR(r);
}
......
......@@ -54,6 +54,7 @@ void second_setup() {
/* Open/create primary */
r = db_create(&dbp, dbenv, 0); CKERR(r);
dbp->set_errfile(dbp,0); // Turn off those annoying errors
r = dbp->open(dbp, NULL, DIR "/students.db", NULL, DB_BTREE, DB_CREATE, 0600); CKERR(r);
/*
......@@ -61,6 +62,7 @@ void second_setup() {
* items, since last names might not be unique.
*/
r = db_create(&sdbp, dbenv, 0); CKERR(r);
sdbp->set_errfile(sdbp,0); // Turn off those annoying errors
r = sdbp->set_flags(sdbp, DB_DUP | DB_DUPSORT); CKERR(r);
r = sdbp->open(sdbp, NULL, DIR "/lastname.db", NULL, DB_BTREE, DB_CREATE, 0600); CKERR(r);
......
......@@ -98,6 +98,7 @@ void test_dup_next(int n, int dup_mode, int bracket_dups) {
/* create the dup database file */
r = db_create(&db, null_env, 0); assert(r == 0);
db->set_errfile(db,0); // Turn off those annoying errors
r = db->set_flags(db, dup_mode); assert(r == 0);
r = db->set_pagesize(db, 4096); assert(r == 0);
r = db->open(db, null_txn, fname, "main", DB_BTREE, DB_CREATE, 0666); assert(r == 0);
......
......@@ -19,10 +19,12 @@ int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__u
system("rm -rf " DIR);
r=mkdir(DIR, 0777); assert(r==0);
r=db_env_create(&env, 0); assert(r==0);
env->set_errfile(env,0); // Turn off those annoying errors
r=env->close (env, 0); assert(r==0);
system("rm -rf " DIR);
r=mkdir(DIR, 0777); assert(r==0);
r=db_env_create(&env, 0); assert(r==0);
env->set_errfile(env,0); // Turn off those annoying errors
r=env->close (env, 1);
//BDB does not check this in some versions
#if defined(USE_TDB) || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3)
......@@ -34,6 +36,7 @@ int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__u
r=mkdir(DIR, 0777); assert(r==0);
r=db_env_create(&env, 0); assert(r==0);
env->set_errfile(env,0); // Turn off those annoying errors
r=env->open(env, DIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_PRIVATE|DB_CREATE, 0777); CKERR(r);
r=env->close (env, 0); assert(r==0);
......@@ -41,6 +44,7 @@ int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__u
r=mkdir(DIR, 0777); assert(r==0);
r=db_env_create(&env, 0); assert(r==0);
env->set_errfile(env,0); // Turn off those annoying errors
r=env->open(env, DIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_PRIVATE|DB_CREATE, 0777); CKERR(r);
r=env->close (env, 1);
//BDB does not check this.
......
......@@ -28,6 +28,7 @@ int main (int argc, const char *argv[]) {
{
DB_ENV *env;
r = db_env_create(&env, 0); assert(r==0);
env->set_errfile(env,0); // Turn off those annoying errors
r = env->open(env, DIR, -1, 0644);
assert(r==EINVAL);
assert(n_handle_error==0);
......@@ -42,6 +43,7 @@ int main (int argc, const char *argv[]) {
FILE *write_here = fmemopen(buf, sizeof(buf), "w");
n_handle_error=0;
r = db_env_create(&env, 0); assert(r==0);
env->set_errfile(env,0); // Turn off those annoying errors
if (do_errfile)
env->set_errfile(env, write_here);
if (do_errcall)
......
......@@ -43,6 +43,7 @@ void test_db_create() {
unlink(dbfile);
r = db_create(&db, 0, 0); assert(r == 0);
db->set_errfile(db,0); // Turn off those annoying errors
r = db->open(db, 0, dbfile, dbname, DB_BTREE, DB_CREATE, 0777); assert(r == 0);
r = db_put(db, htonl(1), 1); assert(r == 0);
r = db_get(db, htonl(1), 1, 0); assert(r == 0);
......@@ -56,6 +57,7 @@ void test_db_thread() {
unlink(dbfile);
r = db_create(&db, 0, 0); assert(r == 0);
db->set_errfile(db,0); // Turn off those annoying errors
r = db->open(db, 0, dbfile, dbname, DB_BTREE, DB_CREATE + DB_THREAD, 0777); assert(r == 0);
r = db_put(db, htonl(1), 1); assert(r == 0);
r = db_get(db, htonl(1), 1, 0); assert(r == EINVAL);
......
......@@ -54,6 +54,7 @@ void second_setup() {
/* Open/create primary */
r = db_create(&dbp, dbenv, 0); CKERR(r);
dbp->set_errfile(dbp,0); // Turn off those annoying errors
r = dbp->open(dbp, NULL, DIR "/students.db", NULL, DB_BTREE, DB_CREATE+DB_THREAD, 0600); CKERR(r);
/*
......@@ -61,6 +62,7 @@ void second_setup() {
* items, since last names might not be unique.
*/
r = db_create(&sdbp, dbenv, 0); CKERR(r);
sdbp->set_errfile(sdbp,0); // Turn off those annoying errors
r = sdbp->set_flags(sdbp, DB_DUP | DB_DUPSORT); CKERR(r);
r = sdbp->open(sdbp, NULL, DIR "/lastname.db", NULL, DB_BTREE, DB_CREATE+DB_THREAD, 0600); 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