Commit 12c2cc73 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

change DIR to ENVDIR in src/tests. Fixes #492.

git-svn-id: file:///svn/tokudb@2643 c7de825b-a66e-492c-adef-691d508d4ae1
parent 9f28cd26
...@@ -165,9 +165,9 @@ libs: ...@@ -165,9 +165,9 @@ libs:
cd ..;make cd ..;make
%.bdb: %.c %.bdb: %.c
$(UNSETTOKUENV) cc -DDIR=\"dir.$<.bdb\" $(BDB_CPPFLAGS) -DUSE_BDB -DIS_TDB=0 $(CFLAGS) $< $(BDB_LDFLAGS) -ldb -o $@ $(UNSETTOKUENV) cc -DENVDIR=\"dir.$<.bdb\" $(BDB_CPPFLAGS) -DUSE_BDB -DIS_TDB=0 $(CFLAGS) $< $(BDB_LDFLAGS) -ldb -o $@
%.tdb: %.c %.tdb: %.c
$(SETTOKUENV) cc -DDIR=\"dir.$<.tdb\" -DUSE_TDB -DIS_TDB=1 $(CFLAGS) $(TDB_CPPFLAGS) $(TDB_LOADLIBES) $< -o $@ $(SETTOKUENV) cc -DENVDIR=\"dir.$<.tdb\" -DUSE_TDB -DIS_TDB=1 $(CFLAGS) $(TDB_CPPFLAGS) $(TDB_LOADLIBES) $< -o $@
.PHONY: %.recover .PHONY: %.recover
all.recover: test_log2.recover test_log3.recover test_log4.recover test_log5.recover all.recover: test_log2.recover test_log3.recover test_log4.recover test_log5.recover
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
#define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0); #define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0);
...@@ -20,10 +20,10 @@ void test_db_open_aborts (void) { ...@@ -20,10 +20,10 @@ void test_db_open_aborts (void) {
DB *db; DB *db;
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
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->open(env, ENVDIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_PRIVATE|DB_CREATE, 0777); CKERR(r);
r=db_create(&db, env, 0); CKERR(r); r=db_create(&db, env, 0); CKERR(r);
{ {
...@@ -45,7 +45,7 @@ void test_db_open_aborts (void) { ...@@ -45,7 +45,7 @@ void test_db_open_aborts (void) {
} }
{ {
struct stat buf; struct stat buf;
r=stat(DIR "/foo.db", &buf); r=stat(ENVDIR "/foo.db", &buf);
assert(r!=0); assert(r!=0);
assert(errno==ENOENT); assert(errno==ENOENT);
} }
...@@ -60,10 +60,10 @@ void test_db_put_aborts (void) { ...@@ -60,10 +60,10 @@ void test_db_put_aborts (void) {
DB *db; DB *db;
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
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->open(env, ENVDIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_PRIVATE|DB_CREATE, 0777); CKERR(r);
r=db_create(&db, env, 0); CKERR(r); r=db_create(&db, env, 0); CKERR(r);
{ {
...@@ -105,7 +105,7 @@ void test_db_put_aborts (void) { ...@@ -105,7 +105,7 @@ void test_db_put_aborts (void) {
// The database should exist // The database should exist
{ {
struct stat buf; struct stat buf;
r=stat(DIR "/foo.db", &buf); r=stat(ENVDIR "/foo.db", &buf);
assert(r==0); assert(r==0);
} }
// But the item should not be in it. // But the item should not be in it.
......
...@@ -26,7 +26,7 @@ void test_cursor_current() { ...@@ -26,7 +26,7 @@ void test_cursor_current() {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test.cursor.current.brt"; const char * const fname = ENVDIR "/" "test.cursor.current.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -100,7 +100,7 @@ void test_reopen() { ...@@ -100,7 +100,7 @@ void test_reopen() {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test.cursor.current.brt"; const char * const fname = ENVDIR "/" "test.cursor.current.brt";
int r; int r;
r = db_create(&db, null_env, 0); assert(r == 0); r = db_create(&db, null_env, 0); assert(r == 0);
...@@ -115,8 +115,8 @@ void test_reopen() { ...@@ -115,8 +115,8 @@ void test_reopen() {
int main(int argc, const char *argv[]) { int main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
test_cursor_current(); test_cursor_current();
test_reopen(); test_reopen();
......
...@@ -51,7 +51,7 @@ void test_cursor_delete(int dup_mode) { ...@@ -51,7 +51,7 @@ void test_cursor_delete(int dup_mode) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test.cursor.delete.brt"; const char * const fname = ENVDIR "/" "test.cursor.delete.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -98,7 +98,7 @@ void test_cursor_delete_dupsort() { ...@@ -98,7 +98,7 @@ void test_cursor_delete_dupsort() {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test.cursor.delete.brt"; const char * const fname = ENVDIR "/" "test.cursor.delete.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -149,8 +149,8 @@ int main(int argc, const char *argv[]) { ...@@ -149,8 +149,8 @@ int main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
test_cursor_delete(0); test_cursor_delete(0);
#if USE_BDB #if USE_BDB
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "test.h" #include "test.h"
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
DB *db; DB *db;
...@@ -22,11 +22,11 @@ DB_TXN *const null_txn = 0; ...@@ -22,11 +22,11 @@ DB_TXN *const null_txn = 0;
void setup_db(char* name) { void setup_db(char* name) {
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
r = db_env_create(&env, 0); CKERR(r); r = db_env_create(&env, 0); CKERR(r);
r = env->open(env, DIR, DB_CREATE | DB_PRIVATE | DB_INIT_MPOOL, 0666); CKERR(r); r = env->open(env, ENVDIR, DB_CREATE | DB_PRIVATE | DB_INIT_MPOOL, 0666); CKERR(r);
r = db_create(&db, env, 0); CKERR(r); r = db_create(&db, env, 0); CKERR(r);
r = db->set_flags(db, DB_DUP | DB_DUPSORT); CKERR(r); r = db->set_flags(db, DB_DUP | DB_DUPSORT); CKERR(r);
r = db->set_pagesize(db, 4096); CKERR(r); r = db->set_pagesize(db, 4096); CKERR(r);
......
...@@ -19,7 +19,7 @@ void test_cursor_flags(int cursor_flags, int expectr) { ...@@ -19,7 +19,7 @@ void test_cursor_flags(int cursor_flags, int expectr) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test.cursor.delete.brt"; const char * const fname = ENVDIR "/" "test.cursor.delete.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -43,8 +43,8 @@ int main(int argc, const char *argv[]) { ...@@ -43,8 +43,8 @@ int main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
test_cursor_flags(0, 0); test_cursor_flags(0, 0);
test_cursor_flags(~0, EINVAL); test_cursor_flags(~0, EINVAL);
......
...@@ -51,7 +51,7 @@ void test_cursor_nonleaf_expand(int n, int reverse) { ...@@ -51,7 +51,7 @@ void test_cursor_nonleaf_expand(int n, int reverse) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test.insert.brt"; const char * const fname = ENVDIR "/" "test.insert.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -89,8 +89,8 @@ void test_cursor_nonleaf_expand(int n, int reverse) { ...@@ -89,8 +89,8 @@ void test_cursor_nonleaf_expand(int n, int reverse) {
int main(int argc, const char *argv[]) { int main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
int r=mkdir(DIR, 0777); assert(r==0); int r=mkdir(ENVDIR, 0777); assert(r==0);
int i; int i;
for (i=1; i<=65536; i *= 2) { for (i=1; i<=65536; i *= 2) {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "test.h" #include "test.h"
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
int dbtcmp(DBT *dbt1, DBT *dbt2) { int dbtcmp(DBT *dbt1, DBT *dbt2) {
int r; int r;
...@@ -111,8 +111,8 @@ void close_dbc(char name) { ...@@ -111,8 +111,8 @@ void close_dbc(char name) {
void setup_dbs(u_int32_t dup_flags) { void setup_dbs(u_int32_t dup_flags) {
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
dbenv = NULL; dbenv = NULL;
db = NULL; db = NULL;
/* Open/create primary */ /* Open/create primary */
...@@ -120,7 +120,7 @@ void setup_dbs(u_int32_t dup_flags) { ...@@ -120,7 +120,7 @@ void setup_dbs(u_int32_t dup_flags) {
CKERR(r); CKERR(r);
u_int32_t env_txn_flags = 0; u_int32_t env_txn_flags = 0;
u_int32_t env_open_flags = DB_CREATE | DB_PRIVATE | DB_INIT_MPOOL; u_int32_t env_open_flags = DB_CREATE | DB_PRIVATE | DB_INIT_MPOOL;
r = dbenv->open(dbenv, DIR, env_open_flags | env_txn_flags, 0600); r = dbenv->open(dbenv, ENVDIR, env_open_flags | env_txn_flags, 0600);
CKERR(r); CKERR(r);
r = db_create(&db, dbenv, 0); r = db_create(&db, dbenv, 0);
......
...@@ -112,7 +112,7 @@ void test_cursor_sticky(int n, int dup_mode) { ...@@ -112,7 +112,7 @@ void test_cursor_sticky(int n, int dup_mode) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_cursor_sticky.brt"; const char * const fname = ENVDIR "/" "test_cursor_sticky.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -152,8 +152,8 @@ int main(int argc, const char *argv[]) { ...@@ -152,8 +152,8 @@ int main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
for (i=1; i<65537; i *= 2) { for (i=1; i<65537; i *= 2) {
test_cursor_sticky(i, 0); test_cursor_sticky(i, 0);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include <db.h> #include <db.h>
#include <errno.h> #include <errno.h>
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
#define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0); #define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0);
...@@ -20,9 +20,9 @@ int main() { ...@@ -20,9 +20,9 @@ int main() {
const char * const fname = "test.already.exists.brt"; const char * const fname = "test.already.exists.brt";
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
r=chdir(DIR); assert(r==0); r=chdir(ENVDIR); assert(r==0);
r = db_create(&db, null_env, 0); CKERR(r); r = db_create(&db, null_env, 0); CKERR(r);
db->set_errfile(db,0); // Turn off those annoying errors db->set_errfile(db,0); // Turn off those annoying errors
......
...@@ -200,7 +200,7 @@ void create_databases (void) { ...@@ -200,7 +200,7 @@ void create_databases (void) {
int r; int r;
r = db_env_create(&dbenv, 0); CKERR(r); r = db_env_create(&dbenv, 0); CKERR(r);
r = dbenv->open(dbenv, DIR, DB_PRIVATE|DB_INIT_MPOOL|DB_CREATE, 0); CKERR(r); r = dbenv->open(dbenv, ENVDIR, DB_PRIVATE|DB_INIT_MPOOL|DB_CREATE, 0); CKERR(r);
r = db_create(&dbp, dbenv, 0); CKERR(r); r = db_create(&dbp, dbenv, 0); CKERR(r);
r = dbp->open(dbp, null_txn, "primary.db", NULL, DB_BTREE, DB_CREATE, 0600); CKERR(r); r = dbp->open(dbp, null_txn, "primary.db", NULL, DB_BTREE, DB_CREATE, 0600); CKERR(r);
...@@ -254,11 +254,11 @@ void setup_for_db_create (void) { ...@@ -254,11 +254,11 @@ void setup_for_db_create (void) {
// Remove name.db and then rebuild it with associate(... DB_CREATE) // Remove name.db and then rebuild it with associate(... DB_CREATE)
int r=unlink(DIR "/name.db"); int r=unlink(ENVDIR "/name.db");
assert(r==0); assert(r==0);
r = db_env_create(&dbenv, 0); CKERR(r); r = db_env_create(&dbenv, 0); CKERR(r);
r = dbenv->open(dbenv, DIR, DB_PRIVATE|DB_INIT_MPOOL, 0); CKERR(r); r = dbenv->open(dbenv, ENVDIR, DB_PRIVATE|DB_INIT_MPOOL, 0); CKERR(r);
r = db_create(&dbp, dbenv, 0); CKERR(r); r = db_create(&dbp, dbenv, 0); CKERR(r);
r = dbp->open(dbp, null_txn, "primary.db", NULL, DB_BTREE, 0, 0600); CKERR(r); r = dbp->open(dbp, null_txn, "primary.db", NULL, DB_BTREE, 0, 0600); CKERR(r);
...@@ -527,8 +527,8 @@ int main (int argc, const char *argv[]) { ...@@ -527,8 +527,8 @@ int main (int argc, const char *argv[]) {
switch (mode) { switch (mode) {
case MODE_DEFAULT: case MODE_DEFAULT:
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
create_databases(); create_databases();
{ {
int i; int i;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <db.h> #include <db.h>
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
#define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0); #define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0);
...@@ -17,10 +17,10 @@ DB *db; ...@@ -17,10 +17,10 @@ DB *db;
int main (int argc, char *argv[]) { int main (int argc, char *argv[]) {
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
r=env->open(env, DIR, DB_PRIVATE|DB_CREATE, 0777); assert(r==0); r=env->open(env, ENVDIR, DB_PRIVATE|DB_CREATE, 0777); assert(r==0);
r=db_create(&db, env, 0); assert(r==0); r=db_create(&db, env, 0); assert(r==0);
r=db->close(db, 0); assert(r==0); r=db->close(db, 0); assert(r==0);
r=env->close(env, 0); assert(r==0); r=env->close(env, 0); assert(r==0);
......
...@@ -187,7 +187,7 @@ void create_databases (void) { ...@@ -187,7 +187,7 @@ void create_databases (void) {
int r; int r;
r = db_env_create(&dbenv, 0); CKERR(r); r = db_env_create(&dbenv, 0); CKERR(r);
r = dbenv->open(dbenv, DIR, DB_PRIVATE|DB_INIT_MPOOL|DB_CREATE, 0); CKERR(r); r = dbenv->open(dbenv, ENVDIR, DB_PRIVATE|DB_INIT_MPOOL|DB_CREATE, 0); CKERR(r);
r = db_create(&dbp, dbenv, 0); CKERR(r); r = db_create(&dbp, dbenv, 0); CKERR(r);
r = dbp->open(dbp, null_txn, "primary.db", NULL, DB_BTREE, DB_CREATE, 0600); CKERR(r); r = dbp->open(dbp, null_txn, "primary.db", NULL, DB_BTREE, DB_CREATE, 0600); CKERR(r);
...@@ -229,11 +229,11 @@ void setup_for_db_create (void) { ...@@ -229,11 +229,11 @@ void setup_for_db_create (void) {
// Remove name.db and then rebuild it with associate(... DB_CREATE) // Remove name.db and then rebuild it with associate(... DB_CREATE)
int r=unlink(DIR "/name.db"); int r=unlink(ENVDIR "/name.db");
assert(r==0); assert(r==0);
r = db_env_create(&dbenv, 0); CKERR(r); r = db_env_create(&dbenv, 0); CKERR(r);
r = dbenv->open(dbenv, DIR, DB_PRIVATE|DB_INIT_MPOOL, 0); CKERR(r); r = dbenv->open(dbenv, ENVDIR, DB_PRIVATE|DB_INIT_MPOOL, 0); CKERR(r);
r = db_create(&dbp, dbenv, 0); CKERR(r); r = db_create(&dbp, dbenv, 0); CKERR(r);
r = dbp->open(dbp, null_txn, "primary.db", NULL, DB_BTREE, 0, 0600); CKERR(r); r = dbp->open(dbp, null_txn, "primary.db", NULL, DB_BTREE, 0, 0600); CKERR(r);
...@@ -507,8 +507,8 @@ int main (int argc, const char *argv[]) { ...@@ -507,8 +507,8 @@ int main (int argc, const char *argv[]) {
switch (mode) { switch (mode) {
case MODE_DEFAULT: case MODE_DEFAULT:
oppass=1; oppass=1;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
create_databases(); create_databases();
{ {
int i; int i;
......
...@@ -156,7 +156,7 @@ static void create_databases (void) { ...@@ -156,7 +156,7 @@ static void create_databases (void) {
int r; int r;
r = db_env_create(&dbenv, 0); CKERR(r); r = db_env_create(&dbenv, 0); CKERR(r);
r = dbenv->open(dbenv, DIR, DB_PRIVATE|DB_INIT_MPOOL|DB_CREATE, 0); CKERR(r); r = dbenv->open(dbenv, ENVDIR, DB_PRIVATE|DB_INIT_MPOOL|DB_CREATE, 0); CKERR(r);
r = db_create(&dbp, dbenv, 0); CKERR(r); r = db_create(&dbp, dbenv, 0); CKERR(r);
r = dbp->open(dbp, null_txn, "primary.db", NULL, DB_BTREE, DB_CREATE, 0600); CKERR(r); r = dbp->open(dbp, null_txn, "primary.db", NULL, DB_BTREE, DB_CREATE, 0600); CKERR(r);
...@@ -343,8 +343,8 @@ int main (int argc, const char *argv[]) { ...@@ -343,8 +343,8 @@ int main (int argc, const char *argv[]) {
switch (mode) { switch (mode) {
case MODE_DEFAULT: case MODE_DEFAULT:
opnum=0; opnum=0;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
create_databases(); create_databases();
{ {
int i; int i;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "test.h" #include "test.h"
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
typedef struct { typedef struct {
int32_t pkey; int32_t pkey;
...@@ -81,13 +81,13 @@ void second_setup() { ...@@ -81,13 +81,13 @@ void second_setup() {
#ifndef USE_TDB #ifndef USE_TDB
r = db->set_alloc(db, my_malloc, my_realloc, my_free); CKERR(r); r = db->set_alloc(db, my_malloc, my_realloc, my_free); CKERR(r);
#endif #endif
r = db->open(db, null_txn, DIR "/primary.db", NULL, DB_BTREE, DB_CREATE, 0600); CKERR(r); r = db->open(db, null_txn, ENVDIR "/primary.db", NULL, DB_BTREE, DB_CREATE, 0600); CKERR(r);
r = db_create(&sdb, dbenv, 0); CKERR(r); r = db_create(&sdb, dbenv, 0); CKERR(r);
#ifndef USE_TDB #ifndef USE_TDB
r = sdb->set_alloc(sdb, my_malloc, my_realloc, my_free); CKERR(r); r = sdb->set_alloc(sdb, my_malloc, my_realloc, my_free); CKERR(r);
#endif #endif
r = sdb->open(sdb, null_txn, DIR "/second.db", NULL, DB_BTREE, DB_CREATE, 0600); CKERR(r); r = sdb->open(sdb, null_txn, ENVDIR "/second.db", NULL, DB_BTREE, DB_CREATE, 0600); CKERR(r);
/* Associate the secondary with the primary. */ /* Associate the secondary with the primary. */
r = db->associate(db, null_txn, sdb, getskey, 0); CKERR(r); r = db->associate(db, null_txn, sdb, getskey, 0); CKERR(r);
...@@ -132,8 +132,8 @@ int main(int argc, const char *argv[]) { ...@@ -132,8 +132,8 @@ int main(int argc, const char *argv[]) {
int i; int i;
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
second_setup(); second_setup();
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
callback_set_malloc = i & 0x1; callback_set_malloc = i & 0x1;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "test.h" #include "test.h"
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
typedef struct { typedef struct {
int32_t pkey; int32_t pkey;
...@@ -76,15 +76,15 @@ int getskey(DB *secondary, const DBT *pkey, const DBT *pdata, DBT *skey) ...@@ -76,15 +76,15 @@ int getskey(DB *secondary, const DBT *pkey, const DBT *pdata, DBT *skey)
void second_setup(u_int32_t dupflags) { void second_setup(u_int32_t dupflags) {
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
dbenv = 0; dbenv = 0;
/* Open/create primary */ /* Open/create primary */
r = db_create(&db, dbenv, 0); CKERR(r); r = db_create(&db, dbenv, 0); CKERR(r);
#ifndef USE_TDB #ifndef USE_TDB
r = db->set_alloc(db, my_malloc, my_realloc, my_free); CKERR(r); r = db->set_alloc(db, my_malloc, my_realloc, my_free); CKERR(r);
#endif #endif
r = db->open(db, null_txn, DIR "/primary.db", NULL, DB_BTREE, DB_CREATE, 0600); CKERR(r); r = db->open(db, null_txn, ENVDIR "/primary.db", NULL, DB_BTREE, DB_CREATE, 0600); CKERR(r);
r = db_create(&sdb, dbenv, 0); CKERR(r); r = db_create(&sdb, dbenv, 0); CKERR(r);
#ifndef USE_TDB #ifndef USE_TDB
...@@ -93,7 +93,7 @@ void second_setup(u_int32_t dupflags) { ...@@ -93,7 +93,7 @@ void second_setup(u_int32_t dupflags) {
if (dupflags) { if (dupflags) {
r = sdb->set_flags(sdb, dupflags); CKERR(r); r = sdb->set_flags(sdb, dupflags); CKERR(r);
} }
r = sdb->open(sdb, null_txn, DIR "/second.db", NULL, DB_BTREE, DB_CREATE, 0600); CKERR(r); r = sdb->open(sdb, null_txn, ENVDIR "/second.db", NULL, DB_BTREE, DB_CREATE, 0600); CKERR(r);
/* Associate the secondary with the primary. */ /* Associate the secondary with the primary. */
r = db->associate(db, null_txn, sdb, getskey, 0); CKERR(r); r = db->associate(db, null_txn, sdb, getskey, 0); CKERR(r);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "test.h" #include "test.h"
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
typedef struct { typedef struct {
int32_t pkey; int32_t pkey;
...@@ -25,12 +25,12 @@ int32_t key_1 = 1; ...@@ -25,12 +25,12 @@ int32_t key_1 = 1;
void setup(void) { void setup(void) {
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
dbenv = 0; dbenv = 0;
/* Open/create primary */ /* Open/create primary */
r = db_create(&db, dbenv, 0); CKERR(r); r = db_create(&db, dbenv, 0); CKERR(r);
r = db->open(db, null_txn, DIR "/primary.db", NULL, DB_BTREE, DB_CREATE, 0600); CKERR(r); r = db->open(db, null_txn, ENVDIR "/primary.db", NULL, DB_BTREE, DB_CREATE, 0600); CKERR(r);
} }
void insert_test(void) { void insert_test(void) {
......
...@@ -39,11 +39,11 @@ void test_db_delete(int n, int dup_mode) { ...@@ -39,11 +39,11 @@ void test_db_delete(int n, int dup_mode) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test.db.delete.brt"; const char * const fname = ENVDIR "/" "test.db.delete.brt";
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
/* create the dup database file */ /* create the dup database file */
r = db_create(&db, null_env, 0); r = db_create(&db, null_env, 0);
...@@ -104,11 +104,11 @@ void test_db_get_datasize0() { ...@@ -104,11 +104,11 @@ void test_db_get_datasize0() {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test.db_delete.brt"; const char * const fname = ENVDIR "/" "test.db_delete.brt";
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
/* create the dup database file */ /* create the dup database file */
r = db_create(&db, null_env, 0); r = db_create(&db, null_env, 0);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "test.h" #include "test.h"
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
typedef struct { typedef struct {
int32_t pkey; int32_t pkey;
...@@ -74,10 +74,10 @@ void second_setup() { ...@@ -74,10 +74,10 @@ void second_setup() {
/* Open/create primary */ /* Open/create primary */
r = db_create(&db, dbenv, 0); CKERR(r); r = db_create(&db, dbenv, 0); CKERR(r);
r = db->open(db, null_txn, DIR "/primary.db", NULL, DB_BTREE, DB_CREATE, 0600); CKERR(r); r = db->open(db, null_txn, ENVDIR "/primary.db", NULL, DB_BTREE, DB_CREATE, 0600); CKERR(r);
r = db_create(&sdb, dbenv, 0); CKERR(r); r = db_create(&sdb, dbenv, 0); CKERR(r);
r = sdb->open(sdb, null_txn, DIR "/secondary.db", NULL, DB_BTREE, DB_CREATE, 0600); CKERR(r); r = sdb->open(sdb, null_txn, ENVDIR "/secondary.db", NULL, DB_BTREE, DB_CREATE, 0600); CKERR(r);
/* Associate the secondary with the primary. */ /* Associate the secondary with the primary. */
r = db->associate(db, null_txn, sdb, getskey, 0); CKERR(r); r = db->associate(db, null_txn, sdb, getskey, 0); CKERR(r);
...@@ -123,8 +123,8 @@ int main(int argc, const char *argv[]) { ...@@ -123,8 +123,8 @@ int main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
for (i = 0; i < (1<<3); i++) { for (i = 0; i < (1<<3); i++) {
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
second_setup(); second_setup();
check_secondary(DB_NOTFOUND); check_secondary(DB_NOTFOUND);
......
...@@ -18,7 +18,7 @@ do { ...@@ -18,7 +18,7 @@ do {
if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0); \ if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0); \
} while (0) } while (0)
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
#define DB_HOME "DB_HOME" #define DB_HOME "DB_HOME"
#define DBNAME "test.db" #define DBNAME "test.db"
...@@ -35,9 +35,9 @@ void reinit_config(int set_home, int set_DB_ENVIRON, int set_DB_HOME) { ...@@ -35,9 +35,9 @@ void reinit_config(int set_home, int set_DB_ENVIRON, int set_DB_HOME) {
//Return to base dir //Return to base dir
r = fchdir(rootfd); assert(r == 0); r = fchdir(rootfd); assert(r == 0);
r = system("rm -rf " DIR); assert(r == 0); r = system("rm -rf " ENVDIR); assert(r == 0);
r = mkdir(DIR, 0777); assert(r == 0); r = mkdir(ENVDIR, 0777); assert(r == 0);
r = chdir(DIR); assert(r == 0); r = chdir(ENVDIR); assert(r == 0);
unsetenv(DB_HOME); unsetenv(DB_HOME);
if (set_home) { if (set_home) {
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <unistd.h> #include <unistd.h>
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
#define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0); #define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0);
int main() { int main() {
...@@ -32,18 +32,18 @@ int main() { ...@@ -32,18 +32,18 @@ int main() {
#endif #endif
int private_flags = do_private ? DB_PRIVATE : 0; int private_flags = do_private ? DB_PRIVATE : 0;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r = db_env_create(&dbenv, 0); r = db_env_create(&dbenv, 0);
CKERR(r); CKERR(r);
r = dbenv->open(dbenv, DIR, private_flags|DB_INIT_MPOOL, 0); r = dbenv->open(dbenv, ENVDIR, private_flags|DB_INIT_MPOOL, 0);
assert(r==ENOENT); assert(r==ENOENT);
dbenv->close(dbenv,0); // free memory dbenv->close(dbenv,0); // free memory
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
r = db_env_create(&dbenv, 0); r = db_env_create(&dbenv, 0);
CKERR(r); CKERR(r);
r = dbenv->open(dbenv, DIR, private_flags|DB_INIT_MPOOL, 0); r = dbenv->open(dbenv, ENVDIR, private_flags|DB_INIT_MPOOL, 0);
#ifdef USE_TDB #ifdef USE_TDB
// TokuDB has no trouble opening an environment if the directory exists. // TokuDB has no trouble opening an environment if the directory exists.
CKERR(r); CKERR(r);
...@@ -58,18 +58,18 @@ int main() { ...@@ -58,18 +58,18 @@ int main() {
#ifndef USE_TDB #ifndef USE_TDB
// Now make sure that if we have a non-private DB that we can tell if it opened or not. // Now make sure that if we have a non-private DB that we can tell if it opened or not.
DB *db; DB *db;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
r = db_env_create(&dbenv, 0); r = db_env_create(&dbenv, 0);
CKERR(r); CKERR(r);
r = dbenv->open(dbenv, DIR, DB_CREATE|DB_INIT_MPOOL, 0); r = dbenv->open(dbenv, ENVDIR, DB_CREATE|DB_INIT_MPOOL, 0);
CKERR(r); CKERR(r);
r=db_create(&db, dbenv, 0); r=db_create(&db, dbenv, 0);
CKERR(r); CKERR(r);
dbenv->close(dbenv,0); // free memory dbenv->close(dbenv,0); // free memory
r = db_env_create(&dbenv, 0); r = db_env_create(&dbenv, 0);
CKERR(r); CKERR(r);
r = dbenv->open(dbenv, DIR, DB_INIT_MPOOL, 0); r = dbenv->open(dbenv, ENVDIR, DB_INIT_MPOOL, 0);
CKERR(r); CKERR(r);
dbenv->close(dbenv,0); // free memory dbenv->close(dbenv,0); // free memory
#endif #endif
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <string.h> #include <string.h>
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
#define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0); #define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0);
...@@ -19,16 +19,16 @@ int main(int argc, char** argv) { ...@@ -19,16 +19,16 @@ int main(int argc, char** argv) {
int verbose = 0; int verbose = 0;
if (argc == 2 && !strcmp(argv[1], "-v")) verbose = 1; if (argc == 2 && !strcmp(argv[1], "-v")) verbose = 1;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
r = db_env_create(&dbenv, 0); r = db_env_create(&dbenv, 0);
assert(r == 0); assert(r == 0);
r = dbenv->open(dbenv, DIR, DB_CREATE|DB_INIT_MPOOL|DB_PRIVATE, 0666); r = dbenv->open(dbenv, ENVDIR, DB_CREATE|DB_INIT_MPOOL|DB_PRIVATE, 0666);
assert(r == 0); assert(r == 0);
r = dbenv->open(dbenv, DIR, DB_CREATE|DB_INIT_MPOOL|DB_PRIVATE, 0666); r = dbenv->open(dbenv, ENVDIR, DB_CREATE|DB_INIT_MPOOL|DB_PRIVATE, 0666);
#ifdef USE_TDB #ifdef USE_TDB
assert(r != 0); assert(r != 0);
#else #else
......
...@@ -10,20 +10,20 @@ ...@@ -10,20 +10,20 @@
#include <errno.h> #include <errno.h>
#include "test.h" #include "test.h"
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
int main() { int main() {
DB_ENV *dbenv; DB_ENV *dbenv;
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
r = db_env_create(&dbenv, 0); assert(r == 0); r = db_env_create(&dbenv, 0); assert(r == 0);
r = dbenv->set_data_dir(dbenv, DIR); assert(r == 0); r = dbenv->set_data_dir(dbenv, ENVDIR); assert(r == 0);
r = dbenv->set_data_dir(dbenv, DIR); assert(r == 0); r = dbenv->set_data_dir(dbenv, ENVDIR); assert(r == 0);
r = dbenv->open(dbenv, 0, DB_CREATE|DB_PRIVATE|DB_INIT_MPOOL, 0); r = dbenv->open(dbenv, 0, DB_CREATE|DB_PRIVATE|DB_INIT_MPOOL, 0);
CKERR(r); CKERR(r);
...@@ -31,7 +31,7 @@ int main() { ...@@ -31,7 +31,7 @@ int main() {
#ifdef USE_TDB #ifdef USE_TDB
// According to the BDB man page, you may not call set_data_dir after doing the open. // 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 // Some versions of BDB don't actually check this or complain
r = dbenv->set_data_dir(dbenv, "foo" DIR); r = dbenv->set_data_dir(dbenv, "foo" ENVDIR);
assert(r == EINVAL); assert(r == EINVAL);
#endif #endif
......
...@@ -8,21 +8,21 @@ ...@@ -8,21 +8,21 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
int main() { int main() {
DB_ENV *dbenv; DB_ENV *dbenv;
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
r = db_env_create(&dbenv, 0); r = db_env_create(&dbenv, 0);
assert(r == 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); r = dbenv->open(dbenv, ENVDIR, DB_CREATE|DB_PRIVATE|DB_INIT_MPOOL, 0);
assert(r == 0); assert(r == 0);
dbenv->set_errpfx(dbenv, "houdy partners"); dbenv->set_errpfx(dbenv, "houdy partners");
......
...@@ -11,14 +11,14 @@ ...@@ -11,14 +11,14 @@
#define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0); #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 // ENVDIR is defined in the Makefile
int main() { int main() {
DB_ENV *dbenv; DB_ENV *dbenv;
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
r = db_env_create(&dbenv, 0); r = db_env_create(&dbenv, 0);
assert(r == 0); assert(r == 0);
...@@ -29,7 +29,7 @@ int main() { ...@@ -29,7 +29,7 @@ int main() {
r = dbenv->set_lg_dir(dbenv, "."); r = dbenv->set_lg_dir(dbenv, ".");
assert(r == 0); assert(r == 0);
r = dbenv->open(dbenv, DIR, DB_INIT_LOG|DB_CREATE|DB_PRIVATE|DB_INIT_MPOOL, 0); r = dbenv->open(dbenv, ENVDIR, DB_INIT_LOG|DB_CREATE|DB_PRIVATE|DB_INIT_MPOOL, 0);
CKERR(r); CKERR(r);
#ifdef USE_TDB #ifdef USE_TDB
......
...@@ -11,14 +11,14 @@ ...@@ -11,14 +11,14 @@
#define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0); #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 // ENVDIR is defined in the Makefile
int main() { int main() {
DB_ENV *dbenv; DB_ENV *dbenv;
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
r = db_env_create(&dbenv, 0); r = db_env_create(&dbenv, 0);
assert(r == 0); assert(r == 0);
...@@ -29,7 +29,7 @@ int main() { ...@@ -29,7 +29,7 @@ int main() {
r = dbenv->set_tmp_dir(dbenv, "."); r = dbenv->set_tmp_dir(dbenv, ".");
assert(r == 0); assert(r == 0);
r = dbenv->open(dbenv, DIR, DB_CREATE|DB_PRIVATE|DB_INIT_MPOOL, 0); r = dbenv->open(dbenv, ENVDIR, DB_CREATE|DB_PRIVATE|DB_INIT_MPOOL, 0);
CKERR(r); CKERR(r);
#ifdef USE_TDB #ifdef USE_TDB
......
...@@ -8,20 +8,20 @@ ...@@ -8,20 +8,20 @@
#include <errno.h> #include <errno.h>
#include <db.h> #include <db.h>
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
DB_ENV *env; DB_ENV *env;
DB *db; DB *db;
int main (int argc, char *argv[]) { int main (int argc, char *argv[]) {
int r; int r;
r=system("rm -rf " DIR); assert(r==0); r=system("rm -rf " ENVDIR); assert(r==0);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
// None of this stuff works with BDB. TDB does more error checking. // None of this stuff works with BDB. TDB does more error checking.
#ifdef USE_TDB #ifdef USE_TDB
r=env->set_data_dir(env, NULL); assert(r==EINVAL); r=env->set_data_dir(env, NULL); assert(r==EINVAL);
r=env->open(env, DIR, DB_PRIVATE, 0777); assert(r==0); r=env->open(env, ENVDIR, DB_PRIVATE, 0777); assert(r==0);
env->set_errpfx(env, NULL); assert(1); //Did not crash. env->set_errpfx(env, NULL); assert(1); //Did not crash.
r=env->set_tmp_dir(env, NULL); assert(r==EINVAL); r=env->set_tmp_dir(env, NULL); assert(r==EINVAL);
#endif #endif
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "test.h" #include "test.h"
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
typedef struct { typedef struct {
u_int32_t db_flags; u_int32_t db_flags;
...@@ -56,15 +56,15 @@ DB_ENV *dbenv; ...@@ -56,15 +56,15 @@ DB_ENV *dbenv;
void setup(u_int32_t flags) { void setup(u_int32_t flags) {
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
/* Open/create primary */ /* Open/create primary */
r = db_create(&dbp, dbenv, 0); CKERR(r); r = db_create(&dbp, dbenv, 0); CKERR(r);
dbp->set_errfile(dbp,0); // Turn off those annoying errors dbp->set_errfile(dbp,0); // Turn off those annoying errors
if (flags) { if (flags) {
r = dbp->set_flags(dbp, flags); CKERR(r); r = dbp->set_flags(dbp, flags); CKERR(r);
} }
r = dbp->open(dbp, NULL, DIR "/primary.db", NULL, DB_BTREE, DB_CREATE, 0600); CKERR(r); r = dbp->open(dbp, NULL, ENVDIR "/primary.db", NULL, DB_BTREE, DB_CREATE, 0600); CKERR(r);
} }
void close_dbs() { void close_dbs() {
...@@ -224,7 +224,7 @@ void setup_secondary(u_int32_t flags) { ...@@ -224,7 +224,7 @@ void setup_secondary(u_int32_t flags) {
if (flags) { if (flags) {
r = sdbp->set_flags(dbp, flags); CKERR(r); r = sdbp->set_flags(dbp, flags); CKERR(r);
} }
r = sdbp->open(sdbp, NULL, DIR "/secondary.db", NULL, DB_BTREE, DB_CREATE, 0600); CKERR(r); r = sdbp->open(sdbp, NULL, ENVDIR "/secondary.db", NULL, DB_BTREE, DB_CREATE, 0600); CKERR(r);
r = dbp->associate(dbp, NULL, sdbp, identity_callback, 0); CKERR(r); r = dbp->associate(dbp, NULL, sdbp, identity_callback, 0); CKERR(r);
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <errno.h> #include <errno.h>
#include <db.h> #include <db.h>
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
DB_ENV *env; DB_ENV *env;
DB *db; DB *db;
...@@ -17,10 +17,10 @@ DB *db; ...@@ -17,10 +17,10 @@ DB *db;
int main (int argc, char *argv[]) { int main (int argc, char *argv[]) {
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
r=db_env_create(&env, 0); CKERR(r); r=db_env_create(&env, 0); CKERR(r);
r=env->open(env, DIR, DB_PRIVATE|DB_INIT_MPOOL|DB_CREATE, 0777); CKERR(r); r=env->open(env, ENVDIR, DB_PRIVATE|DB_INIT_MPOOL|DB_CREATE, 0777); CKERR(r);
r=db_create(&db, env, 0); CKERR(r); r=db_create(&db, env, 0); CKERR(r);
r=db->open(db, NULL, "doesnotexist.db", "testdb", DB_BTREE, 0, 0666); assert(r==ENOENT); r=db->open(db, NULL, "doesnotexist.db", "testdb", DB_BTREE, 0, 0666); assert(r==ENOENT);
r=db->open(db, NULL, "doesnotexist.db", "testdb", DB_BTREE, DB_CREATE, 0666); CKERR(r); r=db->open(db, NULL, "doesnotexist.db", "testdb", DB_BTREE, DB_CREATE, 0666); CKERR(r);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include <db.h> #include <db.h>
#include <string.h> #include <string.h>
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
DB_ENV *env; DB_ENV *env;
DB *db; DB *db;
...@@ -18,15 +18,15 @@ DBT data; ...@@ -18,15 +18,15 @@ DBT data;
int main (int argc, char *argv[]) { int main (int argc, char *argv[]) {
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
memset(&key, 0, sizeof(key)); memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data)); memset(&data, 0, sizeof(data));
key.size = sizeof("name"); key.size = sizeof("name");
key.data = "name"; key.data = "name";
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
r=env->open(env, DIR, DB_INIT_MPOOL|DB_PRIVATE|DB_CREATE, 0777); assert(r==0); r=env->open(env, ENVDIR, DB_INIT_MPOOL|DB_PRIVATE|DB_CREATE, 0777); assert(r==0);
r=db_create(&db, env, 0); assert(r==0); r=db_create(&db, env, 0); assert(r==0);
r=db->open(db, NULL, "master.db", NULL, DB_BTREE, DB_CREATE, 0666); assert(r==0); r=db->open(db, NULL, "master.db", NULL, DB_BTREE, DB_CREATE, 0666); assert(r==0);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include <db.h> #include <db.h>
#include <string.h> #include <string.h>
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
#define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0); #define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0);
DB_ENV *env; DB_ENV *env;
...@@ -19,8 +19,8 @@ DBT data; ...@@ -19,8 +19,8 @@ DBT data;
int main (int argc, char *argv[]) { int main (int argc, char *argv[]) {
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
memset(&key, 0, sizeof(key)); memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data)); memset(&data, 0, sizeof(data));
key.size = sizeof("name"); key.size = sizeof("name");
...@@ -28,7 +28,7 @@ int main (int argc, char *argv[]) { ...@@ -28,7 +28,7 @@ int main (int argc, char *argv[]) {
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
// Note: without DB_INIT_MPOOL the BDB library will fail on db->open(). // Note: without DB_INIT_MPOOL the BDB library will fail on db->open().
r=env->open(env, DIR, DB_INIT_MPOOL|DB_PRIVATE|DB_CREATE, 0777); assert(r==0); r=env->open(env, ENVDIR, DB_INIT_MPOOL|DB_PRIVATE|DB_CREATE, 0777); assert(r==0);
r=db_create(&db, env, 0); assert(r==0); r=db_create(&db, env, 0); assert(r==0);
r=db->remove(db, "DoesNotExist.db", NULL, 0); assert(r==ENOENT); r=db->remove(db, "DoesNotExist.db", NULL, 0); assert(r==ENOENT);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "test.h" #include "test.h"
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
int dbtcmp(DBT *dbt1, DBT *dbt2) { int dbtcmp(DBT *dbt1, DBT *dbt2) {
int r; int r;
...@@ -55,7 +55,7 @@ void second_setup() { ...@@ -55,7 +55,7 @@ void second_setup() {
/* Open/create primary */ /* Open/create primary */
r = db_create(&dbp, dbenv, 0); CKERR(r); r = db_create(&dbp, dbenv, 0); CKERR(r);
dbp->set_errfile(dbp,0); // Turn off those annoying errors 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); r = dbp->open(dbp, NULL, ENVDIR "/students.db", NULL, DB_BTREE, DB_CREATE, 0600); CKERR(r);
/* /*
* Open/create secondary. Note that it supports duplicate data * Open/create secondary. Note that it supports duplicate data
...@@ -64,7 +64,7 @@ void second_setup() { ...@@ -64,7 +64,7 @@ void second_setup() {
r = db_create(&sdbp, dbenv, 0); CKERR(r); r = db_create(&sdbp, dbenv, 0); CKERR(r);
sdbp->set_errfile(sdbp,0); // Turn off those annoying errors sdbp->set_errfile(sdbp,0); // Turn off those annoying errors
r = sdbp->set_flags(sdbp, DB_DUP | DB_DUPSORT); CKERR(r); 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); r = sdbp->open(sdbp, NULL, ENVDIR "/lastname.db", NULL, DB_BTREE, DB_CREATE, 0600); CKERR(r);
/* Associate the secondary with the primary. */ /* Associate the secondary with the primary. */
...@@ -182,8 +182,8 @@ void verify_gone() { ...@@ -182,8 +182,8 @@ void verify_gone() {
int main() { int main() {
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
second_setup(); second_setup();
insert_test(); insert_test();
......
...@@ -19,7 +19,7 @@ void test_db_set_flags(int flags, int expectr, int flags2, int expectr2) { ...@@ -19,7 +19,7 @@ void test_db_set_flags(int flags, int expectr, int flags2, int expectr2) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test.db.set.flags.brt"; const char * const fname = ENVDIR "/" "test.db.set.flags.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -36,8 +36,8 @@ int main(int argc, const char *argv[]) { ...@@ -36,8 +36,8 @@ int main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
test_db_set_flags(0, 0, 0, 0); test_db_set_flags(0, 0, 0, 0);
test_db_set_flags(0, 0, DB_DUP, EINVAL); test_db_set_flags(0, 0, DB_DUP, EINVAL);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <unistd.h> #include <unistd.h>
#include <db.h> #include <db.h>
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
#define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0); #define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0);
...@@ -19,13 +19,13 @@ int main() { ...@@ -19,13 +19,13 @@ int main() {
const char * const fname = "test.db"; const char * const fname = "test.db";
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
// Note: without DB_INIT_MPOOL the BDB library will fail on db->open(). // Note: without DB_INIT_MPOOL the BDB library will fail on db->open().
r=env->open(env, DIR, DB_INIT_MPOOL|DB_PRIVATE|DB_CREATE|DB_INIT_LOG, 0777); assert(r==0); r=env->open(env, ENVDIR, DB_INIT_MPOOL|DB_PRIVATE|DB_CREATE|DB_INIT_LOG, 0777); assert(r==0);
r = db_create(&db, env, 0); r = db_create(&db, env, 0);
CKERR(r); CKERR(r);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "test.h" #include "test.h"
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
int dbtcmp(DBT *dbt1, DBT *dbt2) { int dbtcmp(DBT *dbt1, DBT *dbt2) {
int r; int r;
...@@ -147,8 +147,8 @@ void early_abort(char name) { ...@@ -147,8 +147,8 @@ void early_abort(char name) {
void setup_dbs(u_int32_t dup_flags) { void setup_dbs(u_int32_t dup_flags) {
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
dbenv = NULL; dbenv = NULL;
db = NULL; db = NULL;
/* Open/create primary */ /* Open/create primary */
...@@ -156,7 +156,7 @@ void setup_dbs(u_int32_t dup_flags) { ...@@ -156,7 +156,7 @@ void setup_dbs(u_int32_t dup_flags) {
CKERR(r); CKERR(r);
u_int32_t env_txn_flags = DB_INIT_TXN | DB_INIT_LOCK; u_int32_t env_txn_flags = DB_INIT_TXN | DB_INIT_LOCK;
u_int32_t env_open_flags = DB_CREATE | DB_PRIVATE | DB_INIT_MPOOL; u_int32_t env_open_flags = DB_CREATE | DB_PRIVATE | DB_INIT_MPOOL;
r = dbenv->open(dbenv, DIR, env_open_flags | env_txn_flags, 0600); r = dbenv->open(dbenv, ENVDIR, env_open_flags | env_txn_flags, 0600);
CKERR(r); CKERR(r);
r = db_create(&db, dbenv, 0); r = db_create(&db, dbenv, 0);
......
...@@ -44,7 +44,7 @@ void test_dup_delete(int n, int dup_mode) { ...@@ -44,7 +44,7 @@ void test_dup_delete(int n, int dup_mode) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_dup_delete.brt"; const char * const fname = ENVDIR "/" "test_dup_delete.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -135,7 +135,7 @@ void test_dup_delete_delete(int n) { ...@@ -135,7 +135,7 @@ void test_dup_delete_delete(int n) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_dup_delete_delete.brt"; const char * const fname = ENVDIR "/" "test_dup_delete_delete.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -215,7 +215,7 @@ void test_dup_delete_insert(int n, int dup_mode) { ...@@ -215,7 +215,7 @@ void test_dup_delete_insert(int n, int dup_mode) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_dup_delete_insert.brt"; const char * const fname = ENVDIR "/" "test_dup_delete_insert.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -318,7 +318,7 @@ void test_all_dup_delete_insert(int n) { ...@@ -318,7 +318,7 @@ void test_all_dup_delete_insert(int n) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_all_dup_delete_insert.brt"; const char * const fname = ENVDIR "/" "test_all_dup_delete_insert.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -391,7 +391,7 @@ void test_walk_empty(int n, int dup_mode) { ...@@ -391,7 +391,7 @@ void test_walk_empty(int n, int dup_mode) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_walk_empty.brt"; const char * const fname = ENVDIR "/" "test_walk_empty.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -463,7 +463,7 @@ void test_icdi_search(int n, int dup_mode) { ...@@ -463,7 +463,7 @@ void test_icdi_search(int n, int dup_mode) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_icdi_search.brt"; const char * const fname = ENVDIR "/" "test_icdi_search.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -550,7 +550,7 @@ void test_ici_search(int n, int dup_mode) { ...@@ -550,7 +550,7 @@ void test_ici_search(int n, int dup_mode) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_ici_search.brt"; const char * const fname = ENVDIR "/" "test_ici_search.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -644,7 +644,7 @@ void test_i0i1ci0_search(int n, int dup_mode) { ...@@ -644,7 +644,7 @@ void test_i0i1ci0_search(int n, int dup_mode) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_i0i1ci0.brt"; const char * const fname = ENVDIR "/" "test_i0i1ci0.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -698,8 +698,8 @@ int main(int argc, const char *argv[]) { ...@@ -698,8 +698,8 @@ int main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
#if USE_BDB #if USE_BDB
/* dup tests */ /* dup tests */
......
...@@ -59,7 +59,7 @@ void test_dup_key(int dup_mode, u_int32_t put_flags, int rexpect, int rexpectdup ...@@ -59,7 +59,7 @@ void test_dup_key(int dup_mode, u_int32_t put_flags, int rexpect, int rexpectdup
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_insert.brt"; const char * const fname = ENVDIR "/" "test_insert.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -110,7 +110,7 @@ void test_dup_dup(int dup_mode, u_int32_t put_flags, int rexpect, int rexpectdup ...@@ -110,7 +110,7 @@ void test_dup_dup(int dup_mode, u_int32_t put_flags, int rexpect, int rexpectdup
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_insert.brt"; const char * const fname = ENVDIR "/" "test_insert.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -161,7 +161,7 @@ void test_put_00_01_01(int dup_mode, u_int32_t put_flags) { ...@@ -161,7 +161,7 @@ void test_put_00_01_01(int dup_mode, u_int32_t put_flags) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_insert.brt"; const char * const fname = ENVDIR "/" "test_insert.brt";
int r, expectr; int r, expectr;
unlink(fname); unlink(fname);
...@@ -221,8 +221,8 @@ int main(int argc, const char *argv[]) { ...@@ -221,8 +221,8 @@ int main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
test_put_00_01_01(0, 0); test_put_00_01_01(0, 0);
test_put_00_01_01(0, DB_NOOVERWRITE); test_put_00_01_01(0, DB_NOOVERWRITE);
......
...@@ -19,7 +19,7 @@ void test_dup_flags(int dup_flags) { ...@@ -19,7 +19,7 @@ void test_dup_flags(int dup_flags) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_dup_flags.brt"; const char * const fname = ENVDIR "/" "test_dup_flags.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -75,8 +75,8 @@ int main(int argc, const char *argv[]) { ...@@ -75,8 +75,8 @@ int main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
/* test flags */ /* test flags */
test_dup_flags(0); test_dup_flags(0);
......
...@@ -44,7 +44,7 @@ void test_insert(int n, int dup_mode) { ...@@ -44,7 +44,7 @@ void test_insert(int n, int dup_mode) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_insert.brt"; const char * const fname = ENVDIR "/" "test_insert.brt";
int r; int r;
int i; int i;
...@@ -143,7 +143,7 @@ void test_nonleaf_insert(int n, int dup_mode) { ...@@ -143,7 +143,7 @@ void test_nonleaf_insert(int n, int dup_mode) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_nonleaf_insert.brt"; const char * const fname = ENVDIR "/" "test_nonleaf_insert.brt";
int r; int r;
int i; int i;
...@@ -252,8 +252,8 @@ int main(int argc, const char *argv[]) { ...@@ -252,8 +252,8 @@ int main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
/* nodup tests */ /* nodup tests */
for (i = 1; i <= (1<<16); i *= 2) { for (i = 1; i <= (1<<16); i *= 2) {
......
...@@ -93,7 +93,7 @@ void test_dup_next(int n, int dup_mode) { ...@@ -93,7 +93,7 @@ void test_dup_next(int n, int dup_mode) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_dup_next.brt"; const char * const fname = ENVDIR "/" "test_dup_next.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -158,8 +158,8 @@ int main(int argc, const char *argv[]) { ...@@ -158,8 +158,8 @@ int main(int argc, const char *argv[]) {
} }
} }
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
for (i = 1; i <= 65536; i = testlevel ? i+1 : i*2) { for (i = 1; i <= 65536; i = testlevel ? i+1 : i*2) {
test_dup_next(i, DB_DUP + DB_DUPSORT); test_dup_next(i, DB_DUP + DB_DUPSORT);
......
...@@ -77,7 +77,7 @@ void test_icdi_search(int n, int dup_mode) { ...@@ -77,7 +77,7 @@ void test_icdi_search(int n, int dup_mode) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_icdi_search.brt"; const char * const fname = ENVDIR "/" "test_icdi_search.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -147,7 +147,7 @@ void test_ici_search(int n, int dup_mode) { ...@@ -147,7 +147,7 @@ void test_ici_search(int n, int dup_mode) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_ici_search.brt"; const char * const fname = ENVDIR "/" "test_ici_search.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -215,7 +215,7 @@ void test_i0i1ci0_search(int n, int dup_mode) { ...@@ -215,7 +215,7 @@ void test_i0i1ci0_search(int n, int dup_mode) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_i0i1ci0.brt"; const char * const fname = ENVDIR "/" "test_i0i1ci0.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -271,7 +271,7 @@ void test_reverse_search(int n, int dup_mode) { ...@@ -271,7 +271,7 @@ void test_reverse_search(int n, int dup_mode) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_reverse_search.brt"; const char * const fname = ENVDIR "/" "test_reverse_search.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -329,8 +329,8 @@ int main(int argc, const char *argv[]) { ...@@ -329,8 +329,8 @@ int main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
int limit = 1<<13; int limit = 1<<13;
if (verbose > 1) if (verbose > 1)
......
...@@ -38,7 +38,7 @@ void test_dupsort_delete(int n) { ...@@ -38,7 +38,7 @@ void test_dupsort_delete(int n) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_dupsort_delete.brt"; const char * const fname = ENVDIR "/" "test_dupsort_delete.brt";
int r; int r;
int i; int i;
...@@ -96,8 +96,8 @@ int main(int argc, const char *argv[]) { ...@@ -96,8 +96,8 @@ int main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
// test_dupsort_delete(256); return 0; // test_dupsort_delete(256); return 0;
/* nodup tests */ /* nodup tests */
......
...@@ -100,7 +100,7 @@ void test_dupsort_get(int n, int dup_mode) { ...@@ -100,7 +100,7 @@ void test_dupsort_get(int n, int dup_mode) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test.dupsort.get.brt"; const char * const fname = ENVDIR "/" "test.dupsort.get.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -153,8 +153,8 @@ int main(int argc, const char *argv[]) { ...@@ -153,8 +153,8 @@ int main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
int limit = 1<<13; int limit = 1<<13;
if (verbose > 1) if (verbose > 1)
......
...@@ -101,7 +101,7 @@ void test_icdi_search(int n, int dup_mode) { ...@@ -101,7 +101,7 @@ void test_icdi_search(int n, int dup_mode) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_icdi_search.brt"; const char * const fname = ENVDIR "/" "test_icdi_search.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -162,8 +162,8 @@ int main(int argc, const char *argv[]) { ...@@ -162,8 +162,8 @@ int main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
int limit = 1<<13; int limit = 1<<13;
if (verbose > 1) if (verbose > 1)
......
...@@ -99,7 +99,7 @@ void test_icdi_search(int n, int dup_mode) { ...@@ -99,7 +99,7 @@ void test_icdi_search(int n, int dup_mode) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_icdi_search.brt"; const char * const fname = ENVDIR "/" "test_icdi_search.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -166,8 +166,8 @@ int main(int argc, const char *argv[]) { ...@@ -166,8 +166,8 @@ int main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
int limit = 1<<13; int limit = 1<<13;
if (verbose > 1) if (verbose > 1)
......
...@@ -101,7 +101,7 @@ void test_icdi_search(int n, int dup_mode) { ...@@ -101,7 +101,7 @@ void test_icdi_search(int n, int dup_mode) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_icdi_search.brt"; const char * const fname = ENVDIR "/" "test_icdi_search.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -162,8 +162,8 @@ int main(int argc, const char *argv[]) { ...@@ -162,8 +162,8 @@ int main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
int limit = 1<<13; int limit = 1<<13;
if (verbose > 1) if (verbose > 1)
......
...@@ -113,7 +113,7 @@ void test_icdi_search(int n, int dup_mode) { ...@@ -113,7 +113,7 @@ void test_icdi_search(int n, int dup_mode) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_icdi_search.brt"; const char * const fname = ENVDIR "/" "test_icdi_search.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -174,8 +174,8 @@ int main(int argc, const char *argv[]) { ...@@ -174,8 +174,8 @@ int main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
int limit = 1<<13; int limit = 1<<13;
if (verbose > 1) if (verbose > 1)
......
...@@ -9,20 +9,20 @@ ...@@ -9,20 +9,20 @@
#include <sys/types.h> #include <sys/types.h>
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
#define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0); #define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0);
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) {
DB_ENV *env; DB_ENV *env;
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
env->set_errfile(env,0); // Turn off those annoying errors env->set_errfile(env,0); // Turn off those annoying errors
r=env->close (env, 0); assert(r==0); r=env->close (env, 0); assert(r==0);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
env->set_errfile(env,0); // Turn off those annoying errors env->set_errfile(env,0); // Turn off those annoying errors
r=env->close (env, 1); r=env->close (env, 1);
...@@ -32,20 +32,20 @@ int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__u ...@@ -32,20 +32,20 @@ int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__u
#else #else
assert(r==0); assert(r==0);
#endif #endif
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
env->set_errfile(env,0); // Turn off those annoying errors 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->open(env, ENVDIR, 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); r=env->close (env, 0); assert(r==0);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
env->set_errfile(env,0); // Turn off those annoying errors 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->open(env, ENVDIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_PRIVATE|DB_CREATE, 0777); CKERR(r);
r=env->close (env, 1); r=env->close (env, 1);
//BDB does not check this. //BDB does not check this.
#if defined(USE_TDB) || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3) #if defined(USE_TDB) || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3)
......
...@@ -23,7 +23,7 @@ void test_env_open_flags(int env_open_flags, int expectr) { ...@@ -23,7 +23,7 @@ void test_env_open_flags(int env_open_flags, int expectr) {
r = db_env_create(&env, 0); r = db_env_create(&env, 0);
assert(r == 0); assert(r == 0);
r = env->open(env, DIR, env_open_flags, 0644); r = env->open(env, ENVDIR, env_open_flags, 0644);
if (r != expectr && verbose) printf("env open flags=%x expectr=%d r=%d\n", env_open_flags, expectr, r); if (r != expectr && verbose) printf("env open flags=%x expectr=%d r=%d\n", env_open_flags, expectr, r);
r = env->close(env, 0); r = env->close(env, 0);
...@@ -34,8 +34,8 @@ int main(int argc, const char *argv[]) { ...@@ -34,8 +34,8 @@ int main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
/* test flags */ /* test flags */
test_env_open_flags(0, ENOENT); test_env_open_flags(0, ENOENT);
......
...@@ -19,14 +19,14 @@ int main (int argc, const char *argv[]) { ...@@ -19,14 +19,14 @@ int main (int argc, const char *argv[]) {
if (verbose) printf("Warning: fmemopen does not exist in OSX!\n"); if (verbose) printf("Warning: fmemopen does not exist in OSX!\n");
#else #else
system("rm -rf " DIR); system("rm -rf " ENVDIR);
int r=mkdir(DIR, 0777); assert(r==0); int r=mkdir(ENVDIR, 0777); assert(r==0);
{ {
DB_ENV *env; DB_ENV *env;
r = db_env_create(&env, 0); assert(r==0); r = db_env_create(&env, 0); assert(r==0);
env->set_errfile(env,0); // Turn off those annoying errors env->set_errfile(env,0); // Turn off those annoying errors
r = env->open(env, DIR, -1, 0644); r = env->open(env, ENVDIR, -1, 0644);
assert(r==EINVAL); assert(r==EINVAL);
assert(n_handle_error==0); assert(n_handle_error==0);
r = env->close(env, 0); assert(r==0); r = env->close(env, 0); assert(r==0);
...@@ -55,7 +55,7 @@ int main (int argc, const char *argv[]) { ...@@ -55,7 +55,7 @@ int main (int argc, const char *argv[]) {
env->set_errfile(env, write_here); env->set_errfile(env, write_here);
if (do_errcall) if (do_errcall)
env->set_errcall(env, handle_error); env->set_errcall(env, handle_error);
r = env->open(env, DIR, -1, 0644); r = env->open(env, ENVDIR, -1, 0644);
assert(r==EINVAL); assert(r==EINVAL);
r = env->close(env, 0); assert(r==0); r = env->close(env, 0); assert(r==0);
fclose(write_here); fclose(write_here);
......
...@@ -104,7 +104,7 @@ void test_get_both(int n, int dup_mode, int op) { ...@@ -104,7 +104,7 @@ void test_get_both(int n, int dup_mode, int op) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_icdi_search.brt"; const char * const fname = ENVDIR "/" "test_icdi_search.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -178,8 +178,8 @@ int main(int argc, const char *argv[]) { ...@@ -178,8 +178,8 @@ int main(int argc, const char *argv[]) {
} }
} }
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
for (i=1; i <= 256; i *= 2) { for (i=1; i <= 256; i *= 2) {
test_get_both(i, 0, DB_GET_BOTH); test_get_both(i, 0, DB_GET_BOTH);
......
...@@ -14,10 +14,10 @@ void test_get (int dup_mode) { ...@@ -14,10 +14,10 @@ void test_get (int dup_mode) {
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
DB *db; DB *db;
DBT key,data; DBT key,data;
int fnamelen = sizeof(DIR) + 30; int fnamelen = sizeof(ENVDIR) + 30;
char fname[fnamelen]; char fname[fnamelen];
int r; int r;
snprintf(fname, fnamelen, "%s/test%d.db", DIR, dup_mode); snprintf(fname, fnamelen, "%s/test%d.db", ENVDIR, dup_mode);
r = db_create (&db, null_env, 0); assert(r == 0); r = db_create (&db, null_env, 0); assert(r == 0);
r = db->set_flags(db, dup_mode); assert(r == 0); r = db->set_flags(db, dup_mode); assert(r == 0);
r = db->open(db, null_txn, fname, "main", DB_BTREE, DB_CREATE, 0666); assert(r == 0); r = db->open(db, null_txn, fname, "main", DB_BTREE, DB_CREATE, 0666); assert(r == 0);
...@@ -31,8 +31,8 @@ void test_get (int dup_mode) { ...@@ -31,8 +31,8 @@ void test_get (int dup_mode) {
int main (int argc, const char *argv[]) { int main (int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
test_get(0); test_get(0);
test_get(DB_DUP + DB_DUPSORT); test_get(DB_DUP + DB_DUPSORT);
......
...@@ -43,11 +43,11 @@ void test_hsoc(int pagesize, int dup_mode) { ...@@ -43,11 +43,11 @@ void test_hsoc(int pagesize, int dup_mode) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test.hsoc.brt"; const char * const fname = ENVDIR "/" "test.hsoc.brt";
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
/* create the dup database file */ /* create the dup database file */
r = db_create(&db, null_env, 0); assert(r == 0); r = db_create(&db, null_env, 0); assert(r == 0);
......
...@@ -20,7 +20,7 @@ void test_insert_delete_insert(int dup_mode) { ...@@ -20,7 +20,7 @@ void test_insert_delete_insert(int dup_mode) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test.cursor.insert.delete.insert.brt"; const char * const fname = ENVDIR "/" "test.cursor.insert.delete.insert.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -68,8 +68,8 @@ int main(int argc, const char *argv[]) { ...@@ -68,8 +68,8 @@ int main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
test_insert_delete_insert(0); test_insert_delete_insert(0);
test_insert_delete_insert(DB_DUP + DB_DUPSORT); test_insert_delete_insert(DB_DUP + DB_DUPSORT);
......
...@@ -20,7 +20,7 @@ void test_insert(int n, int dup_mode) { ...@@ -20,7 +20,7 @@ void test_insert(int n, int dup_mode) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test.insert.brt"; const char * const fname = ENVDIR "/" "test.insert.brt";
int r; int r;
/* create the dup database file */ /* create the dup database file */
...@@ -48,8 +48,8 @@ void test_insert(int n, int dup_mode) { ...@@ -48,8 +48,8 @@ void test_insert(int n, int dup_mode) {
int main(int argc, const char *argv[]) { int main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
int r=mkdir(DIR, 0777); assert(r==0); int r=mkdir(ENVDIR, 0777); assert(r==0);
test_insert(256, 0); test_insert(256, 0);
......
...@@ -18,11 +18,11 @@ void test_key_size_limit(int dup_mode) { ...@@ -18,11 +18,11 @@ void test_key_size_limit(int dup_mode) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test.rand.insert.brt"; const char * const fname = ENVDIR "/" "test.rand.insert.brt";
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
/* create the dup database file */ /* create the dup database file */
r = db_create(&db, null_env, 0); r = db_create(&db, null_env, 0);
......
...@@ -8,16 +8,16 @@ ...@@ -8,16 +8,16 @@
#include <sys/types.h> #include <sys/types.h>
#include <db.h> #include <db.h>
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
DB_ENV *env; DB_ENV *env;
int main (int argc, char *argv[]) { int main (int argc, char *argv[]) {
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
r=env->open(env, DIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_PRIVATE|DB_CREATE, 0777); assert(r==0); r=env->open(env, ENVDIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_PRIVATE|DB_CREATE, 0777); assert(r==0);
r=env->close(env, 0); assert(r==0); r=env->close(env, 0); assert(r==0);
return 0; return 0;
} }
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
DB_ENV *env; DB_ENV *env;
DB *db; DB *db;
...@@ -20,10 +20,10 @@ DB_TXN *tid; ...@@ -20,10 +20,10 @@ DB_TXN *tid;
int main (int argc, char *argv[]) { int main (int argc, char *argv[]) {
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
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->open(env, ENVDIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_PRIVATE|DB_CREATE, 0777); CKERR(r);
r=db_create(&db, env, 0); CKERR(r); r=db_create(&db, env, 0); CKERR(r);
r=env->txn_begin(env, 0, &tid, 0); assert(r==0); r=env->txn_begin(env, 0, &tid, 0); assert(r==0);
r=db->open(db, tid, "foo.db", 0, DB_BTREE, DB_CREATE, 0777); CKERR(r); r=db->open(db, tid, "foo.db", 0, DB_BTREE, DB_CREATE, 0777); CKERR(r);
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
#define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0); #define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0);
...@@ -20,10 +20,10 @@ static void make_db (void) { ...@@ -20,10 +20,10 @@ static void make_db (void) {
DB_TXN *tid; DB_TXN *tid;
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
r=env->open(env, DIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, 0777); CKERR(r); r=env->open(env, ENVDIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, 0777); CKERR(r);
r=db_create(&db, env, 0); CKERR(r); r=db_create(&db, env, 0); CKERR(r);
r=env->txn_begin(env, 0, &tid, 0); assert(r==0); r=env->txn_begin(env, 0, &tid, 0); assert(r==0);
r=db->open(db, tid, "foo.db", 0, DB_BTREE, DB_CREATE, 0777); CKERR(r); r=db->open(db, tid, "foo.db", 0, DB_BTREE, DB_CREATE, 0777); CKERR(r);
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <string.h> #include <string.h>
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
#define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0); #define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0);
...@@ -21,10 +21,10 @@ static void make_db (void) { ...@@ -21,10 +21,10 @@ static void make_db (void) {
DB_TXN *tid; DB_TXN *tid;
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
r=env->open(env, DIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, 0777); CKERR(r); r=env->open(env, ENVDIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, 0777); CKERR(r);
r=db_create(&db, env, 0); CKERR(r); r=db_create(&db, env, 0); CKERR(r);
r=env->txn_begin(env, 0, &tid, 0); assert(r==0); r=env->txn_begin(env, 0, &tid, 0); assert(r==0);
r=db->open(db, tid, "foo.db", 0, DB_BTREE, DB_CREATE, 0777); CKERR(r); r=db->open(db, tid, "foo.db", 0, DB_BTREE, DB_CREATE, 0777); CKERR(r);
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <string.h> #include <string.h>
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
#define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0); #define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0);
...@@ -22,11 +22,11 @@ static void make_db (void) { ...@@ -22,11 +22,11 @@ static void make_db (void) {
int r; int r;
int i; int i;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
r=env->set_lk_max_locks(env, 30000); CKERR(r); r=env->set_lk_max_locks(env, 30000); CKERR(r);
r=env->open(env, DIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, 0777); CKERR(r); r=env->open(env, ENVDIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, 0777); CKERR(r);
r=db_create(&db, env, 0); CKERR(r); r=db_create(&db, env, 0); CKERR(r);
r=env->txn_begin(env, 0, &tid, 0); assert(r==0); r=env->txn_begin(env, 0, &tid, 0); assert(r==0);
r=db->open(db, tid, "foo.db", 0, DB_BTREE, DB_CREATE, 0777); CKERR(r); r=db->open(db, tid, "foo.db", 0, DB_BTREE, DB_CREATE, 0777); CKERR(r);
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <string.h> #include <string.h>
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
#define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0); #define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0);
...@@ -31,11 +31,11 @@ static void make_db (void) { ...@@ -31,11 +31,11 @@ static void make_db (void) {
int maxcount = 24073; int maxcount = 24073;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
r=env->set_lk_max_locks(env, 2*maxcount); CKERR(r); r=env->set_lk_max_locks(env, 2*maxcount); CKERR(r);
r=env->open(env, DIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, 0777); CKERR(r); r=env->open(env, ENVDIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, 0777); CKERR(r);
r=db_create(&db, env, 0); CKERR(r); r=db_create(&db, env, 0); CKERR(r);
r=env->txn_begin(env, 0, &tid, 0); assert(r==0); r=env->txn_begin(env, 0, &tid, 0); assert(r==0);
r=db->open(db, tid, "foo.db", 0, DB_BTREE, DB_CREATE, 0777); CKERR(r); r=db->open(db, tid, "foo.db", 0, DB_BTREE, DB_CREATE, 0777); CKERR(r);
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#define DB_DELETE_ANY 0 #define DB_DELETE_ANY 0
#endif #endif
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
#define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0); #define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0);
...@@ -75,10 +75,10 @@ static void make_db (void) { ...@@ -75,10 +75,10 @@ static void make_db (void) {
int r; int r;
int i; int i;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
r=env->open(env, DIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, 0777); CKERR(r); r=env->open(env, ENVDIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, 0777); CKERR(r);
r=db_create(&db, env, 0); CKERR(r); r=db_create(&db, env, 0); CKERR(r);
r=env->txn_begin(env, 0, &tid, 0); assert(r==0); r=env->txn_begin(env, 0, &tid, 0); assert(r==0);
r=db->open(db, tid, "foo.db", 0, DB_BTREE, DB_CREATE, 0777); CKERR(r); r=db->open(db, tid, "foo.db", 0, DB_BTREE, DB_CREATE, 0777); CKERR(r);
......
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
// Return the offset // Return the offset
int grep_for_in_logs(const char *str) { int grep_for_in_logs(const char *str) {
#ifdef TOKUDB #ifdef TOKUDB
#define lname DIR "//log000000000000.tokulog" #define lname ENVDIR "//log000000000000.tokulog"
#else #else
#define lname DIR "//log.0000000001" #define lname ENVDIR "//log.0000000001"
#endif #endif
int fd = open(lname, O_RDONLY); int fd = open(lname, O_RDONLY);
assert(fd>=0); assert(fd>=0);
...@@ -38,10 +38,10 @@ int main (int argc, char *argv[]) { ...@@ -38,10 +38,10 @@ int main (int argc, char *argv[]) {
DB *db; DB *db;
DB_TXN *tid; DB_TXN *tid;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
r=env->open(env, DIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, 0777); CKERR(r); r=env->open(env, ENVDIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, 0777); CKERR(r);
r=db_create(&db, env, 0); CKERR(r); r=db_create(&db, env, 0); CKERR(r);
r=env->txn_begin(env, 0, &tid, 0); assert(r==0); r=env->txn_begin(env, 0, &tid, 0); assert(r==0);
r=db->open(db, tid, "foo.db", 0, DB_BTREE, DB_CREATE, 0777); CKERR(r); r=db->open(db, tid, "foo.db", 0, DB_BTREE, DB_CREATE, 0777); CKERR(r);
......
...@@ -13,14 +13,14 @@ void test_logmax (int logmax) { ...@@ -13,14 +13,14 @@ void test_logmax (int logmax) {
DB *db; DB *db;
DB_TXN *tid; DB_TXN *tid;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
if (logmax>0) { if (logmax>0) {
r=env->set_lg_max(env, logmax); r=env->set_lg_max(env, logmax);
assert(r==0); assert(r==0);
} }
r=env->open(env, DIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, 0777); CKERR(r); r=env->open(env, ENVDIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, 0777); CKERR(r);
{ {
u_int32_t lmax; u_int32_t lmax;
r=env->get_lg_max(env, &lmax); r=env->get_lg_max(env, &lmax);
...@@ -72,7 +72,7 @@ void test_logmax (int logmax) { ...@@ -72,7 +72,7 @@ void test_logmax (int logmax) {
r=tid->commit(tid, 0); assert(r==0); r=tid->commit(tid, 0); assert(r==0);
r=db->close(db, 0); assert(r==0); r=db->close(db, 0); assert(r==0);
r=env->close(env, 0); assert(r==0); r=env->close(env, 0); assert(r==0);
system("ls -l " DIR); system("ls -l " ENVDIR);
} }
int main (int argc, char *argv[]) { int main (int argc, char *argv[]) {
......
...@@ -101,7 +101,7 @@ void test_icdi_search(int n, int dup_mode) { ...@@ -101,7 +101,7 @@ void test_icdi_search(int n, int dup_mode) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_icdi_search.brt"; const char * const fname = ENVDIR "/" "test_icdi_search.brt";
int r; int r;
unlink(fname); unlink(fname);
...@@ -168,8 +168,8 @@ int main(int argc, const char *argv[]) { ...@@ -168,8 +168,8 @@ int main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
for (i=1; i<65537; i *= 2) { for (i=1; i<65537; i *= 2) {
test_icdi_search(i, 0); test_icdi_search(i, 0);
......
...@@ -20,11 +20,11 @@ void test_rand_insert(int n, int dup_mode) { ...@@ -20,11 +20,11 @@ void test_rand_insert(int n, int dup_mode) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test.rand.insert.brt"; const char * const fname = ENVDIR "/" "test.rand.insert.brt";
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
/* create the dup database file */ /* create the dup database file */
r = db_create(&db, null_env, 0); r = db_create(&db, null_env, 0);
......
...@@ -58,13 +58,13 @@ void test_reverse_compare(int n, int dup_flags) { ...@@ -58,13 +58,13 @@ void test_reverse_compare(int n, int dup_flags) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/reverse.compare.db"; const char * const fname = ENVDIR "/reverse.compare.db";
int r; int r;
int i; int i;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
/* create the dup database file */ /* create the dup database file */
r = db_create(&db, null_env, 0); r = db_create(&db, null_env, 0);
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <string.h> #include <string.h>
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
#define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0); #define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0);
...@@ -23,8 +23,8 @@ static void make_db (int n_locks) { ...@@ -23,8 +23,8 @@ static void make_db (int n_locks) {
int r; int r;
int i; int i;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(ENVDIR, 0777); assert(r==0);
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
if (n_locks>0) { if (n_locks>0) {
r=env->set_lk_max_locks(env, n_locks); CKERR(r); r=env->set_lk_max_locks(env, n_locks); CKERR(r);
...@@ -35,7 +35,7 @@ static void make_db (int n_locks) { ...@@ -35,7 +35,7 @@ static void make_db (int n_locks) {
r=env->get_lk_max_locks(env, &set_locks); r=env->get_lk_max_locks(env, &set_locks);
assert(r == 0 && set_locks == n_locks); assert(r == 0 && set_locks == n_locks);
} }
r=env->open(env, DIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, 0777); CKERR(r); r=env->open(env, ENVDIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, 0777); CKERR(r);
r=db_create(&db, env, 0); CKERR(r); r=db_create(&db, env, 0); CKERR(r);
r=env->txn_begin(env, 0, &tid, 0); assert(r==0); r=env->txn_begin(env, 0, &tid, 0); assert(r==0);
r=db->open(db, tid, "foo.db", 0, DB_BTREE, DB_CREATE, 0777); CKERR(r); r=db->open(db, tid, "foo.db", 0, DB_BTREE, DB_CREATE, 0777); CKERR(r);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <db.h> #include <db.h>
#include "test.h" #include "test.h"
const char *dbfile = DIR "/" "test.db"; const char *dbfile = ENVDIR "/" "test.db";
const char *dbname = 0; const char *dbname = 0;
int db_put(DB *db, int k, int v) { int db_put(DB *db, int k, int v) {
...@@ -69,8 +69,8 @@ void test_db_thread() { ...@@ -69,8 +69,8 @@ void test_db_thread() {
int main(int argc, const char *argv[]) { int main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
test_db_create(); test_db_create();
test_db_thread(); test_db_thread();
return 0; return 0;
......
...@@ -63,8 +63,8 @@ int main(int argc, char *argv[]) { ...@@ -63,8 +63,8 @@ int main(int argc, char *argv[]) {
int nthreads = 2; int nthreads = 2;
my_t n = 1000000; my_t n = 1000000;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
int i; int i;
for (i=1; i<argc; i++) { for (i=1; i<argc; i++) {
...@@ -93,7 +93,7 @@ int main(int argc, char *argv[]) { ...@@ -93,7 +93,7 @@ int main(int argc, char *argv[]) {
r = db_env_create(&env, 0); assert(r == 0); r = db_env_create(&env, 0); assert(r == 0);
r = env->set_cachesize(env, 0, 128000000, 1); assert(r == 0); r = env->set_cachesize(env, 0, 128000000, 1); assert(r == 0);
r = env->open(env, DIR, DB_CREATE + DB_THREAD + DB_PRIVATE + DB_INIT_MPOOL + DB_INIT_LOCK, 0777); assert(r == 0); r = env->open(env, ENVDIR, DB_CREATE + DB_THREAD + DB_PRIVATE + DB_INIT_MPOOL + DB_INIT_LOCK, 0777); assert(r == 0);
DB *db; DB *db;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "test.h" #include "test.h"
// DIR is defined in the Makefile // ENVDIR is defined in the Makefile
int dbtcmp(DBT *dbt1, DBT *dbt2) { int dbtcmp(DBT *dbt1, DBT *dbt2) {
int r; int r;
...@@ -55,7 +55,7 @@ void second_setup() { ...@@ -55,7 +55,7 @@ void second_setup() {
/* Open/create primary */ /* Open/create primary */
r = db_create(&dbp, dbenv, 0); CKERR(r); r = db_create(&dbp, dbenv, 0); CKERR(r);
dbp->set_errfile(dbp,0); // Turn off those annoying errors 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); r = dbp->open(dbp, NULL, ENVDIR "/students.db", NULL, DB_BTREE, DB_CREATE+DB_THREAD, 0600); CKERR(r);
/* /*
* Open/create secondary. Note that it supports duplicate data * Open/create secondary. Note that it supports duplicate data
...@@ -64,7 +64,7 @@ void second_setup() { ...@@ -64,7 +64,7 @@ void second_setup() {
r = db_create(&sdbp, dbenv, 0); CKERR(r); r = db_create(&sdbp, dbenv, 0); CKERR(r);
sdbp->set_errfile(sdbp,0); // Turn off those annoying errors sdbp->set_errfile(sdbp,0); // Turn off those annoying errors
r = sdbp->set_flags(sdbp, DB_DUP | DB_DUPSORT); CKERR(r); 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); r = sdbp->open(sdbp, NULL, ENVDIR "/lastname.db", NULL, DB_BTREE, DB_CREATE+DB_THREAD, 0600); CKERR(r);
/* Associate the secondary with the primary. */ /* Associate the secondary with the primary. */
...@@ -196,8 +196,8 @@ void verify_gone() { ...@@ -196,8 +196,8 @@ void verify_gone() {
int main() { int main() {
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
second_setup(); second_setup();
insert_test(); insert_test();
......
...@@ -105,8 +105,8 @@ int main(int argc, char *argv[]) { ...@@ -105,8 +105,8 @@ int main(int argc, char *argv[]) {
} }
if (!do_resume) { if (!do_resume) {
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
} }
int r; int r;
...@@ -114,7 +114,7 @@ int main(int argc, char *argv[]) { ...@@ -114,7 +114,7 @@ int main(int argc, char *argv[]) {
r = db_env_create(&env, 0); assert(r == 0); r = db_env_create(&env, 0); assert(r == 0);
r = env->set_cachesize(env, 0, 8000000, 1); assert(r == 0); r = env->set_cachesize(env, 0, 8000000, 1); assert(r == 0);
r = env->open(env, DIR, DB_CREATE + DB_THREAD + DB_PRIVATE + DB_INIT_MPOOL + DB_INIT_LOCK, 0777); assert(r == 0); r = env->open(env, ENVDIR, DB_CREATE + DB_THREAD + DB_PRIVATE + DB_INIT_MPOOL + DB_INIT_LOCK, 0777); assert(r == 0);
DB *db; DB *db;
......
...@@ -10,14 +10,14 @@ ...@@ -10,14 +10,14 @@
void test_txn_abort(int n) { void test_txn_abort(int n) {
if (verbose) printf("test_txn_abort:%d\n", n); if (verbose) printf("test_txn_abort:%d\n", n);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
int r; int r;
DB_ENV *env; DB_ENV *env;
r = db_env_create(&env, 0); assert(r == 0); r = db_env_create(&env, 0); assert(r == 0);
r = env->set_data_dir(env, DIR); r = env->set_data_dir(env, ENVDIR);
r = env->set_lg_dir(env, DIR); r = env->set_lg_dir(env, ENVDIR);
r = env->open(env, 0, DB_INIT_MPOOL + DB_INIT_LOG + DB_INIT_LOCK + DB_INIT_TXN + DB_PRIVATE + DB_CREATE, 0777); r = env->open(env, 0, DB_INIT_MPOOL + DB_INIT_LOG + DB_INIT_LOCK + DB_INIT_TXN + DB_PRIVATE + DB_CREATE, 0777);
if (r != 0) printf("%s:%d:%d:%s\n", __FILE__, __LINE__, r, db_strerror(r)); if (r != 0) printf("%s:%d:%d:%s\n", __FILE__, __LINE__, r, db_strerror(r));
assert(r == 0); assert(r == 0);
......
...@@ -12,14 +12,14 @@ ...@@ -12,14 +12,14 @@
void test_txn_abort(int n) { void test_txn_abort(int n) {
if (verbose>1) printf("%s %s:%d\n", __FILE__, __FUNCTION__, n); if (verbose>1) printf("%s %s:%d\n", __FILE__, __FUNCTION__, n);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
int r; int r;
DB_ENV *env; DB_ENV *env;
r = db_env_create(&env, 0); assert(r == 0); r = db_env_create(&env, 0); assert(r == 0);
r = env->set_data_dir(env, DIR); r = env->set_data_dir(env, ENVDIR);
r = env->set_lg_dir(env, DIR); r = env->set_lg_dir(env, ENVDIR);
r = env->open(env, 0, DB_INIT_MPOOL + DB_INIT_LOG + DB_INIT_LOCK + DB_INIT_TXN + DB_PRIVATE + DB_CREATE, 0777); r = env->open(env, 0, DB_INIT_MPOOL + DB_INIT_LOG + DB_INIT_LOCK + DB_INIT_TXN + DB_PRIVATE + DB_CREATE, 0777);
if (r != 0) printf("%s:%d:%d:%s\n", __FILE__, __LINE__, r, db_strerror(r)); if (r != 0) printf("%s:%d:%d:%s\n", __FILE__, __LINE__, r, db_strerror(r));
assert(r == 0); assert(r == 0);
......
...@@ -12,14 +12,14 @@ ...@@ -12,14 +12,14 @@
void test_txn_abort(int n, int which_guys_to_abort) { void test_txn_abort(int n, int which_guys_to_abort) {
if (verbose>1) printf("test_txn_abort(%d,%x)\n", n, which_guys_to_abort); if (verbose>1) printf("test_txn_abort(%d,%x)\n", n, which_guys_to_abort);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
int r; int r;
DB_ENV *env; DB_ENV *env;
r = db_env_create(&env, 0); assert(r == 0); r = db_env_create(&env, 0); assert(r == 0);
r = env->set_data_dir(env, DIR); r = env->set_data_dir(env, ENVDIR);
r = env->set_lg_dir(env, DIR); r = env->set_lg_dir(env, ENVDIR);
r = env->open(env, 0, DB_INIT_MPOOL + DB_INIT_LOG + DB_INIT_LOCK + DB_INIT_TXN + DB_PRIVATE + DB_CREATE, 0777); r = env->open(env, 0, DB_INIT_MPOOL + DB_INIT_LOG + DB_INIT_LOCK + DB_INIT_TXN + DB_PRIVATE + DB_CREATE, 0777);
if (r != 0) printf("%s:%d:%d:%s\n", __FILE__, __LINE__, r, db_strerror(r)); if (r != 0) printf("%s:%d:%d:%s\n", __FILE__, __LINE__, r, db_strerror(r));
assert(r == 0); assert(r == 0);
......
...@@ -9,13 +9,13 @@ int main(int argc, char *argv[]) { ...@@ -9,13 +9,13 @@ int main(int argc, char *argv[]) {
int r; int r;
DB_ENV *env; DB_ENV *env;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
r = db_env_create(&env, 0); r = db_env_create(&env, 0);
assert(r == 0); assert(r == 0);
r = env->open(env, DIR, DB_INIT_MPOOL + DB_INIT_LOG + DB_INIT_TXN + DB_PRIVATE + DB_CREATE, 0777); r = env->open(env, ENVDIR, DB_INIT_MPOOL + DB_INIT_LOG + DB_INIT_TXN + DB_PRIVATE + DB_CREATE, 0777);
assert(r == 0); assert(r == 0);
DB_TXN *txn; DB_TXN *txn;
......
...@@ -43,7 +43,7 @@ void test_cursor_nonleaf_expand(int n, int reverse) { ...@@ -43,7 +43,7 @@ void test_cursor_nonleaf_expand(int n, int reverse) {
DB_ENV * const null_env = 0; DB_ENV * const null_env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test.insert.brt"; const char * const fname = ENVDIR "/" "test.insert.brt";
int r; int r;
// unlink(fname); // unlink(fname);
...@@ -80,8 +80,8 @@ void test_cursor_nonleaf_expand(int n, int reverse) { ...@@ -80,8 +80,8 @@ void test_cursor_nonleaf_expand(int n, int reverse) {
int main(int argc, const char *argv[]) { int main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
int r=mkdir(DIR, 0777); assert(r==0); int r=mkdir(ENVDIR, 0777); assert(r==0);
int i; int i;
for (i=1; i<=65536; i *= 2) { for (i=1; i<=65536; i *= 2) {
......
...@@ -14,11 +14,11 @@ void test_autotxn(u_int32_t env_flags, u_int32_t db_flags) { ...@@ -14,11 +14,11 @@ void test_autotxn(u_int32_t env_flags, u_int32_t db_flags) {
DB_ENV *env; DB_ENV *env;
DB *db; DB *db;
int r; int r;
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
r = db_env_create (&env, 0); CKERR(r); r = db_env_create (&env, 0); CKERR(r);
r = env->set_flags(env, env_flags, 1); CKERR(r); r = env->set_flags(env, env_flags, 1); CKERR(r);
r = env->open(env, DIR, r = env->open(env, ENVDIR,
DB_CREATE | DB_PRIVATE | DB_INIT_MPOOL | DB_CREATE | DB_PRIVATE | DB_INIT_MPOOL |
DB_INIT_LOG | DB_INIT_TXN | DB_INIT_LOCK, 0777); CKERR(r); DB_INIT_LOG | DB_INIT_TXN | DB_INIT_LOCK, 0777); CKERR(r);
r = db_create(&db, env, 0); r = db_create(&db, env, 0);
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
#include <db.h> #include <db.h>
#include "test.h" #include "test.h"
#ifndef DIR #ifndef ENVDIR
#define DIR "./test.dir" #define ENVDIR "./test.dir"
#endif #endif
void walk(DB *db) { void walk(DB *db) {
...@@ -47,8 +47,8 @@ void test_insert_zero_length(int n, int dup_mode, const char *dbname) { ...@@ -47,8 +47,8 @@ void test_insert_zero_length(int n, int dup_mode, const char *dbname) {
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
int r; int r;
char fname[strlen(DIR) + strlen("/") + strlen(dbname) + 1]; char fname[strlen(ENVDIR) + strlen("/") + strlen(dbname) + 1];
sprintf(fname, "%s/%s", DIR, dbname); sprintf(fname, "%s/%s", ENVDIR, dbname);
unlink(fname); unlink(fname);
...@@ -103,8 +103,8 @@ void test_insert_zero_length_keys(int n, int dup_mode, const char *dbname) { ...@@ -103,8 +103,8 @@ void test_insert_zero_length_keys(int n, int dup_mode, const char *dbname) {
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
int r; int r;
char fname[strlen(DIR) + strlen("/") + strlen(dbname) + 1]; char fname[strlen(ENVDIR) + strlen("/") + strlen(dbname) + 1];
sprintf(fname, "%s/%s", DIR, dbname); sprintf(fname, "%s/%s", ENVDIR, dbname);
unlink(fname); unlink(fname);
...@@ -136,8 +136,8 @@ int main(int argc, const char *argv[]) { ...@@ -136,8 +136,8 @@ int main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " DIR); system("rm -rf " ENVDIR);
mkdir(DIR, 0777); mkdir(ENVDIR, 0777);
test_insert_zero_length(32, 0, "test0"); test_insert_zero_length(32, 0, "test0");
test_insert_zero_length_keys(32, 0, "test0keys"); test_insert_zero_length_keys(32, 0, "test0keys");
......
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