2007-11-29 14:18:54 +00:00
|
|
|
/* -*- mode: C; c-basic-offset: 4 -*- */
|
2008-01-24 15:10:32 +00:00
|
|
|
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
|
2007-11-29 14:18:54 +00:00
|
|
|
|
2013-04-16 23:57:32 -04:00
|
|
|
#include "test.h"
|
|
|
|
|
2013-04-16 23:57:21 -04:00
|
|
|
#include "includes.h"
|
2007-08-10 21:15:17 +00:00
|
|
|
|
2008-03-11 18:51:26 +00:00
|
|
|
#define dname __FILE__ ".dir"
|
2007-08-10 21:15:17 +00:00
|
|
|
#define rmrf "rm -rf " dname "/"
|
|
|
|
|
2013-04-16 23:57:32 -04:00
|
|
|
int
|
|
|
|
test_main (int argc __attribute__((__unused__)),
|
|
|
|
const char *argv[] __attribute__((__unused__))) {
|
2007-08-10 21:15:17 +00:00
|
|
|
int r;
|
|
|
|
long long lognum;
|
2013-04-16 23:59:07 -04:00
|
|
|
r = system(rmrf);
|
|
|
|
CKERR(r);
|
2013-04-16 23:57:28 -04:00
|
|
|
r = toku_os_mkdir(dname, S_IRWXU); assert(r==0);
|
2007-11-29 18:14:40 +00:00
|
|
|
r = toku_logger_find_next_unused_log_file(dname,&lognum);
|
2007-08-10 21:15:17 +00:00
|
|
|
assert(r==0 && lognum==0LL);
|
|
|
|
|
2013-04-16 23:57:40 -04:00
|
|
|
mode_t mode = S_IRWXU + S_IRWXG + S_IRWXO;
|
|
|
|
r = open(dname "/log01.tokulog", O_WRONLY + O_CREAT + O_BINARY, mode); assert(r>=0);
|
2007-08-10 21:15:17 +00:00
|
|
|
r = close(r); assert(r==0);
|
|
|
|
|
2007-11-29 18:14:40 +00:00
|
|
|
r = toku_logger_find_next_unused_log_file(dname,&lognum);
|
2007-08-10 21:15:17 +00:00
|
|
|
assert(r==0 && lognum==2LL);
|
|
|
|
|
2013-04-16 23:57:40 -04:00
|
|
|
r = open(dname "/log123456789012345.tokulog", O_WRONLY + O_CREAT + O_BINARY, mode); assert(r>=0);
|
2007-08-10 21:15:17 +00:00
|
|
|
r = close(r); assert(r==0);
|
2007-11-29 18:14:40 +00:00
|
|
|
r = toku_logger_find_next_unused_log_file(dname,&lognum);
|
2007-08-10 21:15:17 +00:00
|
|
|
assert(r==0 && lognum==123456789012346LL);
|
|
|
|
|
2013-04-16 23:57:40 -04:00
|
|
|
r = open(dname "/log3.tokulog", O_WRONLY + O_CREAT + O_BINARY, mode); assert(r>=0);
|
2007-08-10 21:15:17 +00:00
|
|
|
r = close(r); assert(r==0);
|
2007-11-29 18:14:40 +00:00
|
|
|
r = toku_logger_find_next_unused_log_file(dname,&lognum);
|
2007-08-10 21:15:17 +00:00
|
|
|
assert(r==0 && lognum==123456789012346LL);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2007-08-10 19:24:45 +00:00
|
|
|
|