Commit 1064ced5 authored by Yoni Fogel's avatar Yoni Fogel

Addresses #1338

src tests now call toku_ydb_init/destroy (if in windows)
Linux uses .so constructor/destructor methods

git-svn-id: file:///svn/toku/tokudb.1032b@8398 c7de825b-a66e-492c-adef-691d508d4ae1
parent 3663cbb8
...@@ -105,7 +105,8 @@ test_shutdown (void) { ...@@ -105,7 +105,8 @@ test_shutdown (void) {
r=env->close(env, 0); CKERR(r); r=env->close(env, 0); CKERR(r);
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
setup(); setup();
test_abort_abort(); test_abort_abort();
......
...@@ -105,7 +105,8 @@ test_shutdown (void) { ...@@ -105,7 +105,8 @@ test_shutdown (void) {
r=env->close(env, 0); CKERR(r); r=env->close(env, 0); CKERR(r);
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
setup(); setup();
test_abort_commit(); test_abort_commit();
......
...@@ -101,7 +101,8 @@ test_shutdown (void) { ...@@ -101,7 +101,8 @@ test_shutdown (void) {
r=env->close(env, 0); CKERR(r); r=env->close(env, 0); CKERR(r);
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
setup(); setup();
test_commit_abort(); test_commit_abort();
......
...@@ -101,7 +101,8 @@ test_shutdown (void) { ...@@ -101,7 +101,8 @@ test_shutdown (void) {
r=env->close(env, 0); CKERR(r); r=env->close(env, 0); CKERR(r);
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
setup(); setup();
test_commit_commit(); test_commit_commit();
......
...@@ -62,7 +62,8 @@ do_627 (void) { ...@@ -62,7 +62,8 @@ do_627 (void) {
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
do_627(); do_627();
return 0; return 0;
......
...@@ -95,7 +95,8 @@ doit (BOOL committed_provdels) { ...@@ -95,7 +95,8 @@ doit (BOOL committed_provdels) {
r=txn->commit(txn, 0); CKERR(r); r=txn->commit(txn, 0); CKERR(r);
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
setup(); setup();
......
...@@ -59,7 +59,8 @@ doit (void) { ...@@ -59,7 +59,8 @@ doit (void) {
r=txn->commit(txn, 0); assert(r==0); r=txn->commit(txn, 0); assert(r==0);
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
test_setup(); test_setup();
......
...@@ -13,7 +13,8 @@ void *startb(void* ignore __attribute__((__unused__))) { ...@@ -13,7 +13,8 @@ void *startb(void* ignore __attribute__((__unused__))) {
return 0; return 0;
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
pthread_t a,b; pthread_t a,b;
{ int x_l = pthread_create(&a, NULL, starta, NULL); assert(x_l==0); } { int x_l = pthread_create(&a, NULL, starta, NULL); assert(x_l==0); }
......
...@@ -83,7 +83,8 @@ void *startb(void* ignore __attribute__((__unused__))) { ...@@ -83,7 +83,8 @@ void *startb(void* ignore __attribute__((__unused__))) {
return 0; return 0;
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
pthread_t a,b; pthread_t a,b;
initialize(); initialize();
......
...@@ -83,7 +83,8 @@ void *startb(void* ignore __attribute__((__unused__))) { ...@@ -83,7 +83,8 @@ void *startb(void* ignore __attribute__((__unused__))) {
return 0; return 0;
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
pthread_t a,b; pthread_t a,b;
initialize(); initialize();
......
...@@ -67,7 +67,8 @@ static void test (void) { ...@@ -67,7 +67,8 @@ static void test (void) {
r = env->close(env, 0); assert(r==0); r = env->close(env, 0); assert(r==0);
} }
int main (int argc , const char *argv[]) { int
test_main (int argc , const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
test(); test();
return 0; return 0;
......
...@@ -90,7 +90,8 @@ static void test (void) { ...@@ -90,7 +90,8 @@ static void test (void) {
r = env->close(env, 0); assert(r==0); r = env->close(env, 0); assert(r==0);
} }
int main (int argc , const char *argv[]) { int
test_main (int argc , const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
test(); test();
return 0; return 0;
......
...@@ -76,7 +76,8 @@ static void test (void) { ...@@ -76,7 +76,8 @@ static void test (void) {
r = env->close(env, 0); assert(r==0); r = env->close(env, 0); assert(r==0);
} }
int main (int argc , const char *argv[]) { int
test_main (int argc , const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
test(); test();
return 0; return 0;
......
...@@ -79,7 +79,8 @@ static void test (void) { ...@@ -79,7 +79,8 @@ static void test (void) {
r = env->close(env, 0); assert(r==0); r = env->close(env, 0); assert(r==0);
} }
int main (int argc , const char *argv[]) { int
test_main (int argc , const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
test(); test();
return 0; return 0;
......
...@@ -72,7 +72,8 @@ doit (void) { ...@@ -72,7 +72,8 @@ doit (void) {
printf("%lld insertions in %9.6fs, %9.3f ins/s \n", ninserts, diff, ninserts/diff); printf("%lld insertions in %9.6fs, %9.3f ins/s \n", ninserts, diff, ninserts/diff);
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
test_setup(); test_setup();
......
...@@ -110,7 +110,8 @@ test_shutdown (void) { ...@@ -110,7 +110,8 @@ test_shutdown (void) {
r=env->close(env, 0); CKERR(r); r=env->close(env, 0); CKERR(r);
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
test_setup(); test_setup();
test_commit_commit(); test_commit_commit();
......
...@@ -49,7 +49,8 @@ static void test (void) { ...@@ -49,7 +49,8 @@ static void test (void) {
r=env->close(env, 0); CKERR(r); r=env->close(env, 0); CKERR(r);
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
test(); test();
return 0; return 0;
} }
......
...@@ -66,7 +66,8 @@ static void test (void) { ...@@ -66,7 +66,8 @@ static void test (void) {
r=env->close(env, 0); CKERR(r); r=env->close(env, 0); CKERR(r);
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
test(); test();
return 0; return 0;
} }
......
...@@ -79,7 +79,8 @@ static void test (void) { ...@@ -79,7 +79,8 @@ static void test (void) {
r=env->close(env, 0); CKERR(r); r=env->close(env, 0); CKERR(r);
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
test(); test();
return 0; return 0;
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include <db.h> #include <db.h>
#include <assert.h> #include <assert.h>
#include <limits.h> #include <limits.h>
#include "ydb.h"
#ifndef DB_YESOVERWRITE #ifndef DB_YESOVERWRITE
#define DB_YESOVERWRITE 0 #define DB_YESOVERWRITE 0
#endif #endif
...@@ -101,3 +101,17 @@ typedef enum __toku_bool { FALSE=0, TRUE=1} BOOL; ...@@ -101,3 +101,17 @@ typedef enum __toku_bool { FALSE=0, TRUE=1} BOOL;
#define SET_TRACE_FILE(x) ((void)0) #define SET_TRACE_FILE(x) ((void)0)
#define CLOSE_TRACE_FILE(x) ((void)0) #define CLOSE_TRACE_FILE(x) ((void)0)
#endif #endif
int test_main (int argc, const char *argv[]);
int
main(int argc, const char *argv[]) {
#if defined(_WIN32) || defined(_WIN64)
toku_ydb_init();
#endif
int r = test_main(argc, argv);
#if defined(_WIN32) || defined(_WIN64)
toku_ydb_destroy();
#endif
return r;
}
...@@ -117,7 +117,8 @@ run (int choice) { ...@@ -117,7 +117,8 @@ run (int choice) {
#endif #endif
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " ENVDIR); system("rm -rf " ENVDIR);
......
...@@ -49,7 +49,8 @@ run (void) { ...@@ -49,7 +49,8 @@ run (void) {
} }
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " ENVDIR); system("rm -rf " ENVDIR);
......
...@@ -50,7 +50,8 @@ run (void) { ...@@ -50,7 +50,8 @@ run (void) {
} }
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " ENVDIR); system("rm -rf " ENVDIR);
......
...@@ -107,7 +107,8 @@ run (int choice) { ...@@ -107,7 +107,8 @@ run (int choice) {
#endif #endif
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " ENVDIR); system("rm -rf " ENVDIR);
......
...@@ -104,7 +104,8 @@ run (int choice) { ...@@ -104,7 +104,8 @@ run (int choice) {
#endif #endif
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " ENVDIR); system("rm -rf " ENVDIR);
......
...@@ -135,7 +135,8 @@ test_789(void) { ...@@ -135,7 +135,8 @@ test_789(void) {
r = env->close(env, 0); assert(r == 0); r = env->close(env, 0); assert(r == 0);
} }
int main(int UU(argc), char UU(*argv[])) { int
test_main(int UU(argc), const char UU(*argv[])) {
test_789(); test_789();
return 0; return 0;
} }
...@@ -77,7 +77,8 @@ testit (const int klen, const int vlen, const int n, const int lastvlen) { ...@@ -77,7 +77,8 @@ testit (const int klen, const int vlen, const int n, const int lastvlen) {
r = env->close(env, 0); assert(r == 0); r = env->close(env, 0); assert(r == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
const int meg = 1024*1024; const int meg = 1024*1024;
const int headeroverhead = 12*4; const int headeroverhead = 12*4;
......
...@@ -157,7 +157,8 @@ test_db_put_aborts (void) { ...@@ -157,7 +157,8 @@ test_db_put_aborts (void) {
r=env->close(env, 0); assert(r==0); r=env->close(env, 0); assert(r==0);
} }
int main (int UU(argc), char UU(*argv[])) { int
test_main (int UU(argc), const char UU(*argv[])) {
test_db_open_aborts(); test_db_open_aborts();
test_db_put_aborts(); test_db_put_aborts();
return 0; return 0;
......
...@@ -109,7 +109,8 @@ do_test_abort2 (void) { ...@@ -109,7 +109,8 @@ do_test_abort2 (void) {
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
do_test_abort2(); do_test_abort2();
return 0; return 0;
......
...@@ -159,7 +159,8 @@ test_abort3 (void) { ...@@ -159,7 +159,8 @@ test_abort3 (void) {
r=env->close(env, 0); CKERR(r); r=env->close(env, 0); CKERR(r);
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
test_abort3(); test_abort3();
return 0; return 0;
......
...@@ -124,7 +124,8 @@ do_abort_delete_first_or_last(int N, ...@@ -124,7 +124,8 @@ do_abort_delete_first_or_last(int N,
#endif #endif
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
int f; int f;
for (f=0; f<2; f++) { for (f=0; f<2; f++) {
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
DB_ENV *env; DB_ENV *env;
DB *db; DB *db;
......
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include "test.h" #include "test.h"
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
DB_ENV *env; DB_ENV *env;
DB *db; DB *db;
......
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include "test.h" #include "test.h"
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
DB_ENV *env; DB_ENV *env;
DB *db, *db2; DB *db, *db2;
......
...@@ -79,7 +79,8 @@ test_cachesize (void) { ...@@ -79,7 +79,8 @@ test_cachesize (void) {
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
test_cachesize(); test_cachesize();
......
...@@ -78,7 +78,8 @@ test_cursor (void) { ...@@ -78,7 +78,8 @@ test_cursor (void) {
r = env->close(env, 0); assert(r == 0); r = env->close(env, 0); assert(r == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
......
...@@ -90,7 +90,8 @@ test (void) { ...@@ -90,7 +90,8 @@ test (void) {
r = env->close(env, 0); assert(r == 0); r = env->close(env, 0); assert(r == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
......
...@@ -177,7 +177,8 @@ static void run_test(u_int32_t dup_flags) { ...@@ -177,7 +177,8 @@ static void run_test(u_int32_t dup_flags) {
/* ********************************************************************** */ /* ********************************************************************** */
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
......
...@@ -116,7 +116,8 @@ test_reopen (void) { ...@@ -116,7 +116,8 @@ test_reopen (void) {
r = db->close(db, 0); assert(r == 0); r = db->close(db, 0); assert(r == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " ENVDIR); system("rm -rf " ENVDIR);
......
...@@ -151,7 +151,8 @@ test_cursor_delete_dupsort (void) { ...@@ -151,7 +151,8 @@ test_cursor_delete_dupsort (void) {
r = db->close(db, 0); assert(r == 0); r = db->close(db, 0); assert(r == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
int r; int r;
parse_args(argc, argv); parse_args(argc, argv);
......
...@@ -60,7 +60,8 @@ test_cursor_delete2 (void) { ...@@ -60,7 +60,8 @@ test_cursor_delete2 (void) {
r = dbenv->close(dbenv, 0); CKERR(r); r = dbenv->close(dbenv, 0); CKERR(r);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
......
...@@ -62,7 +62,8 @@ test_cursor_delete2 (void) { ...@@ -62,7 +62,8 @@ test_cursor_delete2 (void) {
r = dbenv->close(dbenv, 0); CKERR(r); r = dbenv->close(dbenv, 0); CKERR(r);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
......
...@@ -68,7 +68,9 @@ cursor_range_with_delete (u_int32_t flag) { ...@@ -68,7 +68,9 @@ cursor_range_with_delete (u_int32_t flag) {
r = dbc->c_close(dbc); CKERR(r); r = dbc->c_close(dbc); CKERR(r);
} }
int main() { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv);
setup_db("next.db"); setup_db("next.db");
insert(); insert();
cursor_range_with_delete(DB_NEXT); cursor_range_with_delete(DB_NEXT);
......
...@@ -40,7 +40,8 @@ test_cursor_flags (int cursor_flags, int expectr) { ...@@ -40,7 +40,8 @@ test_cursor_flags (int cursor_flags, int expectr) {
r = db->close(db, 0); assert(r == 0); r = db->close(db, 0); assert(r == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
......
...@@ -88,7 +88,8 @@ test_cursor_nonleaf_expand (int n, int reverse) { ...@@ -88,7 +88,8 @@ test_cursor_nonleaf_expand (int n, int reverse) {
r = db->close(db, 0); assert(r == 0); r = db->close(db, 0); assert(r == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " ENVDIR); system("rm -rf " ENVDIR);
......
...@@ -171,7 +171,9 @@ test (u_int32_t dup_flags) { ...@@ -171,7 +171,9 @@ test (u_int32_t dup_flags) {
/* ********************************************************************** */ /* ********************************************************************** */
} }
int main() { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv);
test(0); test(0);
test(DB_DUP | DB_DUPSORT); test(DB_DUP | DB_DUPSORT);
return 0; return 0;
......
...@@ -76,7 +76,8 @@ test_cursor_sticky (int n, int dup_mode) { ...@@ -76,7 +76,8 @@ test_cursor_sticky (int n, int dup_mode) {
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
int r; int r;
int i; int i;
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include "test.h"
#include <stdlib.h> #include <stdlib.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <stdio.h> #include <stdio.h>
...@@ -12,9 +14,9 @@ ...@@ -12,9 +14,9 @@
// ENVDIR 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
test_main(int argc, const char *argv[]) {
int main() { parse_args(argc, argv);
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;
......
...@@ -510,7 +510,8 @@ maybe_parse_intarg (const char *progname, const char *arg, const char *cmdname, ...@@ -510,7 +510,8 @@ maybe_parse_intarg (const char *progname, const char *arg, const char *cmdname,
} }
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
const char *progname=argv[0]; const char *progname=argv[0];
int useseed; int useseed;
int activity_count = 100000; int activity_count = 100000;
......
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
DB_ENV *env; DB_ENV *env;
DB *db; DB *db;
int main (int UU(argc), char UU(*argv[])) { int
test_main (int UU(argc), const char UU(*argv[])) {
int r; int r;
system("rm -rf " ENVDIR); system("rm -rf " ENVDIR);
r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0); r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0);
......
...@@ -17,7 +17,8 @@ DB_ENV *env; ...@@ -17,7 +17,8 @@ DB_ENV *env;
DB *db; DB *db;
DB_TXN* null_txn = NULL; DB_TXN* null_txn = NULL;
int main (int UU(argc), char UU(*argv[])) { int
test_main (int UU(argc), const char UU(*argv[])) {
int r; int r;
system("rm -rf " ENVDIR); system("rm -rf " ENVDIR);
r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
......
...@@ -481,7 +481,8 @@ usage (const char *argv1) { ...@@ -481,7 +481,8 @@ usage (const char *argv1) {
exit(1); exit(1);
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
const char *progname=argv[0]; const char *progname=argv[0];
int useseed; int useseed;
......
...@@ -299,7 +299,8 @@ static void usage (const char *argv1) { ...@@ -299,7 +299,8 @@ static void usage (const char *argv1) {
exit(1); exit(1);
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
const char *progname=argv[0]; const char *progname=argv[0];
int useseed = 1; int useseed = 1;
......
...@@ -136,7 +136,8 @@ close_dbs(void) { ...@@ -136,7 +136,8 @@ close_dbs(void) {
r = sdb->close(sdb, 0); CKERR(r); r = sdb->close(sdb, 0); CKERR(r);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
int i; int i;
parse_args(argc, argv); parse_args(argc, argv);
......
...@@ -269,7 +269,8 @@ cursor_setup (DBC* dbc, u_int32_t flag) { ...@@ -269,7 +269,8 @@ cursor_setup (DBC* dbc, u_int32_t flag) {
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
int i; int i;
int r; int r;
DBC* dbc; DBC* dbc;
......
...@@ -57,7 +57,8 @@ close_dbs (void) { ...@@ -57,7 +57,8 @@ close_dbs (void) {
r = db->close(db, 0); CKERR(r); r = db->close(db, 0); CKERR(r);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
int i; int i;
int r; int r;
......
...@@ -162,7 +162,8 @@ test_db_delboth (int n, int dup_mode) { ...@@ -162,7 +162,8 @@ test_db_delboth (int n, int dup_mode) {
} }
#endif //USE_TDB #endif //USE_TDB
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
......
...@@ -135,7 +135,8 @@ test_db_get_datasize0 (void) { ...@@ -135,7 +135,8 @@ test_db_get_datasize0 (void) {
assert(r == 0); assert(r == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
test_db_get_datasize0(); test_db_get_datasize0();
......
...@@ -124,7 +124,8 @@ close_dbs (void) { ...@@ -124,7 +124,8 @@ close_dbs (void) {
r = sdb->close(sdb, 0); CKERR(r); r = sdb->close(sdb, 0); CKERR(r);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
int i; int i;
parse_args(argc, argv); parse_args(argc, argv);
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include "test.h"
#include <stdio.h> #include <stdio.h>
#include <assert.h> #include <assert.h>
#include <toku_portability.h> #include <toku_portability.h>
#include <db.h> #include <db.h>
int main() { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv);
DB_ENV *dbenv; DB_ENV *dbenv;
int r; int r;
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include "test.h"
// make stdlib define unsetenv() // make stdlib define unsetenv()
#ifndef _GNU_SOURCE #ifndef _GNU_SOURCE
#define _GNU_SOURCE #define _GNU_SOURCE
...@@ -63,7 +65,9 @@ reinit_config (int set_home, int set_DB_ENVIRON, int set_DB_HOME) { ...@@ -63,7 +65,9 @@ reinit_config (int set_home, int set_DB_ENVIRON, int set_DB_HOME) {
} }
int main() { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv);
DB_ENV *env; DB_ENV *env;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
DB *db; DB *db;
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include "test.h"
// Try to open an environment where the directory does not exist // Try to open an environment where the directory does not exist
// Try when the dir exists but is not an initialized env // Try when the dir exists but is not an initialized env
// Try when the dir exists and we do DB_CREATE: it should work. // Try when the dir exists and we do DB_CREATE: it should work.
...@@ -20,9 +22,10 @@ ...@@ -20,9 +22,10 @@
#include <unistd.h> #include <unistd.h>
// ENVDIR 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
test_main(int argc, const char *argv[]) {
parse_args(argc, argv);
DB_ENV *dbenv; DB_ENV *dbenv;
int r; int r;
int do_private; int do_private;
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include "test.h"
#include <stdio.h> #include <stdio.h>
#include <assert.h> #include <assert.h>
#include <toku_portability.h> #include <toku_portability.h>
...@@ -12,12 +14,10 @@ ...@@ -12,12 +14,10 @@
// ENVDIR 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
test_main(int argc, const char** argv) {
int main(int argc, char** argv) {
DB_ENV *dbenv; DB_ENV *dbenv;
int r; int r;
int __attribute__((__unused__)) verbose = 0;
if (argc == 2 && !strcmp(argv[1], "-v")) verbose = 1; if (argc == 2 && !strcmp(argv[1], "-v")) verbose = 1;
system("rm -rf " ENVDIR); system("rm -rf " ENVDIR);
......
...@@ -13,7 +13,9 @@ ...@@ -13,7 +13,9 @@
// ENVDIR is defined in the Makefile // ENVDIR is defined in the Makefile
int main() { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv);
DB_ENV *dbenv; DB_ENV *dbenv;
int r; int r;
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include "test.h"
#include <stdio.h> #include <stdio.h>
#include <assert.h> #include <assert.h>
#include <toku_portability.h> #include <toku_portability.h>
...@@ -11,7 +13,9 @@ ...@@ -11,7 +13,9 @@
// ENVDIR is defined in the Makefile // ENVDIR is defined in the Makefile
int main() { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv);
DB_ENV *dbenv; DB_ENV *dbenv;
int r; int r;
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include "test.h"
#include <stdio.h> #include <stdio.h>
#include <assert.h> #include <assert.h>
#include <toku_portability.h> #include <toku_portability.h>
...@@ -10,11 +12,11 @@ ...@@ -10,11 +12,11 @@
#include <sys/types.h> #include <sys/types.h>
#include <errno.h> #include <errno.h>
#define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0);
// ENVDIR is defined in the Makefile // ENVDIR is defined in the Makefile
int main() { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv);
DB_ENV *dbenv; DB_ENV *dbenv;
int r; int r;
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include "test.h"
#include <stdio.h> #include <stdio.h>
#include <assert.h> #include <assert.h>
#include <toku_portability.h> #include <toku_portability.h>
...@@ -10,11 +12,11 @@ ...@@ -10,11 +12,11 @@
#include <sys/types.h> #include <sys/types.h>
#include <errno.h> #include <errno.h>
#define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0);
// ENVDIR is defined in the Makefile // ENVDIR is defined in the Makefile
int main() { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv);
DB_ENV *dbenv; DB_ENV *dbenv;
int r; int r;
......
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
DB_ENV *env; DB_ENV *env;
DB *db; DB *db;
int main (int UU(argc), char UU(*argv[])) { int
test_main (int UU(argc), const char UU(*argv[])) {
int r; int r;
r=system("rm -rf " ENVDIR); assert(r==0); r=system("rm -rf " ENVDIR); assert(r==0);
r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0); r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0);
......
...@@ -239,7 +239,8 @@ setup_secondary (u_int32_t flags) { ...@@ -239,7 +239,8 @@ setup_secondary (u_int32_t flags) {
r = dbp->associate(dbp, NULL, sdbp, identity_callback, 0); CKERR(r); r = dbp->associate(dbp, NULL, sdbp, identity_callback, 0); CKERR(r);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
int i; int i;
parse_args(argc, argv); parse_args(argc, argv);
......
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,8 @@
#include "test.h" #include "test.h"
int main (int UU(argc), char UU(*argv[])) { int
test_main (int UU(argc), const char UU(*argv[])) {
DB *db; DB *db;
int r; int r;
r = db_create(&db, 0, 0); r = db_create(&db, 0, 0);
......
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
DB_ENV *env; DB_ENV *env;
DB *db; DB *db;
int main (int UU(argc), char UU(*argv[])) { int
test_main (int UU(argc), const char UU(*argv[])) {
int r; int r;
system("rm -rf " ENVDIR); system("rm -rf " ENVDIR);
r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0); r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0);
......
...@@ -19,7 +19,8 @@ DB *db; ...@@ -19,7 +19,8 @@ DB *db;
DBT key; DBT key;
DBT data; DBT data;
int main (int UU(argc), char UU(*argv[])) { int
test_main (int UU(argc), const char UU(*argv[])) {
int r; int r;
system("rm -rf " ENVDIR); system("rm -rf " ENVDIR);
r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0); r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0);
......
...@@ -19,7 +19,8 @@ DB *db; ...@@ -19,7 +19,8 @@ DB *db;
DBT key; DBT key;
DBT data; DBT data;
int main (int UU(argc), char UU(*argv[])) { int
test_main (int UU(argc), const char UU(*argv[])) {
int r; int r;
system("rm -rf " ENVDIR); system("rm -rf " ENVDIR);
r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0); r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0);
......
...@@ -188,7 +188,9 @@ verify_gone (void) { ...@@ -188,7 +188,9 @@ verify_gone (void) {
r = sdbp->pget(sdbp, null_txn, &skey, &key, &data, 0);assert(r == DB_NOTFOUND); r = sdbp->pget(sdbp, null_txn, &skey, &key, &data, 0);assert(r == DB_NOTFOUND);
} }
int main() { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv);
int r; int r;
system("rm -rf " ENVDIR); system("rm -rf " ENVDIR);
......
...@@ -33,7 +33,8 @@ test_db_set_flags (int flags, int expectr, int flags2, int expectr2) { ...@@ -33,7 +33,8 @@ test_db_set_flags (int flags, int expectr, int flags2, int expectr2) {
r = db->close(db, 0); assert(r == 0); r = db->close(db, 0); assert(r == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include "test.h"
#include <stdlib.h> #include <stdlib.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <stdio.h> #include <stdio.h>
...@@ -11,9 +13,9 @@ ...@@ -11,9 +13,9 @@
// ENVDIR 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
test_main(int argc, const char *argv[]) {
int main() { parse_args(argc, argv);
DB_ENV * env = 0; DB_ENV * env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include "test.h"
#include <stdlib.h> #include <stdlib.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <stdio.h> #include <stdio.h>
...@@ -11,9 +13,9 @@ ...@@ -11,9 +13,9 @@
// ENVDIR 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
test_main(int argc, const char *argv[]) {
int main() { parse_args(argc, argv);
DB_ENV * env = 0; DB_ENV * env = 0;
DB *db; DB *db;
DB_TXN * const null_txn = 0; DB_TXN * const null_txn = 0;
......
...@@ -873,7 +873,8 @@ test (u_int32_t dup_flags) { ...@@ -873,7 +873,8 @@ test (u_int32_t dup_flags) {
} }
int main(int argc, const char* argv[]) { int
test_main(int argc, const char* argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
if (!IS_TDB) { if (!IS_TDB) {
if (verbose) { if (verbose) {
......
...@@ -216,7 +216,8 @@ test (u_int32_t dup_flags) { ...@@ -216,7 +216,8 @@ test (u_int32_t dup_flags) {
} }
int main(int argc, const char* argv[]) { int
test_main(int argc, const char* argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
test(0); test(0);
test(DB_DUP | DB_DUPSORT); test(DB_DUP | DB_DUPSORT);
......
...@@ -7,15 +7,11 @@ ...@@ -7,15 +7,11 @@
#include "test.h" #include "test.h"
int main (int argc, char *argv[]) { int
test_main (int argc, const char *argv[]) {
const char *v; const char *v;
int major, minor, patch; int major, minor, patch;
int i; parse_args(argc, argv);
for (i=1; i<argc; i++) {
char *arg = argv[i];
if (strcmp(arg, "-v") == 0)
verbose++;
}
v = db_version(0, 0, 0); v = db_version(0, 0, 0);
assert(v!=0); assert(v!=0);
v = db_version(&major, &minor, &patch); v = db_version(&major, &minor, &patch);
......
...@@ -717,7 +717,8 @@ test_i0i1ci0_search (int n, int dup_mode) { ...@@ -717,7 +717,8 @@ test_i0i1ci0_search (int n, int dup_mode) {
assert(r == 0); assert(r == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
int i; int i;
parse_args(argc, argv); parse_args(argc, argv);
......
...@@ -218,7 +218,8 @@ test_put_00_01_01 (int dup_mode, u_int32_t put_flags) { ...@@ -218,7 +218,8 @@ test_put_00_01_01 (int dup_mode, u_int32_t put_flags) {
r = db->close(db, 0); assert(r == 0); r = db->close(db, 0); assert(r == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
int yes_overwrite=0; int yes_overwrite=0;
if (IS_TDB) if (IS_TDB)
......
...@@ -68,7 +68,8 @@ test_dup_flags (u_int32_t dup_flags) { ...@@ -68,7 +68,8 @@ test_dup_flags (u_int32_t dup_flags) {
r = db->close(db, 0); assert(r == 0); r = db->close(db, 0); assert(r == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
......
...@@ -249,7 +249,8 @@ test_nonleaf_insert (int n, int dup_mode) { ...@@ -249,7 +249,8 @@ test_nonleaf_insert (int n, int dup_mode) {
assert(r == 0); assert(r == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
int i; int i;
parse_args(argc, argv); parse_args(argc, argv);
......
...@@ -118,7 +118,8 @@ test_dup_next (int n, int dup_mode) { ...@@ -118,7 +118,8 @@ test_dup_next (int n, int dup_mode) {
r = db->close(db, 0); assert(r == 0); r = db->close(db, 0); assert(r == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
int i; int i;
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
const char *arg = argv[i]; const char *arg = argv[i];
......
...@@ -320,7 +320,8 @@ test_reverse_search (int n, int dup_mode) { ...@@ -320,7 +320,8 @@ test_reverse_search (int n, int dup_mode) {
assert(r == 0); assert(r == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
int i; int i;
parse_args(argc, argv); parse_args(argc, argv);
......
...@@ -99,7 +99,8 @@ test_dupsort_del (void) { ...@@ -99,7 +99,8 @@ test_dupsort_del (void) {
r=env->close(env, 0); CKERR(r); r=env->close(env, 0); CKERR(r);
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
test_dupsort_del(); test_dupsort_del();
return 0; return 0;
......
...@@ -106,7 +106,8 @@ test_abort3 (void) { ...@@ -106,7 +106,8 @@ test_abort3 (void) {
r=env->close(env, 0); CKERR(r); r=env->close(env, 0); CKERR(r);
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
test_abort3(); test_abort3();
return 0; return 0;
......
...@@ -96,7 +96,8 @@ test_dupsort_delete (int n) { ...@@ -96,7 +96,8 @@ test_dupsort_delete (int n) {
r = db->close(db, 0); assert(r == 0); r = db->close(db, 0); assert(r == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
int i; int i;
parse_args(argc, argv); parse_args(argc, argv);
......
...@@ -118,7 +118,8 @@ test_dupsort_get (int n, int dup_mode) { ...@@ -118,7 +118,8 @@ test_dupsort_get (int n, int dup_mode) {
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
int i; int i;
parse_args(argc, argv); parse_args(argc, argv);
......
...@@ -143,7 +143,8 @@ test_icdi_search (int n, int dup_mode) { ...@@ -143,7 +143,8 @@ test_icdi_search (int n, int dup_mode) {
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
int i; int i;
parse_args(argc, argv); parse_args(argc, argv);
......
...@@ -149,7 +149,8 @@ test_icdi_search (int n, int dup_mode) { ...@@ -149,7 +149,8 @@ test_icdi_search (int n, int dup_mode) {
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
int i; int i;
parse_args(argc, argv); parse_args(argc, argv);
......
...@@ -144,7 +144,8 @@ test_icdi_search (int n, int dup_mode) { ...@@ -144,7 +144,8 @@ test_icdi_search (int n, int dup_mode) {
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
int i; int i;
parse_args(argc, argv); parse_args(argc, argv);
......
...@@ -151,7 +151,8 @@ test_icdi_search (int n, int dup_mode) { ...@@ -151,7 +151,8 @@ test_icdi_search (int n, int dup_mode) {
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
int i; int i;
parse_args(argc, argv); parse_args(argc, argv);
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include "test.h"
#include <assert.h> #include <assert.h>
#include <toku_portability.h> #include <toku_portability.h>
#include <db.h> #include <db.h>
...@@ -12,9 +14,8 @@ ...@@ -12,9 +14,8 @@
// ENVDIR 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
test_main (int argc __attribute__((__unused__)), const 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 " ENVDIR); system("rm -rf " ENVDIR);
......
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,8 @@
#include "test.h" #include "test.h"
int main (int UU(argc), char UU(*argv[])) { int
test_main (int UU(argc), const char UU(*argv[])) {
DB_ENV *env; DB_ENV *env;
DB *db; DB *db;
int r; int r;
......
...@@ -31,7 +31,8 @@ test_env_open_flags (int env_open_flags, int expectr) { ...@@ -31,7 +31,8 @@ test_env_open_flags (int env_open_flags, int expectr) {
assert(r == 0); assert(r == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
......
...@@ -13,7 +13,8 @@ handle_error (const DB_ENV *UU(dbenv), const char *errpfx, const char *UU(msg)) ...@@ -13,7 +13,8 @@ handle_error (const DB_ENV *UU(dbenv), const char *errpfx, const char *UU(msg))
assert(errpfx==expect_errpfx); assert(errpfx==expect_errpfx);
n_handle_error++; n_handle_error++;
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
#if defined(OSX) #if defined(OSX)
......
#include <stdio.h> #include <stdio.h>
#include <assert.h> #include <assert.h>
#include "test.h"
#include <toku_pthread.h> #include <toku_pthread.h>
static void * static void *
...@@ -8,7 +10,9 @@ f (void *arg) { ...@@ -8,7 +10,9 @@ f (void *arg) {
return arg; return arg;
} }
int main() { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv);
toku_pthread_t t; toku_pthread_t t;
int r = toku_pthread_create(&t, 0, f, 0); assert(r == 0); int r = toku_pthread_create(&t, 0, f, 0); assert(r == 0);
void *ret; void *ret;
......
...@@ -102,7 +102,8 @@ static void test_get_both(int n, int dup_mode, int op) { ...@@ -102,7 +102,8 @@ static void test_get_both(int n, int dup_mode, int op) {
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
unsigned long doi=0; unsigned long doi=0;
int i; int i;
char flags = 0; char flags = 0;
......
...@@ -31,7 +31,8 @@ test_get (int dup_mode) { ...@@ -31,7 +31,8 @@ test_get (int dup_mode) {
r = db->close(db, 0); r = db->close(db, 0);
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " ENVDIR); system("rm -rf " ENVDIR);
toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO);
......
...@@ -98,7 +98,8 @@ printtdiff (char *str) { ...@@ -98,7 +98,8 @@ printtdiff (char *str) {
prev_count=fcount; prev_count=fcount;
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
progname=argv[0]; progname=argv[0];
parse_args(argc, argv); parse_args(argc, argv);
......
...@@ -93,7 +93,8 @@ printtdiff (char *str) { ...@@ -93,7 +93,8 @@ printtdiff (char *str) {
if (verbose) printf("%10.6f %s\n", thistime.tv_sec-prevtime.tv_sec+1e-6*(thistime.tv_usec-prevtime.tv_usec), str); if (verbose) printf("%10.6f %s\n", thistime.tv_sec-prevtime.tv_sec+1e-6*(thistime.tv_usec-prevtime.tv_usec), str);
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " ENVDIR); system("rm -rf " ENVDIR);
......
...@@ -109,7 +109,8 @@ test_hsoc (int pagesize, int dup_mode) { ...@@ -109,7 +109,8 @@ test_hsoc (int pagesize, int dup_mode) {
r = db->close(db, 0); assert(r == 0); r = db->close(db, 0); assert(r == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
test_hsoc(4096, DB_DUP + DB_DUPSORT); test_hsoc(4096, DB_DUP + DB_DUPSORT);
......
...@@ -63,7 +63,8 @@ test_insert_delete_insert (int dup_mode) { ...@@ -63,7 +63,8 @@ test_insert_delete_insert (int dup_mode) {
r = db->close(db, 0); assert(r == 0); r = db->close(db, 0); assert(r == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
......
...@@ -44,7 +44,8 @@ test_insert (int n, int dup_mode) { ...@@ -44,7 +44,8 @@ test_insert (int n, int dup_mode) {
assert(r == 0); assert(r == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " ENVDIR); system("rm -rf " ENVDIR);
......
...@@ -126,7 +126,8 @@ test_data_size_limit (int dup_mode) { ...@@ -126,7 +126,8 @@ test_data_size_limit (int dup_mode) {
assert(r == 0); assert(r == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
int i; int i;
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
const char *arg = argv[i]; const char *arg = argv[i];
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
DB_ENV *env; DB_ENV *env;
int main (int UU(argc), char UU(*argv[])) { int
test_main (int UU(argc), const char UU(*argv[])) {
int r; int r;
system("rm -rf " ENVDIR); system("rm -rf " ENVDIR);
r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0); r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0);
......
...@@ -20,7 +20,8 @@ DB_ENV *env; ...@@ -20,7 +20,8 @@ DB_ENV *env;
DB *db; DB *db;
DB_TXN *tid; DB_TXN *tid;
int main (int UU(argc), char UU(*argv[])) { int
test_main (int UU(argc), const char UU(*argv[])) {
int r; int r;
system("rm -rf " ENVDIR); system("rm -rf " ENVDIR);
r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0); r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0);
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include "test.h"
/* Test to see if we can do logging and recovery. */ /* Test to see if we can do logging and recovery. */
/* This is very specific to TokuDB. It won't work with Berkeley DB. */ /* This is very specific to TokuDB. It won't work with Berkeley DB. */
/* This test_log10 inserts to a db, closes, reopens, and inserts more to db. We want to make sure that the recovery of the buffers works. */ /* This test_log10 inserts to a db, closes, reopens, and inserts more to db. We want to make sure that the recovery of the buffers works. */
...@@ -16,8 +18,6 @@ ...@@ -16,8 +18,6 @@
// ENVDIR 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);
struct in_db; struct in_db;
struct in_db { struct in_db {
long int r; long int r;
...@@ -101,7 +101,8 @@ static void make_db (void) { ...@@ -101,7 +101,8 @@ static void make_db (void) {
} }
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
make_db(); make_db();
return 0; return 0;
} }
...@@ -21,7 +21,8 @@ DB_ENV *env; ...@@ -21,7 +21,8 @@ DB_ENV *env;
DB *db; DB *db;
DB_TXN *tid; DB_TXN *tid;
int main (int UU(argc), char UU(*argv[])) { int
test_main (int UU(argc), const char UU(*argv[])) {
int r; int r;
system("rm -rf " ENVDIR); system("rm -rf " ENVDIR);
r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0); r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0);
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include "test.h"
/* Test to see if we can do logging and recovery. */ /* Test to see if we can do logging and recovery. */
/* This is very specific to TokuDB. It won't work with Berkeley DB. */ /* This is very specific to TokuDB. It won't work with Berkeley DB. */
...@@ -13,8 +15,6 @@ ...@@ -13,8 +15,6 @@
// ENVDIR 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);
static void make_db (void) { static void make_db (void) {
DB_ENV *env; DB_ENV *env;
DB *db; DB *db;
...@@ -34,7 +34,8 @@ static void make_db (void) { ...@@ -34,7 +34,8 @@ static void make_db (void) {
r=env->close(env, 0); assert(r==0); r=env->close(env, 0); assert(r==0);
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
make_db(); make_db();
return 0; return 0;
} }
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include "test.h"
/* Like test_log2 except abort. */ /* Like test_log2 except abort. */
/* This is very specific to TokuDB. It won't work with Berkeley DB. */ /* This is very specific to TokuDB. It won't work with Berkeley DB. */
...@@ -13,8 +15,6 @@ ...@@ -13,8 +15,6 @@
// ENVDIR 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);
static void make_db (void) { static void make_db (void) {
DB_ENV *env; DB_ENV *env;
DB *db; DB *db;
...@@ -34,7 +34,8 @@ static void make_db (void) { ...@@ -34,7 +34,8 @@ static void make_db (void) {
r=env->close(env, 0); assert(r==0); r=env->close(env, 0); assert(r==0);
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
make_db(); make_db();
return 0; return 0;
} }
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include "test.h"
/* Test to see if we can do logging and recovery. */ /* Test to see if we can do logging and recovery. */
/* This is very specific to TokuDB. It won't work with Berkeley DB. */ /* This is very specific to TokuDB. It won't work with Berkeley DB. */
...@@ -14,8 +16,6 @@ ...@@ -14,8 +16,6 @@
// ENVDIR 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);
static void make_db (void) { static void make_db (void) {
DB_ENV *env; DB_ENV *env;
DB *db; DB *db;
...@@ -44,7 +44,8 @@ static void make_db (void) { ...@@ -44,7 +44,8 @@ static void make_db (void) {
r=env->close(env, 0); assert(r==0); r=env->close(env, 0); assert(r==0);
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
make_db(); make_db();
return 0; return 0;
} }
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include "test.h"
/* Like test_log3 except do abort */ /* Like test_log3 except do abort */
#include <assert.h> #include <assert.h>
...@@ -13,8 +15,6 @@ ...@@ -13,8 +15,6 @@
// ENVDIR 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);
static void make_db (void) { static void make_db (void) {
DB_ENV *env; DB_ENV *env;
DB *db; DB *db;
...@@ -54,7 +54,8 @@ static void make_db (void) { ...@@ -54,7 +54,8 @@ static void make_db (void) {
r=env->close(env, 0); assert(r==0); r=env->close(env, 0); assert(r==0);
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
make_db(); make_db();
return 0; return 0;
} }
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include "test.h"
/* Test to see if we can do logging and recovery. */ /* Test to see if we can do logging and recovery. */
/* This is very specific to TokuDB. It won't work with Berkeley DB. */ /* This is very specific to TokuDB. It won't work with Berkeley DB. */
...@@ -14,8 +16,6 @@ ...@@ -14,8 +16,6 @@
// ENVDIR 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);
static void make_db (void) { static void make_db (void) {
DB_ENV *env; DB_ENV *env;
DB *db; DB *db;
...@@ -50,7 +50,8 @@ static void make_db (void) { ...@@ -50,7 +50,8 @@ static void make_db (void) {
r=env->close(env, 0); assert(r==0); r=env->close(env, 0); assert(r==0);
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
make_db(); make_db();
return 0; return 0;
} }
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include "test.h"
/* Like test_log4, except abort */ /* Like test_log4, except abort */
#include <assert.h> #include <assert.h>
...@@ -13,8 +15,6 @@ ...@@ -13,8 +15,6 @@
// ENVDIR 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 N 20000 #define N 20000
long random_nums[N]; long random_nums[N];
...@@ -62,7 +62,8 @@ static void make_db (void) { ...@@ -62,7 +62,8 @@ static void make_db (void) {
r=env->close(env, 0); assert(r==0); r=env->close(env, 0); assert(r==0);
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
make_db(); make_db();
return 0; return 0;
} }
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include "test.h"
/* Test to see if we can do logging and recovery. */ /* Test to see if we can do logging and recovery. */
/* This is very specific to TokuDB. It won't work with Berkeley DB. */ /* This is very specific to TokuDB. It won't work with Berkeley DB. */
...@@ -14,8 +16,6 @@ ...@@ -14,8 +16,6 @@
// ENVDIR 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);
struct in_db; struct in_db;
struct in_db { struct in_db {
long int r; long int r;
...@@ -69,7 +69,8 @@ static void make_db (void) { ...@@ -69,7 +69,8 @@ static void make_db (void) {
} }
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
make_db(); make_db();
return 0; return 0;
} }
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include "test.h"
/* Like test_log5 except abort. */ /* Like test_log5 except abort. */
#include <assert.h> #include <assert.h>
...@@ -13,8 +15,6 @@ ...@@ -13,8 +15,6 @@
// ENVDIR 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);
struct in_db; struct in_db;
struct in_db { struct in_db {
long int r; long int r;
...@@ -81,7 +81,8 @@ static void make_db (void) { ...@@ -81,7 +81,8 @@ static void make_db (void) {
} }
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
make_db(); make_db();
return 0; return 0;
} }
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include "test.h"
/* Test to see if we can do logging and recovery. */ /* Test to see if we can do logging and recovery. */
/* This is very specific to TokuDB. It won't work with Berkeley DB. */ /* This is very specific to TokuDB. It won't work with Berkeley DB. */
...@@ -18,8 +20,6 @@ ...@@ -18,8 +20,6 @@
// ENVDIR 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);
struct in_db; struct in_db;
struct in_db { struct in_db {
long int r; long int r;
...@@ -109,7 +109,8 @@ static void make_db (void) { ...@@ -109,7 +109,8 @@ static void make_db (void) {
} }
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
make_db(); make_db();
return 0; return 0;
} }
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include "test.h"
/* Like test_log6 except abort. */ /* Like test_log6 except abort. */
#include <assert.h> #include <assert.h>
...@@ -17,8 +19,6 @@ ...@@ -17,8 +19,6 @@
// ENVDIR 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);
struct in_db; struct in_db;
struct in_db { struct in_db {
long int r; long int r;
...@@ -121,7 +121,8 @@ static void make_db (void) { ...@@ -121,7 +121,8 @@ static void make_db (void) {
} }
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
make_db(); make_db();
return 0; return 0;
} }
...@@ -296,7 +296,8 @@ static void make_db (void) { ...@@ -296,7 +296,8 @@ static void make_db (void) {
r=env->close(env, 0); assert(r==0); r=env->close(env, 0); assert(r==0);
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
make_db(); make_db();
return 0; return 0;
} }
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include "test.h"
/* Test to see if we can do logging and recovery. */ /* Test to see if we can do logging and recovery. */
/* This is very specific to TokuDB. It won't work with Berkeley DB. */ /* This is very specific to TokuDB. It won't work with Berkeley DB. */
/* This test_log7 is like test_log5 except maxcount is larger. */ /* This test_log7 is like test_log5 except maxcount is larger. */
...@@ -15,8 +17,6 @@ ...@@ -15,8 +17,6 @@
// ENVDIR 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);
struct in_db; struct in_db;
struct in_db { struct in_db {
long int r; long int r;
...@@ -79,7 +79,8 @@ static void make_db (void) { ...@@ -79,7 +79,8 @@ static void make_db (void) {
} }
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
make_db(); make_db();
return 0; return 0;
} }
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include "test.h"
/* Test to see if we can do logging and recovery. */ /* Test to see if we can do logging and recovery. */
/* This is very specific to TokuDB. It won't work with Berkeley DB. */ /* This is very specific to TokuDB. It won't work with Berkeley DB. */
/* This test_log8 inserts to a db, closes, reopens, and inserts more to db. We want to make sure that the recovery of the buffers works. */ /* This test_log8 inserts to a db, closes, reopens, and inserts more to db. We want to make sure that the recovery of the buffers works. */
...@@ -15,8 +17,6 @@ ...@@ -15,8 +17,6 @@
// ENVDIR 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);
struct in_db; struct in_db;
struct in_db { struct in_db {
long int r; long int r;
...@@ -93,7 +93,8 @@ static void make_db (void) { ...@@ -93,7 +93,8 @@ static void make_db (void) {
} }
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
make_db(); make_db();
return 0; return 0;
} }
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include "test.h"
/* Test to see if we can do logging and recovery. */ /* Test to see if we can do logging and recovery. */
/* This is very specific to TokuDB. It won't work with Berkeley DB. */ /* This is very specific to TokuDB. It won't work with Berkeley DB. */
/* This test_log8 inserts to a db, closes, reopens, and inserts more to db. We want to make sure that the recovery of the buffers works. */ /* This test_log8 inserts to a db, closes, reopens, and inserts more to db. We want to make sure that the recovery of the buffers works. */
...@@ -15,8 +17,6 @@ ...@@ -15,8 +17,6 @@
// ENVDIR 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);
struct in_db; struct in_db;
struct in_db { struct in_db {
long int r; long int r;
...@@ -93,7 +93,8 @@ static void make_db (void) { ...@@ -93,7 +93,8 @@ static void make_db (void) {
} }
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
make_db(); make_db();
return 0; return 0;
} }
...@@ -34,7 +34,8 @@ grep_for_in_logs (const char *str) { ...@@ -34,7 +34,8 @@ grep_for_in_logs (const char *str) {
return -1; return -1;
} }
int main (int UU(argc), char UU(*argv[])) { int
test_main (int UU(argc), const char UU(*argv[])) {
int r; int r;
DB_ENV *env; DB_ENV *env;
DB *db; DB *db;
......
...@@ -101,7 +101,8 @@ test_logmax (int logmax) { ...@@ -101,7 +101,8 @@ test_logmax (int logmax) {
check_logmax(effective_max); check_logmax(effective_max);
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
test_logmax(1<<20); test_logmax(1<<20);
test_logmax(-1); test_logmax(-1);
......
...@@ -43,11 +43,12 @@ seqinsert (int n, float p) { ...@@ -43,11 +43,12 @@ seqinsert (int n, float p) {
r = env->close(env, 0); assert(r == 0); r = env->close(env, 0); assert(r == 0);
} }
int main(int argc, char *argv[]) { int
test_main(int argc, const char *argv[]) {
srandom(time(0)); srandom(time(0));
int i; int i;
for (i=1; i<argc; i++) { for (i=1; i<argc; i++) {
char *arg = argv[i]; const char *arg = argv[i];
if (strcmp(arg, "-v") == 0) { if (strcmp(arg, "-v") == 0) {
verbose++; verbose++;
continue; continue;
......
...@@ -140,7 +140,8 @@ test_nested (void) { ...@@ -140,7 +140,8 @@ test_nested (void) {
r=env->close(env, 0); CKERR(r); r=env->close(env, 0); CKERR(r);
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
test_nested(); test_nested();
return 0; return 0;
......
...@@ -152,7 +152,8 @@ test_icdi_search (int n, int dup_mode) { ...@@ -152,7 +152,8 @@ test_icdi_search (int n, int dup_mode) {
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
int i; int i;
parse_args(argc, argv); parse_args(argc, argv);
......
...@@ -82,7 +82,8 @@ test_rand_insert (int n, int dup_mode) { ...@@ -82,7 +82,8 @@ test_rand_insert (int n, int dup_mode) {
assert(r == 0); assert(r == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
int i; int i;
......
...@@ -138,7 +138,8 @@ test_reverse_compare (int n, int dup_flags) { ...@@ -138,7 +138,8 @@ test_reverse_compare (int n, int dup_flags) {
CKERR(r); CKERR(r);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
int i; int i;
......
...@@ -117,7 +117,8 @@ static void make_db (int n_locks) { ...@@ -117,7 +117,8 @@ static void make_db (int n_locks) {
r=env->close(env, 0); assert(r==0); r=env->close(env, 0); assert(r==0);
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
make_db(-1); make_db(-1);
make_db(100); make_db(100);
if (0) { if (0) {
......
...@@ -71,7 +71,8 @@ test_db_thread (void) { ...@@ -71,7 +71,8 @@ test_db_thread (void) {
r = db->close(db, 0); assert(r == 0); r = db->close(db, 0); assert(r == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " ENVDIR); system("rm -rf " ENVDIR);
toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO);
......
...@@ -52,7 +52,8 @@ usage (void) { ...@@ -52,7 +52,8 @@ usage (void) {
return 1; return 1;
} }
int main(int argc, char *argv[]) { int
test_main(int argc, const char *argv[]) {
const char *dbfile = "test.db"; const char *dbfile = "test.db";
const char *dbname = "main"; const char *dbname = "main";
int nthreads = 2; int nthreads = 2;
...@@ -63,7 +64,7 @@ int main(int argc, char *argv[]) { ...@@ -63,7 +64,7 @@ int main(int argc, char *argv[]) {
int i; int i;
for (i=1; i<argc; i++) { for (i=1; i<argc; i++) {
char *arg = argv[i]; const char *arg = argv[i];
if (0 == strcmp(arg, "-h") || 0 == strcmp(arg, "--help")) { if (0 == strcmp(arg, "-h") || 0 == strcmp(arg, "--help")) {
return usage(); return usage();
} }
......
...@@ -202,7 +202,9 @@ verify_gone (void) { ...@@ -202,7 +202,9 @@ verify_gone (void) {
if (key.data) free(key.data); if (key.data) free(key.data);
} }
int main() { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv);
int r; int r;
system("rm -rf " ENVDIR); system("rm -rf " ENVDIR);
......
...@@ -50,7 +50,8 @@ usage (void) { ...@@ -50,7 +50,8 @@ usage (void) {
return 1; return 1;
} }
int main(int argc, char *argv[]) { int
test_main(int argc, const char *argv[]) {
const char *dbfile = "test.db"; const char *dbfile = "test.db";
const char *dbname = "main"; const char *dbname = "main";
int all_on_threads = 0; int all_on_threads = 0;
...@@ -61,7 +62,7 @@ int main(int argc, char *argv[]) { ...@@ -61,7 +62,7 @@ int main(int argc, char *argv[]) {
int i; int i;
for (i=1; i<argc; i++) { for (i=1; i<argc; i++) {
char *arg = argv[i]; const char *arg = argv[i];
if (0 == strcmp(arg, "-h") || 0 == strcmp(arg, "--help")) { if (0 == strcmp(arg, "-h") || 0 == strcmp(arg, "--help")) {
return usage(); return usage();
} }
......
...@@ -89,7 +89,8 @@ test_truncate (int n) { ...@@ -89,7 +89,8 @@ test_truncate (int n) {
return 0; return 0;
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
int nodesize = 1024*1024; int nodesize = 1024*1024;
int leafentry = 25; int leafentry = 25;
......
...@@ -98,7 +98,8 @@ test_truncate_subdb (int n) { ...@@ -98,7 +98,8 @@ test_truncate_subdb (int n) {
return 0; return 0;
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
int nodesize = 1024*1024; int nodesize = 1024*1024;
int leafentry = 25; int leafentry = 25;
......
...@@ -106,7 +106,8 @@ test_truncate_txn_abort (int n) { ...@@ -106,7 +106,8 @@ test_truncate_txn_abort (int n) {
return 0; return 0;
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
int nodesize = 1024*1024; int nodesize = 1024*1024;
int leafentry = 25; int leafentry = 25;
......
...@@ -106,7 +106,8 @@ test_truncate_txn_commit (int n) { ...@@ -106,7 +106,8 @@ test_truncate_txn_commit (int n) {
return 0; return 0;
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
int nodesize = 1024*1024; int nodesize = 1024*1024;
int leafentry = 25; int leafentry = 25;
......
...@@ -114,7 +114,8 @@ test_truncate_txn_commit2 (int n) { ...@@ -114,7 +114,8 @@ test_truncate_txn_commit2 (int n) {
return 0; return 0;
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
int nodesize = 1024*1024; int nodesize = 1024*1024;
int leafentry = 25; int leafentry = 25;
......
...@@ -114,7 +114,8 @@ test_truncate_txn_commit2 (int n) { ...@@ -114,7 +114,8 @@ test_truncate_txn_commit2 (int n) {
return 0; return 0;
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
int nodesize = 1024*1024; int nodesize = 1024*1024;
int leafentry = 25; int leafentry = 25;
......
...@@ -124,7 +124,8 @@ test_truncate_with_cursors (int n) { ...@@ -124,7 +124,8 @@ test_truncate_with_cursors (int n) {
return 0; return 0;
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
int nodesize = 1024*1024; int nodesize = 1024*1024;
int leafentry = 25; int leafentry = 25;
......
...@@ -61,10 +61,11 @@ test_txn_abort (int n) { ...@@ -61,10 +61,11 @@ test_txn_abort (int n) {
r = env->close(env, 0); assert(r == 0); r = env->close(env, 0); assert(r == 0);
} }
int main(int argc, char *argv[]) { int
test_main(int argc, const char *argv[]) {
int i; int i;
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
char *arg = argv[i]; const char *arg = argv[i];
if (strcmp(arg, "-v") == 0 || strcmp(arg, "--verbose") == 0) { if (strcmp(arg, "-v") == 0 || strcmp(arg, "--verbose") == 0) {
verbose++; verbose++;
continue; continue;
......
...@@ -78,10 +78,11 @@ test_txn_abort (int n) { ...@@ -78,10 +78,11 @@ test_txn_abort (int n) {
r = env->close(env, 0); assert(r == 0); r = env->close(env, 0); assert(r == 0);
} }
int main(int argc, char *argv[]) { int
test_main(int argc, const char *argv[]) {
int i; int i;
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
char *arg = argv[i]; const char *arg = argv[i];
if (strcmp(arg, "-v") == 0 || strcmp(arg, "--verbose") == 0) { if (strcmp(arg, "-v") == 0 || strcmp(arg, "--verbose") == 0) {
verbose++; verbose++;
continue; continue;
......
...@@ -106,13 +106,14 @@ test_txn_abort (int n, int which_guys_to_abort) { ...@@ -106,13 +106,14 @@ test_txn_abort (int n, int which_guys_to_abort) {
r = env->close(env, 0); assert(r == 0); r = env->close(env, 0); assert(r == 0);
} }
int main(int argc, char *argv[]) { int
test_main(int argc, const char *argv[]) {
int i,j; int i,j;
if (!IS_TDB) { if (!IS_TDB) {
return 0; // This test is inappropriate for BDB. It requires finer grained locking that BDB supports. return 0; // This test is inappropriate for BDB. It requires finer grained locking that BDB supports.
} }
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
char *arg = argv[i]; const char *arg = argv[i];
if (strcmp(arg, "-v") == 0 || strcmp(arg, "--verbose") == 0) { if (strcmp(arg, "-v") == 0 || strcmp(arg, "--verbose") == 0) {
verbose++; verbose++;
continue; continue;
......
...@@ -51,7 +51,8 @@ test_abort_create (void) { ...@@ -51,7 +51,8 @@ test_abort_create (void) {
} }
int main(int UU(argc), char UU(*argv[])) { int
test_main(int UU(argc), const char UU(*argv[])) {
test_abort_create(); test_abort_create();
return 0; return 0;
} }
...@@ -60,7 +60,8 @@ test_abort_close (void) { ...@@ -60,7 +60,8 @@ test_abort_close (void) {
#endif #endif
} }
int main(int UU(argc), char UU(*argv[])) { int
test_main(int UU(argc), const char UU(*argv[])) {
test_abort_close(); test_abort_close();
return 0; return 0;
} }
...@@ -67,7 +67,8 @@ test_abort_close (void) { ...@@ -67,7 +67,8 @@ test_abort_close (void) {
#endif #endif
} }
int main(int UU(argc), char UU(*argv[])) { int
test_main(int UU(argc), const char UU(*argv[])) {
test_abort_close(); test_abort_close();
return 0; return 0;
} }
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
#include "test.h" #include "test.h"
int main(int UU(argc), char UU(*argv[])) { int
test_main(int UU(argc), const char UU(*argv[])) {
int r; int r;
DB_ENV *env; DB_ENV *env;
......
...@@ -72,7 +72,8 @@ test_txn_close_open_commit (void) { ...@@ -72,7 +72,8 @@ test_txn_close_open_commit (void) {
#endif #endif
} }
int main(int UU(argc), char UU(*argv[])) { int
test_main(int UU(argc), const char UU(*argv[])) {
test_txn_close_open_commit(); test_txn_close_open_commit();
return 0; return 0;
} }
...@@ -60,7 +60,8 @@ test_abort_close (void) { ...@@ -60,7 +60,8 @@ test_abort_close (void) {
#endif #endif
} }
int main(int UU(argc), char UU(*argv[])) { int
test_main(int UU(argc), const char UU(*argv[])) {
test_abort_close(); test_abort_close();
return 0; return 0;
} }
...@@ -200,7 +200,8 @@ test_txn_cursor_last_2 (int nrows) { ...@@ -200,7 +200,8 @@ test_txn_cursor_last_2 (int nrows) {
r = env->close(env, 0); assert(r == 0); r = env->close(env, 0); assert(r == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
......
...@@ -81,7 +81,8 @@ test_txn_nested(int do_commit) { ...@@ -81,7 +81,8 @@ test_txn_nested(int do_commit) {
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
......
...@@ -74,7 +74,8 @@ test_txn_abort (void) { ...@@ -74,7 +74,8 @@ test_txn_abort (void) {
r = env->close(env, 0); CKERR(r); r = env->close(env, 0); CKERR(r);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
test_txn_abort(); test_txn_abort();
return 0; return 0;
......
...@@ -80,7 +80,8 @@ test_txn_abort (void) { ...@@ -80,7 +80,8 @@ test_txn_abort (void) {
r = env->close(env, 0); CKERR(r); r = env->close(env, 0); CKERR(r);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
test_txn_abort(); test_txn_abort();
return 0; return 0;
......
...@@ -106,7 +106,8 @@ test_txn_abort (int insert, int secondnum) { ...@@ -106,7 +106,8 @@ test_txn_abort (int insert, int secondnum) {
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
test_txn_abort(1, 0); test_txn_abort(1, 0);
test_txn_abort(0, 0); test_txn_abort(0, 0);
......
...@@ -88,7 +88,8 @@ test_txn_recover3 (int nrows) { ...@@ -88,7 +88,8 @@ test_txn_recover3 (int nrows) {
r = env->close(env, 0); assert(r == 0); r = env->close(env, 0); assert(r == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
......
...@@ -79,7 +79,8 @@ test_cursor_nonleaf_expand (int n, int reverse) { ...@@ -79,7 +79,8 @@ test_cursor_nonleaf_expand (int n, int reverse) {
r = db->close(db, 0); assert(r == 0); r = db->close(db, 0); assert(r == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
system("rm -rf " ENVDIR); system("rm -rf " ENVDIR);
......
...@@ -62,7 +62,8 @@ test_autotxn (u_int32_t env_flags, u_int32_t db_flags) { ...@@ -62,7 +62,8 @@ test_autotxn (u_int32_t env_flags, u_int32_t db_flags) {
r = env->close(env, 0); assert(r==0); r = env->close(env, 0); assert(r==0);
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
test_autotxn(DB_AUTO_COMMIT, DB_AUTO_COMMIT); test_autotxn(DB_AUTO_COMMIT, DB_AUTO_COMMIT);
test_autotxn(0, DB_AUTO_COMMIT); test_autotxn(0, DB_AUTO_COMMIT);
test_autotxn(DB_AUTO_COMMIT, 0); test_autotxn(DB_AUTO_COMMIT, 0);
......
...@@ -135,7 +135,8 @@ test_insert_zero_length_keys (int n, int dup_mode, const char *dbname) { ...@@ -135,7 +135,8 @@ test_insert_zero_length_keys (int n, int dup_mode, const char *dbname) {
r = db->close(db, 0); assert(r == 0); r = db->close(db, 0); assert(r == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
......
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