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