Commit 908ba5ec authored by Yoni Fogel's avatar Yoni Fogel

Addresses #1338

All newbrt tests now call toku_brt_init/destroy

git-svn-id: file:///svn/toku/tokudb.1032b@8393 c7de825b-a66e-492c-adef-691d508d4ae1
parent fb09b9b8
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#include "test.h"
/* Insert a bunch of stuff */ /* Insert a bunch of stuff */
#include "includes.h" #include "includes.h"
...@@ -18,7 +20,6 @@ static int keysize = sizeof (long long); ...@@ -18,7 +20,6 @@ static int keysize = sizeof (long long);
static int valsize = sizeof (long long); static int valsize = sizeof (long long);
static int do_verify =0; /* Do a slow verify after every insert. */ static int do_verify =0; /* Do a slow verify after every insert. */
static int verbose = 1;
static int do_serial = 1; static int do_serial = 1;
static int do_random = 1; static int do_random = 1;
...@@ -118,11 +119,13 @@ static void usage() { ...@@ -118,11 +119,13 @@ static void usage() {
printf("[--verify]\n"); printf("[--verify]\n");
} }
int main (int argc, char *argv[]) { int
test_main (int argc, const char *argv[]) {
verbose=1; //Default
/* parse parameters */ /* parse parameters */
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 (arg[0] != '-') if (arg[0] != '-')
break; break;
if (strcmp(arg, "--nodesize") == 0) { if (strcmp(arg, "--nodesize") == 0) {
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#include "test.h"
#include "includes.h" #include "includes.h"
static void ba_alloc_at (BLOCK_ALLOCATOR ba, u_int64_t size, u_int64_t offset) { static void ba_alloc_at (BLOCK_ALLOCATOR ba, u_int64_t size, u_int64_t offset) {
...@@ -101,7 +103,7 @@ test_ba1 (int n_initial) { ...@@ -101,7 +103,7 @@ test_ba1 (int n_initial) {
int int
main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
test_ba0(); test_ba0();
test_ba1(0); test_ba1(0);
test_ba1(10); test_ba1(10);
......
/* Test bread by writing random data and then reading it using bread_backwards() to see if it gives the right answer. /* Test bread by writing random data and then reading it using bread_backwards() to see if it gives the right answer.
* See test_1305 for another bread test (testing to see if it can read 1GB files) */ * See test_1305 for another bread test (testing to see if it can read 1GB files) */
#include "test.h"
#include "toku_portability.h" #include "toku_portability.h"
#include <assert.h> #include <assert.h>
...@@ -68,7 +70,8 @@ test (int seed) { ...@@ -68,7 +70,8 @@ test (int seed) {
unlink(FNAME); unlink(FNAME);
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
int i; int i;
for (i=0; i<10; i++) test(i); for (i=0; i<10; i++) test(i);
return 0; return 0;
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#include "test.h"
#include "includes.h" #include "includes.h"
static void test_serialize(void) { static void test_serialize(void) {
...@@ -124,7 +126,8 @@ static void test_serialize(void) { ...@@ -124,7 +126,8 @@ static void test_serialize(void) {
toku_free(brt); toku_free(brt);
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
toku_memory_check = 1; toku_memory_check = 1;
test_serialize(); test_serialize();
toku_malloc_cleanup(); toku_malloc_cleanup();
......
...@@ -84,7 +84,8 @@ static void test_brt_cursor(DB *db) { ...@@ -84,7 +84,8 @@ static void test_brt_cursor(DB *db) {
} }
int main (int argc , const char *argv[]) { int
test_main (int argc , const char *argv[]) {
default_parse_args(argc, argv); default_parse_args(argc, argv);
DB a_db; DB a_db;
......
...@@ -1059,7 +1059,8 @@ static void test_brt_cursor(DB *db) { ...@@ -1059,7 +1059,8 @@ static void test_brt_cursor(DB *db) {
} }
int main (int argc , const char *argv[]) { int
test_main (int argc , const char *argv[]) {
default_parse_args(argc, argv); default_parse_args(argc, argv);
DB a_db; DB a_db;
......
...@@ -42,7 +42,8 @@ static void test_named_db (void) { ...@@ -42,7 +42,8 @@ static void test_named_db (void) {
toku_memory_check_all_free(); toku_memory_check_all_free();
} }
int main (int argc , const char *argv[]) { int
test_main (int argc , const char *argv[]) {
default_parse_args(argc, argv); default_parse_args(argc, argv);
test_named_db(); test_named_db();
toku_malloc_cleanup(); toku_malloc_cleanup();
......
...@@ -1461,7 +1461,8 @@ static void brt_blackbox_test (void) { ...@@ -1461,7 +1461,8 @@ static void brt_blackbox_test (void) {
} }
int main (int argc , const char *argv[]) { int
test_main (int argc , const char *argv[]) {
default_parse_args(argc, argv); default_parse_args(argc, argv);
brt_blackbox_test(); brt_blackbox_test();
......
...@@ -30,7 +30,8 @@ static void test0 (void) { ...@@ -30,7 +30,8 @@ static void test0 (void) {
toku_memory_check_all_free(); toku_memory_check_all_free();
} }
int main (int argc , const char *argv[]) { int
test_main (int argc , const char *argv[]) {
default_parse_args(argc, argv); default_parse_args(argc, argv);
if (verbose) printf("test0 A\n"); if (verbose) printf("test0 A\n");
test0(); test0();
......
...@@ -32,7 +32,8 @@ static void test1 (void) { ...@@ -32,7 +32,8 @@ static void test1 (void) {
toku_memory_check_all_free(); toku_memory_check_all_free();
if (verbose) printf("test1 ok\n"); if (verbose) printf("test1 ok\n");
} }
int main (int argc , const char *argv[]) { int
test_main (int argc , const char *argv[]) {
default_parse_args(argc, argv); default_parse_args(argc, argv);
if (verbose) printf("test1\n"); if (verbose) printf("test1\n");
test1(); test1();
......
...@@ -47,7 +47,8 @@ static void test2 (int memcheck, int limit) { ...@@ -47,7 +47,8 @@ static void test2 (int memcheck, int limit) {
if (verbose) printf("test2 ok\n"); if (verbose) printf("test2 ok\n");
} }
int main (int argc , const char *argv[]) { int
test_main (int argc , const char *argv[]) {
default_parse_args(argc, argv); default_parse_args(argc, argv);
// if (verbose) printf("test2 checking memory\n"); // if (verbose) printf("test2 checking memory\n");
// test2(1); // test2(1);
......
...@@ -65,7 +65,8 @@ static void brt_blackbox_test (void) { ...@@ -65,7 +65,8 @@ static void brt_blackbox_test (void) {
} }
int main (int argc , const char *argv[]) { int
test_main (int argc , const char *argv[]) {
default_parse_args(argc, argv); default_parse_args(argc, argv);
brt_blackbox_test(); brt_blackbox_test();
......
...@@ -59,7 +59,8 @@ static void brt_blackbox_test (void) { ...@@ -59,7 +59,8 @@ static void brt_blackbox_test (void) {
} }
} }
int main (int argc , const char *argv[]) { int
test_main (int argc , const char *argv[]) {
default_parse_args(argc, argv); default_parse_args(argc, argv);
brt_blackbox_test(); brt_blackbox_test();
......
...@@ -54,7 +54,8 @@ static void test5 (void) { ...@@ -54,7 +54,8 @@ static void test5 (void) {
toku_memory_check_all_free(); toku_memory_check_all_free();
} }
int main (int argc , const char *argv[]) { int
test_main (int argc , const char *argv[]) {
default_parse_args(argc, argv); default_parse_args(argc, argv);
test5(); test5();
......
...@@ -97,7 +97,8 @@ void cachetable_checkpoint_test(int n, int dirty) { ...@@ -97,7 +97,8 @@ void cachetable_checkpoint_test(int n, int dirty) {
r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0); r = toku_cachetable_close(&ct); assert(r == 0 && ct == 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++) {
if (strcmp(argv[i], "-v") == 0) { if (strcmp(argv[i], "-v") == 0) {
......
...@@ -71,7 +71,8 @@ cachetable_count_pinned_test (int n) { ...@@ -71,7 +71,8 @@ cachetable_count_pinned_test (int n) {
r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0); r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
default_parse_args(argc, argv); default_parse_args(argc, argv);
cachetable_count_pinned_test(8); cachetable_count_pinned_test(8);
return 0; return 0;
......
...@@ -79,7 +79,8 @@ cachetable_debug_test (int n) { ...@@ -79,7 +79,8 @@ cachetable_debug_test (int n) {
r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0); r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
default_parse_args(argc, argv); default_parse_args(argc, argv);
cachetable_debug_test(8); cachetable_debug_test(8);
return 0; return 0;
......
...@@ -43,7 +43,8 @@ cachetable_fd_test (void) { ...@@ -43,7 +43,8 @@ cachetable_fd_test (void) {
r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0); r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
default_parse_args(argc, argv); default_parse_args(argc, argv);
toku_os_initialize_settings(verbose); toku_os_initialize_settings(verbose);
......
...@@ -99,7 +99,8 @@ test_cachetable_flush (int n) { ...@@ -99,7 +99,8 @@ test_cachetable_flush (int n) {
r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0); r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
default_parse_args(argc, argv); default_parse_args(argc, argv);
test_cachetable_flush(8); test_cachetable_flush(8);
return 0; return 0;
......
...@@ -76,7 +76,8 @@ cachetable_getandpin_test (int n) { ...@@ -76,7 +76,8 @@ cachetable_getandpin_test (int n) {
r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0); r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
default_parse_args(argc, argv); default_parse_args(argc, argv);
cachetable_getandpin_test(8); cachetable_getandpin_test(8);
return 0; return 0;
......
...@@ -83,7 +83,8 @@ cachetable_put_test (int n) { ...@@ -83,7 +83,8 @@ cachetable_put_test (int n) {
r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0); r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
default_parse_args(argc, argv); default_parse_args(argc, argv);
cachetable_put_test(8); cachetable_put_test(8);
return 0; return 0;
......
...@@ -162,7 +162,8 @@ static void test_rename (void) { ...@@ -162,7 +162,8 @@ static void test_rename (void) {
assert(n_keys == 0); assert(n_keys == 0);
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
// parse args // parse args
default_parse_args(argc, argv); default_parse_args(argc, argv);
toku_os_initialize_settings(verbose); toku_os_initialize_settings(verbose);
......
#include "includes.h" #include "includes.h"
int verbose = 0;
#include "test.h"
// test create and destroy // test create and destroy
...@@ -176,15 +177,9 @@ test_single_writer (void) { ...@@ -176,15 +177,9 @@ test_single_writer (void) {
rw_event_destroy(rwe); rw_event_destroy(rwe);
} }
int main(int argc, char *argv[]) { int
int i; test_main(int argc, const char *argv[]) {
for (i=1; i<argc; i++) { default_parse_args(argc, argv);
char *arg = argv[i];
if (strcmp(arg, "-v") == 0) {
verbose++;
continue;
}
}
test_create_destroy(); test_create_destroy();
test_simple_read_lock(0); test_simple_read_lock(0);
test_simple_read_lock(42); test_simple_read_lock(42);
......
/* How fast can we read a file usng the cachetable interface. */ /* How fast can we read a file usng the cachetable interface. */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#include "test.h"
#include "includes.h" #include "includes.h"
enum { KEYLIMIT = 4, BLOCKSIZE=1<<20, N=2048}; enum { KEYLIMIT = 4, BLOCKSIZE=1<<20, N=2048};
...@@ -98,7 +100,8 @@ static void readit (void) { ...@@ -98,7 +100,8 @@ static void readit (void) {
N, BLOCKSIZE, diff, (N/diff)*(BLOCKSIZE*1e-6), udiff, sdiff); N, BLOCKSIZE, diff, (N/diff)*(BLOCKSIZE*1e-6), udiff, sdiff);
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
open_file(); open_file();
writeit(); writeit();
readit(); readit();
......
...@@ -639,7 +639,8 @@ static void test_size_flush() { ...@@ -639,7 +639,8 @@ static void test_size_flush() {
assert(r == 0); assert(r == 0);
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
// defaults // defaults
#if defined(__linux__) #if defined(__linux__)
int do_malloc_fail = 0; int do_malloc_fail = 0;
......
...@@ -234,7 +234,8 @@ usage (const char *progname) { ...@@ -234,7 +234,8 @@ usage (const char *progname) {
exit(1); exit(1);
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
default_parse_args(argc, argv); default_parse_args(argc, argv);
test_mutex_init(); test_mutex_init();
test_chaining(); test_chaining();
......
...@@ -130,7 +130,8 @@ cachetable_put_evict_remove_test (int n) { ...@@ -130,7 +130,8 @@ cachetable_put_evict_remove_test (int n) {
r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0); r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
default_parse_args(argc, argv); default_parse_args(argc, argv);
cachetable_unpin_and_remove_test(8); cachetable_unpin_and_remove_test(8);
cachetable_put_evict_remove_test(4); cachetable_put_evict_remove_test(4);
......
...@@ -73,7 +73,8 @@ cachetable_unpin_test (int n) { ...@@ -73,7 +73,8 @@ cachetable_unpin_test (int n) {
r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0); r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
default_parse_args(argc, argv); default_parse_args(argc, argv);
cachetable_unpin_test(8); cachetable_unpin_test(8);
return 0; return 0;
......
#include "includes.h" #include "includes.h"
#include "test.h"
int verbose; int verbose;
typedef struct ctpair *PAIR; typedef struct ctpair *PAIR;
...@@ -194,15 +196,9 @@ test_flow_control (int limit, int n) { ...@@ -194,15 +196,9 @@ test_flow_control (int limit, int n) {
rwfc_destroy(rwfc); rwfc_destroy(rwfc);
} }
int main(int argc, char *argv[]) { int
int i; test_main(int argc, const char *argv[]) {
for (i=1; i<argc; i++) { default_parse_args(argc, argv);
char *arg = argv[i];
if (strcmp(arg, "-v") == 0) {
verbose++;
continue;
}
}
test_create_destroy(); test_create_destroy();
test_simple_enq_deq(0); test_simple_enq_deq(0);
test_simple_enq_deq(42); test_simple_enq_deq(42);
......
...@@ -96,7 +96,8 @@ static void test_delete_all (void) { ...@@ -96,7 +96,8 @@ static void test_delete_all (void) {
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
} }
int main (int argc , const char *argv[]) { int
test_main (int argc , const char *argv[]) {
default_parse_args(argc, argv); default_parse_args(argc, argv);
test_delete_all(); test_delete_all();
......
#include "includes.h" #include "includes.h"
#include "test.h"
int verbose; int verbose;
static void static void
...@@ -70,14 +72,9 @@ test_fifo_enq (int n) { ...@@ -70,14 +72,9 @@ test_fifo_enq (int n) {
assert(f == 0); assert(f == 0);
} }
int main(int argc, char *argv[]) { int
int i; test_main(int argc, const char *argv[]) {
for (i = 1; i < argc; i++) { default_parse_args(argc, argv);
char *arg = argv[i];
if (0 == strcmp(arg, "-v") || 0 == strcmp(arg, "--verbose")) {
verbose = 1; continue;
}
}
test_fifo_create(); test_fifo_create();
test_fifo_enq(4); test_fifo_enq(4);
......
...@@ -54,7 +54,8 @@ static void test_flat (void) { ...@@ -54,7 +54,8 @@ static void test_flat (void) {
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
} }
int main (int argc , const char *argv[]) { int
test_main (int argc , const char *argv[]) {
default_parse_args(argc, argv); default_parse_args(argc, argv);
test_flat(); test_flat();
......
...@@ -73,7 +73,8 @@ static void test_flat (void) { ...@@ -73,7 +73,8 @@ static void test_flat (void) {
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
} }
int main (int argc , const char *argv[]) { int
test_main (int argc , const char *argv[]) {
default_parse_args(argc, argv); default_parse_args(argc, argv);
test_flat(); test_flat();
......
...@@ -58,7 +58,8 @@ static void test_flat (void) { ...@@ -58,7 +58,8 @@ static void test_flat (void) {
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
} }
int main (int argc , const char *argv[]) { int
test_main (int argc , const char *argv[]) {
default_parse_args(argc, argv); default_parse_args(argc, argv);
test_flat(); test_flat();
......
...@@ -62,7 +62,8 @@ static void test_flat (void) { ...@@ -62,7 +62,8 @@ static void test_flat (void) {
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
} }
int main (int argc , const char *argv[]) { int
test_main (int argc , const char *argv[]) {
default_parse_args(argc, argv); default_parse_args(argc, argv);
test_flat(); test_flat();
......
#include "list.h" #include "list.h"
#include "toku_assert.h" #include "toku_assert.h"
#include "test.h"
#include <memory.h> #include <memory.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -144,7 +146,9 @@ static void test_move (int n) { ...@@ -144,7 +146,9 @@ static void test_move (int n) {
assert(i == n); assert(i == n);
} }
int main() { int
test_main(int argc, const char *argv[]) {
default_parse_args(argc, argv);
test_push_pop(0); test_push_pop(0);
test_push_pop(8); test_push_pop(8);
test_push_pop_head(0); test_push_pop_head(0);
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#include "test.h"
#include "includes.h" #include "includes.h"
#define dname __FILE__ ".dir" #define dname __FILE__ ".dir"
#define rmrf "rm -rf " dname "/" #define rmrf "rm -rf " dname "/"
int main (int argc __attribute__((__unused__)), int
char *argv[] __attribute__((__unused__))) { test_main (int argc __attribute__((__unused__)),
const char *argv[] __attribute__((__unused__))) {
int r; int r;
long long lognum; long long lognum;
system(rmrf); system(rmrf);
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#include "test.h"
#include "includes.h" #include "includes.h"
#define dname __FILE__ ".dir" #define dname __FILE__ ".dir"
...@@ -8,8 +10,9 @@ ...@@ -8,8 +10,9 @@
// create and close, making sure that everything is deallocated properly. // create and close, making sure that everything is deallocated properly.
int main (int argc __attribute__((__unused__)), int
char *argv[] __attribute__((__unused__))) { test_main (int argc __attribute__((__unused__)),
const char *argv[] __attribute__((__unused__))) {
int r; int r;
system(rmrf); system(rmrf);
r = toku_os_mkdir(dname, S_IRWXU); assert(r==0); r = toku_os_mkdir(dname, S_IRWXU); assert(r==0);
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#include "test.h"
#include "includes.h" #include "includes.h"
#define dname __FILE__ ".dir" #define dname __FILE__ ".dir"
...@@ -8,8 +10,9 @@ ...@@ -8,8 +10,9 @@
// create and close, making sure that everything is deallocated properly. // create and close, making sure that everything is deallocated properly.
int main (int argc __attribute__((__unused__)), int
char *argv[] __attribute__((__unused__))) { test_main (int argc __attribute__((__unused__)),
const char *argv[] __attribute__((__unused__))) {
int r; int r;
system(rmrf); system(rmrf);
r = toku_os_mkdir(dname, S_IRWXU); assert(r==0); r = toku_os_mkdir(dname, S_IRWXU); assert(r==0);
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#include "test.h"
#include "includes.h" #include "includes.h"
#define dname __FILE__ ".dir" #define dname __FILE__ ".dir"
...@@ -8,8 +10,9 @@ ...@@ -8,8 +10,9 @@
// create and close, making sure that everything is deallocated properly. // create and close, making sure that everything is deallocated properly.
int main (int argc __attribute__((__unused__)), int
char *argv[] __attribute__((__unused__))) { test_main (int argc __attribute__((__unused__)),
const char *argv[] __attribute__((__unused__))) {
int r; int r;
system(rmrf); system(rmrf);
r = toku_os_mkdir(dname, S_IRWXU); assert(r==0); r = toku_os_mkdir(dname, S_IRWXU); assert(r==0);
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#include "test.h"
#include "includes.h" #include "includes.h"
#define dname __FILE__ ".dir" #define dname __FILE__ ".dir"
...@@ -10,8 +12,9 @@ ...@@ -10,8 +12,9 @@
#define LSIZE 100 #define LSIZE 100
int main (int argc __attribute__((__unused__)), int
char *argv[] __attribute__((__unused__))) { test_main (int argc __attribute__((__unused__)),
const char *argv[] __attribute__((__unused__))) {
int r; int r;
system(rmrf); system(rmrf);
r = toku_os_mkdir(dname, S_IRWXU); assert(r==0); r = toku_os_mkdir(dname, S_IRWXU); assert(r==0);
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#include "test.h"
#include "includes.h" #include "includes.h"
#define dname __FILE__ ".dir" #define dname __FILE__ ".dir"
...@@ -10,8 +12,9 @@ ...@@ -10,8 +12,9 @@
#define LSIZE 100 #define LSIZE 100
int main (int argc __attribute__((__unused__)), int
char *argv[] __attribute__((__unused__))) { test_main (int argc __attribute__((__unused__)),
const char *argv[] __attribute__((__unused__))) {
int r; int r;
system(rmrf); system(rmrf);
r = toku_os_mkdir(dname, S_IRWXU); assert(r==0); r = toku_os_mkdir(dname, S_IRWXU); assert(r==0);
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#include "test.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "toku_assert.h" #include "toku_assert.h"
...@@ -50,7 +52,9 @@ test_mempool_malloc_mfree (size_t size) { ...@@ -50,7 +52,9 @@ test_mempool_malloc_mfree (size_t size) {
free(base); free(base);
} }
int main() { int
test_main(int argc, const char *argv[]) {
default_parse_args(argc, argv);
test_mempool_limits(0); test_mempool_limits(0);
test_mempool_limits(256); test_mempool_limits(256);
test_mempool_malloc_mfree(0); test_mempool_malloc_mfree(0);
......
#include "toku_portability.h" #include "toku_portability.h"
#include <errno.h> #include <errno.h>
#include "test.h"
#include <stdio.h> #include <stdio.h>
typedef void *OMTVALUE; typedef void *OMTVALUE;
...@@ -92,7 +94,8 @@ static void test (void) { ...@@ -92,7 +94,8 @@ static void test (void) {
toku_omt_cursor_destroy(&curs3); toku_omt_cursor_destroy(&curs3);
} }
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;
} }
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include "test.h"
#include "toku_portability.h" #include "toku_portability.h"
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
...@@ -16,7 +18,6 @@ typedef void *OMTVALUE; ...@@ -16,7 +18,6 @@ typedef void *OMTVALUE;
typedef OMTVALUE TESTVALUE; typedef OMTVALUE TESTVALUE;
/* Things that would go in a omt-tests.h if we split to multiple files later. */ /* Things that would go in a omt-tests.h if we split to multiple files later. */
int verbose=0;
#define CKERR(r) do { if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, strerror(r)); assert(r==0); } while (0) #define CKERR(r) do { if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, strerror(r)); assert(r==0); } while (0)
#define CKERR2(r,r2) do { if (r!=r2) fprintf(stderr, "%s:%d error %d %s, expected %d\n", __FILE__, __LINE__, r, strerror(r), r2); assert(r==r2); } while (0) #define CKERR2(r,r2) do { if (r!=r2) fprintf(stderr, "%s:%d error %d %s, expected %d\n", __FILE__, __LINE__, r, strerror(r), r2); assert(r==r2); } while (0)
...@@ -972,7 +973,8 @@ runtests_create_choice (enum create_type create_choice) { ...@@ -972,7 +973,8 @@ runtests_create_choice (enum create_type create_choice) {
test_invalidate( create_choice, TRUE, TRUE); test_invalidate( create_choice, TRUE, TRUE);
} }
int main(int argc, const char *argv[]) { int
test_main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
init_globals(); init_globals();
test_create( CLOSE_WHEN_DONE); test_create( CLOSE_WHEN_DONE);
......
#include "includes.h" #include "includes.h"
#include "test.h"
static const char fname[]= __FILE__ ".brt"; static const char fname[]= __FILE__ ".brt";
static TOKUTXN const null_txn = 0; static TOKUTXN const null_txn = 0;
...@@ -10,7 +12,8 @@ BRT_CURSOR cursor; ...@@ -10,7 +12,8 @@ BRT_CURSOR cursor;
static int test_brt_cursor_keycompare(DB *db __attribute__((unused)), const DBT *a, const DBT *b) { static int test_brt_cursor_keycompare(DB *db __attribute__((unused)), const DBT *a, const DBT *b) {
return toku_keycompare(a->data, a->size, b->data, b->size); return toku_keycompare(a->data, a->size, b->data, b->size);
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
int r; int r;
DB a_db; DB a_db;
DB *db = &a_db; DB *db = &a_db;
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#include "includes.h" #include "includes.h"
#include "test.h"
#include <signal.h> #include <signal.h>
...@@ -12,7 +14,8 @@ static BOOL foo (void) { ...@@ -12,7 +14,8 @@ static BOOL foo (void) {
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
signal (SIGABRT, catch_abort); signal (SIGABRT, catch_abort);
if (argc!=2) { printf("argcount should be 2.\n"); exit(1); } if (argc!=2) { printf("argcount should be 2.\n"); exit(1); }
const char *str=argv[1]; const char *str=argv[1];
......
...@@ -43,7 +43,8 @@ doit (void) { ...@@ -43,7 +43,8 @@ doit (void) {
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
default_parse_args(argc, argv); default_parse_args(argc, argv);
doit(); doit();
if (verbose) printf("test ok\n"); if (verbose) printf("test ok\n");
......
/* Test an overflow condition on the leaf. See #632. */ /* Test an overflow condition on the leaf. See #632. */
#include "test.h"
#include "includes.h" #include "includes.h"
int verbose; int verbose;
...@@ -32,7 +34,8 @@ test_overflow (void) { ...@@ -32,7 +34,8 @@ test_overflow (void) {
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); 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];
......
/* The goal of this test. Make sure that inserts stay behind deletes. */ /* The goal of this test. Make sure that inserts stay behind deletes. */
#include "test.h"
#include "includes.h" #include "includes.h"
static TOKUTXN const null_txn = 0; static TOKUTXN const null_txn = 0;
...@@ -58,7 +60,8 @@ doit (void) { ...@@ -58,7 +60,8 @@ doit (void) {
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); 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__))) {
doit(); doit();
return 0; return 0;
} }
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
static TOKUTXN const null_txn = 0; static TOKUTXN const null_txn = 0;
static DB * const null_db = 0; static DB * const null_db = 0;
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) {
const char *n = __FILE__ "dump.brt"; const char *n = __FILE__ "dump.brt";
int r; int r;
BRT t; BRT t;
......
/* The goal of this test: Make sure that when we aggressively promote /* The goal of this test: Make sure that when we aggressively promote
* that we don't get a fencepost error on the size. (#399, I think) * that we don't get a fencepost error on the size. (#399, I think)
* *
* For various values of I do the following: * For various values of I do the following:
* *
...@@ -26,6 +27,7 @@ ...@@ -26,6 +27,7 @@
* *
*/ */
#include "test.h"
#include "includes.h" #include "includes.h"
static TOKUTXN const null_txn = 0; static TOKUTXN const null_txn = 0;
...@@ -135,11 +137,13 @@ doit (int ksize __attribute__((__unused__))) { ...@@ -135,11 +137,13 @@ doit (int ksize __attribute__((__unused__))) {
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
int i; int i;
doit(53); doit(53);
toku_malloc_cleanup(); toku_malloc_cleanup();
exit(0); return 0;
//Skip remaining tests.
for (i=1; i<NODESIZE/2; i++) { for (i=1; i<NODESIZE/2; i++) {
printf("extrasize=%d\n", i); printf("extrasize=%d\n", i);
doit(i); doit(i);
......
#include "toku_portability.h" #include "toku_portability.h"
#include <string.h> #include <string.h>
#include "test.h"
#include "brttypes.h" #include "brttypes.h"
#include "includes.h" #include "includes.h"
...@@ -97,7 +99,8 @@ static void test_leafentry_3long (void) { ...@@ -97,7 +99,8 @@ static void test_leafentry_3long (void) {
toku_free(l); toku_free(l);
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
test_leafentry_1(); test_leafentry_1();
test_leafentry_2(); test_leafentry_2();
test_leafentry_3(); test_leafentry_3();
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "toku_portability.h" #include "toku_portability.h"
#include "brt.h"
int verbose=0; int verbose=0;
...@@ -22,3 +23,13 @@ default_parse_args (int argc, const char *argv[]) { ...@@ -22,3 +23,13 @@ default_parse_args (int argc, const char *argv[]) {
argc--; argv++; argc--; argv++;
} }
} }
int test_main(int argc, const char *argv[]);
int
main(int argc, const char *argv[]) {
toku_brt_init();
test_main(argc, argv);
toku_brt_destroy();
}
...@@ -72,7 +72,8 @@ test (u_int64_t fsize) { ...@@ -72,7 +72,8 @@ test (u_int64_t fsize) {
unlink(FNAME); unlink(FNAME);
} }
int main (int argc, const char *argv[]) { int
test_main (int argc, const char *argv[]) {
default_parse_args(argc, argv); default_parse_args(argc, argv);
test(1LL<<23); test(1LL<<23);
test(1LL<<30); test(1LL<<30);
......
// Test the first case for the bug in #1308 (brt-serialize.c:33 does the cast wrong) // Test the first case for the bug in #1308 (brt-serialize.c:33 does the cast wrong)
#include "test.h"
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
...@@ -11,7 +13,7 @@ ...@@ -11,7 +13,7 @@
#define BUFSIZE (16<<20) #define BUFSIZE (16<<20)
int int
main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__)))
{ {
unlink(FNAME); unlink(FNAME);
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#include "test.h"
#include "includes.h" #include "includes.h"
#define fname __FILE__ ".tmp" #define fname __FILE__ ".tmp"
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
unlink(fname); unlink(fname);
int fd0 = open (fname, O_RDWR|O_CREAT|O_EXCL, S_IRWXU|S_IRWXG|S_IRWXO); int fd0 = open (fname, O_RDWR|O_CREAT|O_EXCL, S_IRWXU|S_IRWXG|S_IRWXO);
assert(fd0>=0); assert(fd0>=0);
......
#include "memory.h" #include "memory.h"
#include "stdlib.h" #include "stdlib.h"
int main () { #include "test.h"
int
test_main (int argc, const char *argv[]) {
default_parse_args(argc, argv);
char *m=toku_malloc(5); char *m=toku_malloc(5);
m=m; m=m;
free(m); free(m);
......
#include "toku_portability.h" #include "toku_portability.h"
#include "toku_os.h" #include "toku_os.h"
#include "test.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
...@@ -10,8 +12,6 @@ ...@@ -10,8 +12,6 @@
#include <toku_pthread.h> #include <toku_pthread.h>
#include "threadpool.h" #include "threadpool.h"
int verbose = 0;
struct my_threadpool { struct my_threadpool {
THREADPOOL threadpool; THREADPOOL threadpool;
toku_pthread_mutex_t mutex; toku_pthread_mutex_t mutex;
...@@ -92,7 +92,8 @@ usage (void) { ...@@ -92,7 +92,8 @@ usage (void) {
return 1; return 1;
} }
int main(int argc, char *argv[]) { int
test_main(int argc, const char *argv[]) {
int max_threads = 1; int max_threads = 1;
#if defined(__linux__) #if defined(__linux__)
int do_malloc_fail = 0; int do_malloc_fail = 0;
...@@ -100,7 +101,7 @@ int main(int argc, char *argv[]) { ...@@ -100,7 +101,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 (strcmp(arg, "-h") == 0 || strcmp(arg, "-help") == 0) { if (strcmp(arg, "-h") == 0 || strcmp(arg, "-help") == 0) {
return usage(); return usage();
} else if (strcmp(arg, "-v") == 0) { } else if (strcmp(arg, "-v") == 0) {
......
#include "includes.h" #include "includes.h"
#include "test.h"
static void static void
test0 (void) { test0 (void) {
u_int32_t c = x1764_memory("", 0); u_int32_t c = x1764_memory("", 0);
...@@ -68,7 +70,8 @@ test2 (void) { ...@@ -68,7 +70,8 @@ test2 (void) {
} }
} }
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
test0(); test0();
test1(); test1();
test2(); test2();
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#include "test.h"
#include "includes.h" #include "includes.h"
static void ybt_test0 (void) { static void ybt_test0 (void) {
...@@ -67,7 +69,8 @@ static void ybt_test0 (void) { ...@@ -67,7 +69,8 @@ static void ybt_test0 (void) {
toku_memory_check_all_free(); toku_memory_check_all_free();
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int
test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute__((__unused__))) {
ybt_test0(); ybt_test0();
return 0; return 0;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment