Whamcloud - gitweb
liblustre:
authorericm <ericm>
Tue, 2 Mar 2004 14:56:14 +0000 (14:56 +0000)
committerericm <ericm>
Tue, 2 Mar 2004 14:56:14 +0000 (14:56 +0000)
 - fix broken readdir test

lustre/liblustre/tests/sanity.c
lustre/liblustre/tests/test_common.c
lustre/liblustre/tests/test_common.h

index 664be40..944ae9c 100644 (file)
@@ -146,7 +146,6 @@ static void pages_io(int xfer, loff_t pos)
                 }
        }
         printf("succefully write %d pages(%d per xfer)\n", _npages, xfer);
-
         memset(_buffer, 0, sizeof(_buffer));
 
         /* read */
@@ -324,7 +323,7 @@ void t12()
         ENTRY("empty directory readdir");
 
         t_mkdir(dir);
-        fd = t_open(dir);
+        fd = t_opendir(dir);
         t_ls(fd, buf, sizeof(buf));
         t_close(fd);
         t_rmdir(dir);
@@ -347,7 +346,7 @@ void t13()
                 sprintf(name, "%s%s%05d", dir, prefix, i);
                 t_touch(name);
         }
-        fd = t_open(dir);
+        fd = t_opendir(dir);
         t_ls(fd, buf, sizeof(buf));
         t_close(fd);
         printf("Cleanup...\n");
@@ -375,7 +374,7 @@ void t14()
                 sprintf(name, "%s%s%05d", dir, prefix, i);
                 t_touch(name);
         }
-        fd = t_open(dir);
+        fd = t_opendir(dir);
         t_ls(fd, buf, sizeof(buf));
         t_close(fd);
         printf("Cleanup...\n");
index 6f6676e..a87f0fa 100644 (file)
@@ -181,6 +181,18 @@ int t_open(const char *path)
         return fd;
 }
 
+int t_opendir(const char *path)
+{
+        int fd;
+
+        fd = open(path, O_RDONLY);
+        if (fd < 0) {
+                printf("opendir(%s) error: %s\n", path, strerror(errno));
+                EXIT_RET(fd);
+        }
+        return fd;
+}
+
 void t_close(int fd)
 {
         int rc;
index 9d537cc..c3687b9 100644 (file)
@@ -21,6 +21,7 @@ void t_chmod(const char *path, const char *format, ...);
 void t_rename(const char *oldpath, const char *newpath);
 int t_open_readonly(const char *path);
 int t_open(const char *path);
+int t_opendir(const char *path);
 void t_close(int fd);
 int t_check_stat(const char *name, struct stat *buf);
 int t_check_stat_fail(const char *name);