From: ericm Date: Tue, 2 Mar 2004 14:56:14 +0000 (+0000) Subject: liblustre: X-Git-Tag: v1_7_100~2524 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=02a159972bde3db9e09246e3ed490252b1dd7251;p=fs%2Flustre-release.git liblustre: - fix broken readdir test --- diff --git a/lustre/liblustre/tests/sanity.c b/lustre/liblustre/tests/sanity.c index 664be40..944ae9c 100644 --- a/lustre/liblustre/tests/sanity.c +++ b/lustre/liblustre/tests/sanity.c @@ -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"); diff --git a/lustre/liblustre/tests/test_common.c b/lustre/liblustre/tests/test_common.c index 6f6676e..a87f0fa 100644 --- a/lustre/liblustre/tests/test_common.c +++ b/lustre/liblustre/tests/test_common.c @@ -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; diff --git a/lustre/liblustre/tests/test_common.h b/lustre/liblustre/tests/test_common.h index 9d537cc..c3687b9 100644 --- a/lustre/liblustre/tests/test_common.h +++ b/lustre/liblustre/tests/test_common.h @@ -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);