recovery-no-log.c 898 Bytes
Newer Older
1
#ident "$Id$"
2 3
// test recovery with no log

4 5 6
#include "test.h"
#include "includes.h"

7
#define TESTDIR __SRCFILE__ ".dir"
8 9 10 11 12 13

static int 
run_test(void) {
    int r;

    // setup the test dir
14 15
    r = system("rm -rf " TESTDIR);
    CKERR(r);
16 17
    r = toku_os_mkdir(TESTDIR, S_IRWXU); assert(r == 0);

18
    // redirect stderr
19
    int devnul = open(DEV_NULL_FILE, O_WRONLY);
20
    assert(devnul>=0);
21
    r = toku_dup2(devnul, fileno(stderr)); 	    assert(r==fileno(stderr));
22 23
    r = close(devnul);                      assert(r==0);

24
    // run recovery
25 26 27 28
    r = tokudb_recover(NULL,
		       NULL_prepared_txn_callback,
		       NULL_keep_cachetable_callback,
		       NULL_logger, TESTDIR, TESTDIR, 0, 0, 0, NULL, 0); 
29
    assert(r != 0);
30 31 32 33

    r = system("rm -rf " TESTDIR);
    CKERR(r);

34 35 36 37 38 39 40 41 42
    return 0;
}

int
test_main(int UU(argc), const char *UU(argv[])) {
    int r;
    r = run_test();
    return r;
}