Whamcloud - gitweb
use special macro for print time_t, cleanup in includes.
[fs/lustre-release.git] / lustre / liblustre / tests / sanity.c
index ef54d06..aafc5e6 100644 (file)
@@ -52,7 +52,7 @@ struct timeval start;
 
 extern char *lustre_path;
 
-#define ENTRY(str)                                                      \
+#define ENTER(str)                                                      \
         do {                                                            \
                 char buf[100];                                          \
                 int len;                                                \
@@ -108,7 +108,7 @@ int t2(char *name)
 {
         char path[MAX_PATH_LENGTH] = "";
 
-        ENTRY("mkdir/rmdir");
+        ENTER("mkdir/rmdir");
         snprintf(path, MAX_PATH_LENGTH, "%s/test_t2", lustre_path);
 
         t_mkdir(path);
@@ -120,7 +120,7 @@ int t3(char *name)
 {
         char path[MAX_PATH_LENGTH] = "";
 
-        ENTRY("regular stat");
+        ENTER("regular stat");
         snprintf(path, MAX_PATH_LENGTH, "%s/test_t3", lustre_path);
 
         t_touch(path);
@@ -133,7 +133,7 @@ int t4(char *name)
 {
         char path[MAX_PATH_LENGTH] = "";
 
-        ENTRY("dir stat");
+        ENTER("dir stat");
         snprintf(path, MAX_PATH_LENGTH, "%s/test_t4", lustre_path);
 
         t_mkdir(path);
@@ -147,7 +147,7 @@ int t6(char *name)
         char path[MAX_PATH_LENGTH] = "";
         char path2[MAX_PATH_LENGTH] = "";
 
-        ENTRY("symlink");
+        ENTER("symlink");
         snprintf(path, MAX_PATH_LENGTH, "%s/test_t6", lustre_path);
         snprintf(path2, MAX_PATH_LENGTH, "%s/test_t6_link", lustre_path);
 
@@ -167,7 +167,7 @@ int t6b(char *name)
         char *tmp;
         int fd;
 
-        ENTRY("symlink + chdir and open");
+        ENTER("symlink + chdir and open");
         snprintf(path, MAX_PATH_LENGTH, "%s/test_t6b", lustre_path);
         snprintf(path2, MAX_PATH_LENGTH, "%s/test_t6b_link", lustre_path);
 
@@ -199,7 +199,7 @@ int t7(char *name)
         char path[MAX_PATH_LENGTH] = "";
         int rc;
 
-        ENTRY("mknod");
+        ENTER("mknod");
         snprintf(path, MAX_PATH_LENGTH, "%s/test_t7", lustre_path);
 
         if (geteuid() != 0) {
@@ -220,7 +220,7 @@ int t8(char *name)
 {
         char path[MAX_PATH_LENGTH] = "";
 
-        ENTRY("chmod");
+        ENTER("chmod");
         snprintf(path, MAX_PATH_LENGTH, "%s/test_t8", lustre_path);
 
         /* Check file. */
@@ -243,7 +243,7 @@ int t9(char *name)
         char path[MAX_PATH_LENGTH] = "";
         char path2[MAX_PATH_LENGTH] = "";
 
-        ENTRY("hard link");
+        ENTER("hard link");
         snprintf(path, MAX_PATH_LENGTH, "%s/test_t9", lustre_path);
         snprintf(path2, MAX_PATH_LENGTH, "%s/test_t9_link", lustre_path);
 
@@ -266,7 +266,7 @@ int t10(char *name)
         char rename2[MAX_PATH_LENGTH] = "";
         char rename3[MAX_PATH_LENGTH] = "";
 
-        ENTRY("rename");
+        ENTER("rename");
         snprintf(dir1, MAX_PATH_LENGTH, "%s/test_t10_dir1", lustre_path);
         snprintf(dir2, MAX_PATH_LENGTH, "%s/test_t10_dir2", lustre_path);
         snprintf(path1, MAX_PATH_LENGTH, "%s/test_t10_reg1", lustre_path);
@@ -294,7 +294,7 @@ int t11(char *name)
         char *base=lustre_path;
         char path[MAX_PATH_LENGTH], path2[MAX_PATH_LENGTH];
         int i, j, level = 5, nreg = 5;
-        ENTRY("deep tree");
+        ENTER("deep tree");
 
         safe_strncpy(path, base, MAX_PATH_LENGTH);
 
@@ -330,7 +330,7 @@ int t12(char *name)
         char dir[MAX_PATH_LENGTH] = "";
         char buf[1024*128];
         int fd;
-        ENTRY("empty directory readdir");
+        ENTER("empty directory readdir");
         snprintf(dir, MAX_PATH_LENGTH, "%s/test_t12_dir", lustre_path);
 
         t_mkdir(dir);
@@ -349,7 +349,7 @@ int t13(char *name)
         const int nfiles = 20;
         char *prefix = "test13_filename_prefix_";
         int fd, i;
-        ENTRY("multiple entries directory readdir");
+        ENTER("multiple entries directory readdir");
         snprintf(dir, MAX_PATH_LENGTH, "%s/test_t13_dir/", lustre_path);
 
         t_mkdir(dir);
@@ -377,10 +377,10 @@ int t14(char *name)
         char buf[1024];
         const int nfiles = 256;
         char *prefix = "test14_filename_long_prefix_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA___";
-        struct dirent64 *ent;
+        cfs_dirent_t *ent;
         int fd, i, rc, pos, index;
         loff_t base = 0;
-        ENTRY(">1 block(4k) directory readdir");
+        ENTER(">1 block(4k) directory readdir");
         snprintf(dir, MAX_PATH_LENGTH, "%s/test_t14_dir/", lustre_path);
 
         rc = mkdir(dir, 0755);
@@ -401,7 +401,7 @@ int t14(char *name)
                 while (pos < rc) {
                         char *item;
 
-                        ent = (struct dirent64 *) ((char*) buf + pos);
+                        ent = (void *) buf + pos;
                         item = (char *) ent->d_name;
                         if (!strcmp(item, ".") || !strcmp(item, ".."))
                                 goto iter;
@@ -437,7 +437,7 @@ int t15(char *name)
 {
         char file[MAX_PATH_LENGTH] = "";
         int fd;
-        ENTRY("open-stat-close");
+        ENTER("open-stat-close");
         snprintf(file, MAX_PATH_LENGTH, "%s/test_t15_file", lustre_path);
 
         t_touch(file);
@@ -451,7 +451,7 @@ int t15(char *name)
 int t16(char *name)
 {
         char file[MAX_PATH_LENGTH] = "";
-        ENTRY("small-write-read");
+        ENTER("small-write-read");
         snprintf(file, MAX_PATH_LENGTH, "%s/test_t16_file", lustre_path);
 
         t_echo_create(file, "aaaaaaaaaaaaaaaaaaaaaa");
@@ -464,7 +464,7 @@ int t17(char *name)
 {
         char file[MAX_PATH_LENGTH] = "";
         int fd;
-        ENTRY("open-unlink without close");
+        ENTER("open-unlink without close");
         snprintf(file, MAX_PATH_LENGTH, "%s/test_t17_file", lustre_path);
 
         fd = open(file, O_WRONLY | O_CREAT, 0666);
@@ -482,7 +482,7 @@ int t18(char *name)
         char buf[128];
         int fd, i;
         struct stat statbuf[3];
-        ENTRY("write should change mtime/ctime");
+        ENTER("write should change mtime/ctime");
         snprintf(file, MAX_PATH_LENGTH, "%s/test_t18_file", lustre_path);
 
         for (i = 0; i < 3; i++) {
@@ -521,7 +521,7 @@ int t18b(char *name)
         char file[MAX_PATH_LENGTH] = "";
         int i;
         struct stat statbuf[3];
-        ENTRY("utime should change mtime/atime/ctime");
+        ENTER("utime should change mtime/atime/ctime");
         snprintf(file, MAX_PATH_LENGTH, "%s/test_t18b_file", lustre_path);
         t_touch(file);
 
@@ -569,7 +569,7 @@ int t19(char *name)
         char file[MAX_PATH_LENGTH] = "";
         int fd;
         int result;
-        ENTRY("open(O_TRUNC) should truncate file to 0-length");
+        ENTER("open(O_TRUNC) should truncate file to 0-length");
         snprintf(file, MAX_PATH_LENGTH, "%s/test_t19_file", lustre_path);
 
         t_echo_create(file, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
@@ -594,7 +594,7 @@ int t20(char *name)
         struct iovec iov[2];
         char buf[100];
         ssize_t ret;
-        ENTRY("trap app's general bad pointer for file i/o");
+        ENTER("trap app's general bad pointer for file i/o");
         snprintf(file, MAX_PATH_LENGTH, "%s/test_t20_file", lustre_path);
 
         fd = open(file, O_RDWR|O_CREAT, (mode_t)0666);
@@ -676,7 +676,7 @@ int t21(char *name)
                 .l_whence = SEEK_SET,
         };
 
-        ENTRY("basic fcntl support");
+        ENTER("basic fcntl support");
         snprintf(file, MAX_PATH_LENGTH, "%s/test_t21_file", lustre_path);
 
         fd = open(file, O_RDWR|O_CREAT, (mode_t)0666);
@@ -711,7 +711,7 @@ int t22(char *name)
         char *str = "1234567890";
         char buf[100];
         ssize_t ret;
-        ENTRY("make sure O_APPEND take effect");
+        ENTER("make sure O_APPEND take effect");
         snprintf(file, MAX_PATH_LENGTH, "%s/test_t22_file", lustre_path);
 
         fd = open(file, O_RDWR|O_CREAT|O_APPEND, (mode_t)0666);
@@ -772,10 +772,10 @@ int t23(char *name)
 {
         char path[MAX_PATH_LENGTH];
         int fd;
-        long long ret;
-        long long off;
+        off_t ret;
+        off_t off;
 
-        ENTRY("handle seek > 2GB");
+        ENTER("handle seek > 2GB");
         snprintf(path, MAX_PATH_LENGTH, "%s/f%s", lustre_path, name);
 
         fd = open(path, O_WRONLY | O_CREAT | O_LARGEFILE, 0666);
@@ -965,7 +965,7 @@ int t50(char *name)
         int np = 1;
         loff_t offset = 0;
 
-        ENTRY("4k aligned i/o sanity");
+        ENTER("4k aligned i/o sanity");
         while (np <= _npages) {
                 printf("%3d per xfer(total %d)...\t", np, _npages);
                 fflush(stdout);
@@ -983,7 +983,7 @@ int t50b(char *name)
         int i;
         long long offset;
 
-        ENTRY("4k un-aligned i/o sanity");
+        ENTER("4k un-aligned i/o sanity");
         for (i = 0; i < sizeof(off_array)/sizeof(loff_t); i++) {
                 offset = off_array[i];
                 printf("16 per xfer(total %d), offset %10lld...\t",
@@ -1010,7 +1010,7 @@ int t51(char *name)
         long long size;
         int result;
 
-        ENTRY("truncate() should truncate file to proper length");
+        ENTER("truncate() should truncate file to proper length");
         snprintf(file, MAX_PATH_LENGTH, "%s/test_t51_file", lustre_path);
 
         for (size = 0; size < T51_NR * T51_STEP; size += T51_STEP) {
@@ -1059,7 +1059,7 @@ int t52(char *name)
         time_t diff;
         int fd, i;
 
-        ENTRY("atime should be updated during read");
+        ENTER("atime should be updated during read");
         snprintf(file, MAX_PATH_LENGTH, "%s/test_t52_file", lustre_path);
 
         t_echo_create(file, "check atime update during read");
@@ -1098,7 +1098,7 @@ int t53(char *name)
         struct stat stat_buf;   /* struct buffer to hold file info. */
         time_t mtime, atime;
  
-        ENTRY("mtime/atime should be updated by utime() call");
+        ENTER("mtime/atime should be updated by utime() call");
         snprintf(file, MAX_PATH_LENGTH, "%s/test_t53_file", lustre_path);
 
         t_echo_create(file, "check mtime/atime update by utime() call");
@@ -1135,7 +1135,7 @@ int t54(char *name)
         struct flock lock;
         int fd, err;
 
-        ENTRY("fcntl should return 0 when succeed in getting flock");
+        ENTER("fcntl should return 0 when succeed in getting flock");
         snprintf(file, MAX_PATH_LENGTH, "%s/test_t54_file", lustre_path);
 
         t_echo_create(file, "fcntl should return 0 when succeed");
@@ -1180,7 +1180,7 @@ int t55(char *name)
         struct lov_user_ost_data *lo = NULL;
         int index, fd, buflen, rc;
 
-        ENTRY("setstripe/getstripe");
+        ENTER("setstripe/getstripe");
         snprintf(path, MAX_PATH_LENGTH, "%s/test_t55", lustre_path);
         snprintf(file, MAX_PATH_LENGTH, "%s/test_t55/file_t55", lustre_path);
       
@@ -1341,9 +1341,9 @@ int t56(char *name)
         size_t nbytes;
         off_t basep = 0;
         ssize_t rc = 0;
-        struct dirent dir;
+        cfs_dirent_t dir;
 
-        ENTRY("getdirentries should fail if nbytes is too small");
+        ENTER("getdirentries should fail if nbytes is too small");
 
         /* Set count to be very small.  The result should be EINVAL */
         nbytes = 8;