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: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 "/"
|
|
|
|
|
|
|
|
int main (int argc __attribute__((__unused__)),
|
|
|
|
char *argv[] __attribute__((__unused__))) {
|
|
|
|
int r;
|
|
|
|
long long lognum;
|
|
|
|
system(rmrf);
|
2013-04-16 23:57:27 -04:00
|
|
|
r = 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:27 -04:00
|
|
|
r = creat(dname "/log01.tokulog", S_IRWXU); 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:27 -04:00
|
|
|
r = creat(dname "/log123456789012345.tokulog", S_IRWXU); 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:27 -04:00
|
|
|
r = creat(dname "/log3.tokulog", S_IRWXU); 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
|
|
|
|