From: Ben Pfaff Date: Wed, 6 Apr 2005 20:55:40 +0000 (+0000) Subject: Add ls, mkdir user test programs. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=202cb2ab659c2ff94a3cf58ae86400095e767fc3;p=pintos-anon Add ls, mkdir user test programs. --- diff --git a/src/tests/userprog/.cvsignore b/src/tests/userprog/.cvsignore index 6ebaa81..dda06da 100644 --- a/src/tests/userprog/.cvsignore +++ b/src/tests/userprog/.cvsignore @@ -4,6 +4,8 @@ echo halt insult lineup +ls matmult +mkdir recursor shell diff --git a/src/tests/userprog/Makefile b/src/tests/userprog/Makefile index 2aad5a3..8f7efe5 100644 --- a/src/tests/userprog/Makefile +++ b/src/tests/userprog/Makefile @@ -3,7 +3,7 @@ SRCDIR = ../.. # Test programs to compile, and a list of sources for each. # To add a new test, put its name on the PROGS list # and then add a name_SRC line that lists its source files. -PROGS = bubsort echo halt insult lineup matmult recursor shell +PROGS = bubsort echo halt insult lineup ls matmult mkdir recursor shell bubsort_SRC = bubsort.c echo_SRC = echo.c halt_SRC = halt.c @@ -12,5 +12,7 @@ lineup_SRC = lineup.c matmult_SRC = matmult.c recursor_SRC = recursor.c shell_SRC = shell.c +ls_SRC = ls.c +mkdir_SRC = mkdir.c include $(SRCDIR)/Makefile.userprog diff --git a/src/tests/userprog/ls.c b/src/tests/userprog/ls.c new file mode 100644 index 0000000..d64d01e --- /dev/null +++ b/src/tests/userprog/ls.c @@ -0,0 +1,12 @@ +/* ls.c + + Lists the current directory. */ + +#include + +int +main (void) +{ + lsdir (); + return 0; +} diff --git a/src/tests/userprog/mkdir.c b/src/tests/userprog/mkdir.c new file mode 100644 index 0000000..ae6913c --- /dev/null +++ b/src/tests/userprog/mkdir.c @@ -0,0 +1,18 @@ +/* mkdir.c + + Creates a directory. */ + +#include +#include + +int +main (int argc, char *argv[]) +{ + if (argc != 2) + PANIC ("usage: %s DIRECTORY\n", argv[0]); + + if (!mkdir (argv[1])) + PANIC ("%s: mkdir failed\n", argv[1]); + + return 0; +}