From: Ben Pfaff Date: Tue, 26 Oct 2004 19:05:39 +0000 (+0000) Subject: Start of userprog tests. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3aa370fa4559576f22f2d0b07f302c2f60666feb;p=pintos-anon Start of userprog tests. --- diff --git a/grading/userprog/.cvsignore b/grading/userprog/.cvsignore new file mode 100644 index 0000000..a438335 --- /dev/null +++ b/grading/userprog/.cvsignore @@ -0,0 +1 @@ +*.d diff --git a/grading/userprog/Makefile b/grading/userprog/Makefile new file mode 100644 index 0000000..d085aae --- /dev/null +++ b/grading/userprog/Makefile @@ -0,0 +1,12 @@ +SRCDIR = ../../src + +SINGLETONS = create-normal create-empty create-null create-invalid create-long + +define SINGLETON_PROG +PROGS += $(1) +$(1)_SRC = $(1).c +endef + +$(foreach prog,$(SINGLETONS),$(eval $(call SINGLETON_PROG,$(prog)))) + +include $(SRCDIR)/Makefile.userprog diff --git a/grading/userprog/create-empty.c b/grading/userprog/create-empty.c new file mode 100644 index 0000000..3c4c0bd --- /dev/null +++ b/grading/userprog/create-empty.c @@ -0,0 +1,11 @@ +#include +#include + +int +main (void) +{ + printf ("create(\"\"):\n"); + printf ("%d\n", create ("", 0)); + printf ("survived\n"); + return 0; +} diff --git a/grading/userprog/create-invalid.c b/grading/userprog/create-invalid.c new file mode 100644 index 0000000..3b2271b --- /dev/null +++ b/grading/userprog/create-invalid.c @@ -0,0 +1,11 @@ +#include +#include + +int +main (void) +{ + printf ("create(0xc0101234):\n"); + printf ("%d\n", create ((char *) 0xc0101234, 0)); + printf ("survived\n"); + return 0; +} diff --git a/grading/userprog/create-long.c b/grading/userprog/create-long.c new file mode 100644 index 0000000..87f788b --- /dev/null +++ b/grading/userprog/create-long.c @@ -0,0 +1,17 @@ +#include +#include +#include + +int +main (void) +{ + static char name[256]; + memset (name, 'x', sizeof name); + name[sizeof name - 1] = '\0'; + + printf ("create(\"%s\"):\n", name); + printf ("%d\n", create (name, 0)); + printf ("survived\n"); + + return 0; +} diff --git a/grading/userprog/create-normal.c b/grading/userprog/create-normal.c new file mode 100644 index 0000000..b483c9d --- /dev/null +++ b/grading/userprog/create-normal.c @@ -0,0 +1,11 @@ +#include +#include + +int +main (void) +{ + printf ("create(\"quux.dat\"): "); + printf ("%d\n", create ("quux.dat", 0)); + printf ("survived\n"); + return 0; +} diff --git a/grading/userprog/create-null.c b/grading/userprog/create-null.c new file mode 100644 index 0000000..e19d218 --- /dev/null +++ b/grading/userprog/create-null.c @@ -0,0 +1,11 @@ +#include +#include + +int +main (void) +{ + printf ("create(null): "); + printf ("%d\n", create (NULL, 0)); + printf ("survived\n"); + return 0; +} diff --git a/grading/userprog/lib/.cvsignore b/grading/userprog/lib/.cvsignore new file mode 100644 index 0000000..a438335 --- /dev/null +++ b/grading/userprog/lib/.cvsignore @@ -0,0 +1 @@ +*.d diff --git a/grading/userprog/lib/user/.cvsignore b/grading/userprog/lib/user/.cvsignore new file mode 100644 index 0000000..a438335 --- /dev/null +++ b/grading/userprog/lib/user/.cvsignore @@ -0,0 +1 @@ +*.d