Commit 0e4a3fe5 authored by Yoni Fogel's avatar Yoni Fogel

Modified some tests, add set_lg_dir test.

git-svn-id: file:///svn/tokudb@691 c7de825b-a66e-492c-adef-691d508d4ae1
parent 9cc8146e
......@@ -23,13 +23,7 @@ int main() {
assert(r == 0);
r = dbenv->open(dbenv, DIR, DB_INIT_MPOOL|DB_PRIVATE, 0666);
#if defined(USE_TDB)
assert(r != 0);
#elif defined(USE_BDB)
assert(r == 0);
#else
#error huh?
#endif
r = dbenv->close(dbenv, 0);
assert(r == 0);
......
......@@ -4,7 +4,7 @@
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
#define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0);
// DIR is defined in the Makefile
......@@ -32,7 +32,7 @@ int main() {
// According to the BDB man page, you may not call set_data_dir after doing the open.
// Some versions of BDB don't actually check this or complain
r = dbenv->set_data_dir(dbenv, "foo" DIR);
assert(r != 0);
assert(r == EINVAL);
#endif
r = dbenv->close(dbenv, 0);
......
......@@ -17,12 +17,12 @@ int main() {
r = db_env_create(&dbenv, 0);
assert(r == 0);
dbenv->set_errpfx(dbenv, "houdy partners: ");
dbenv->set_errpfx(dbenv, "houdy partners");
r = dbenv->open(dbenv, DIR, DB_CREATE|DB_PRIVATE|DB_INIT_MPOOL, 0);
assert(r == 0);
dbenv->set_errpfx(dbenv, "houdy partners: ");
dbenv->set_errpfx(dbenv, "houdy partners");
r = dbenv->close(dbenv, 0);
assert(r == 0);
......
#include <stdio.h>
#include <assert.h>
#include <db.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
#define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0);
// DIR is defined in the Makefile
int main() {
DB_ENV *dbenv;
int r;
system("rm -rf " DIR);
mkdir(DIR, 0777);
r = db_env_create(&dbenv, 0);
assert(r == 0);
r = dbenv->set_lg_dir(dbenv, ".");
assert(r == 0);
r = dbenv->set_lg_dir(dbenv, ".");
assert(r == 0);
r = dbenv->open(dbenv, DIR, DB_INIT_LOG|DB_CREATE|DB_PRIVATE|DB_INIT_MPOOL, 0);
CKERR(r);
#ifdef USE_TDB
// According to the BDB man page, you may not call set_lg_dir after doing the open.
// Some versions of BDB don't actually check this or complain
r = dbenv->set_lg_dir(dbenv, ".");
assert(r == EINVAL);
#endif
r = dbenv->close(dbenv, 0);
assert(r == 0);
return 0;
}
#include <stdio.h>
#include <assert.h>
#include <db.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
#define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0);
// DIR is defined in the Makefile
int main() {
DB_ENV *dbenv;
int r;
system("rm -rf " DIR);
mkdir(DIR, 0777);
r = db_env_create(&dbenv, 0);
assert(r == 0);
r = dbenv->set_tmp_dir(dbenv, ".");
// assert(r == 0);
assert(r == 0);
r = dbenv->set_tmp_dir(dbenv, ".");
assert(r == 0);
r = dbenv->open(dbenv, DIR, DB_CREATE|DB_PRIVATE|DB_INIT_MPOOL, 0);
CKERR(r);
#ifdef USE_TDB
// According to the BDB man page, you may not call set_tmp_dir after doing the open.
// Some versions of BDB don't actually check this or complain
r = dbenv->set_tmp_dir(dbenv, ".");
// assert(r == 0);
assert(r == EINVAL);
#endif
r = dbenv->close(dbenv, 0);
assert(r == 0);
......
......@@ -14,6 +14,9 @@ int main (int argc, char *argv[]) {
// BDB doesnt' actually barf on this case.
#ifdef USE_TDB
assert(r != 0);
#else
r = db->close(db, 0);
assert(r == 0);
#endif
r = env->close(env, 0);
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