Start of userprog tests.
authorBen Pfaff <blp@cs.stanford.edu>
Tue, 26 Oct 2004 19:05:39 +0000 (19:05 +0000)
committerBen Pfaff <blp@cs.stanford.edu>
Tue, 26 Oct 2004 19:05:39 +0000 (19:05 +0000)
grading/userprog/.cvsignore [new file with mode: 0644]
grading/userprog/Makefile [new file with mode: 0644]
grading/userprog/create-empty.c [new file with mode: 0644]
grading/userprog/create-invalid.c [new file with mode: 0644]
grading/userprog/create-long.c [new file with mode: 0644]
grading/userprog/create-normal.c [new file with mode: 0644]
grading/userprog/create-null.c [new file with mode: 0644]
grading/userprog/lib/.cvsignore [new file with mode: 0644]
grading/userprog/lib/user/.cvsignore [new file with mode: 0644]

diff --git a/grading/userprog/.cvsignore b/grading/userprog/.cvsignore
new file mode 100644 (file)
index 0000000..a438335
--- /dev/null
@@ -0,0 +1 @@
+*.d
diff --git a/grading/userprog/Makefile b/grading/userprog/Makefile
new file mode 100644 (file)
index 0000000..d085aae
--- /dev/null
@@ -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 (file)
index 0000000..3c4c0bd
--- /dev/null
@@ -0,0 +1,11 @@
+#include <stdio.h>
+#include <syscall.h>
+
+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 (file)
index 0000000..3b2271b
--- /dev/null
@@ -0,0 +1,11 @@
+#include <stdio.h>
+#include <syscall.h>
+
+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 (file)
index 0000000..87f788b
--- /dev/null
@@ -0,0 +1,17 @@
+#include <stdio.h>
+#include <string.h>
+#include <syscall.h>
+
+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 (file)
index 0000000..b483c9d
--- /dev/null
@@ -0,0 +1,11 @@
+#include <stdio.h>
+#include <syscall.h>
+
+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 (file)
index 0000000..e19d218
--- /dev/null
@@ -0,0 +1,11 @@
+#include <stdio.h>
+#include <syscall.h>
+
+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 (file)
index 0000000..a438335
--- /dev/null
@@ -0,0 +1 @@
+*.d
diff --git a/grading/userprog/lib/user/.cvsignore b/grading/userprog/lib/user/.cvsignore
new file mode 100644 (file)
index 0000000..a438335
--- /dev/null
@@ -0,0 +1 @@
+*.d