X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Ftests%2Ffilesys%2Fextended%2Fdir-lsdir.c;h=254e59501b504f2dfb7c7d08eb1ca67ccf41d7ee;hb=73389b59f54bfed8eb0cb370a5ffec1223686a9e;hp=1896de32d884b07628331e2918e570ce7f90cb32;hpb=615bf3b3d2a8573ed6fb9ddc0055745e163ac999;p=pintos-anon diff --git a/src/tests/filesys/extended/dir-lsdir.c b/src/tests/filesys/extended/dir-lsdir.c index 1896de3..254e595 100644 --- a/src/tests/filesys/extended/dir-lsdir.c +++ b/src/tests/filesys/extended/dir-lsdir.c @@ -1,3 +1,5 @@ +/* Lists the contents of a directory using readdir. */ + #include #include "tests/lib.h" #include "tests/main.h" @@ -5,5 +7,15 @@ void test_main (void) { - lsdir (); + int fd; + char name[READDIR_MAX_LEN + 1]; + + CHECK ((fd = open (".")) > 1, "open ."); + CHECK (isdir (fd), "isdir(.)"); + + while (readdir (fd, name)) + msg ("readdir: \"%s\"", name); + + msg ("close ."); + close (fd); }