mariadb/portability/tests/test-fsync-directory.c
Yoni Fogel 3a208cebc4 closes [t:4913]. Modelines now synchronized in every source/header file (and always top two lines)
git-svn-id: file:///svn/toku/tokudb@43762 c7de825b-a66e-492c-adef-691d508d4ae1
2013-04-17 00:00:36 -04:00

41 lines
1.1 KiB
C

/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
// vim: expandtab:ts=8:sw=4:softtabstop=4:
// use strace to very that the toku_fsync_directory function works
#include "test.h"
#include <stdlib.h>
#include <string.h>
static int verbose = 0;
int test_main(int argc, char *const argv[]) {
int r;
for (int i=1; i<argc; i++) {
if (strcmp(argv[i], "-v") == 0) {
if (verbose < 0) verbose = 0;
verbose++;
continue;
} else if (strcmp(argv[i], "-q") == 0) {
verbose = 0;
continue;
} else {
exit(1);
}
}
r = system("rm -rf " ENVDIR);
CKERR(r);
r = toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO);
CKERR(r);
r = toku_os_mkdir(ENVDIR "/test", S_IRWXU+S_IRWXG+S_IRWXO);
CKERR(r);
r = toku_fsync_directory(""); CKERR(r);
r = toku_fsync_directory("."); CKERR(r);
r = toku_fsync_directory(ENVDIR "/test/a"); CKERR(r);
r = toku_fsync_directory("./" ENVDIR "/test/a"); CKERR(r);
r = toku_fsync_directory("/tmp/x"); CKERR(r);
return 0;
}