From 1199498179474d4e1971779cba2e110fa038f261 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 29 Oct 2004 18:37:39 +0000 Subject: [PATCH] Add more tests. --- grading/userprog/sc-bad-arg.c | 13 +++++++++++++ grading/userprog/sc-bad-arg.exp | 2 ++ grading/userprog/sc-bad-sp.c | 11 +++++++++++ grading/userprog/sc-bad-sp.exp | 2 ++ grading/userprog/tests.txt | 8 ++++---- 5 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 grading/userprog/sc-bad-arg.c create mode 100644 grading/userprog/sc-bad-arg.exp create mode 100644 grading/userprog/sc-bad-sp.c create mode 100644 grading/userprog/sc-bad-sp.exp diff --git a/grading/userprog/sc-bad-arg.c b/grading/userprog/sc-bad-arg.c new file mode 100644 index 0000000..8bbd8ea --- /dev/null +++ b/grading/userprog/sc-bad-arg.c @@ -0,0 +1,13 @@ +#include +#include + +int +main (void) +{ + printf ("(sc-bad-arg) begin\n"); + asm volatile ("mov $0xbffffffc, %%esp; movl $%0, (%%esp); int $0x30" + : + : "i" (SYS_exit)); + printf ("(sc-bad-arg) end\n"); + return 0; +} diff --git a/grading/userprog/sc-bad-arg.exp b/grading/userprog/sc-bad-arg.exp new file mode 100644 index 0000000..7babb3c --- /dev/null +++ b/grading/userprog/sc-bad-arg.exp @@ -0,0 +1,2 @@ +(sc-bad-arg) begin +sc-bad-arg: exit(-1) diff --git a/grading/userprog/sc-bad-sp.c b/grading/userprog/sc-bad-sp.c new file mode 100644 index 0000000..9d996e9 --- /dev/null +++ b/grading/userprog/sc-bad-sp.c @@ -0,0 +1,11 @@ +#include +#include + +int +main (void) +{ + printf ("(sc-bad-sp) begin\n"); + asm volatile ("mov $0xc0101234, %%esp; int $0x30"); + printf ("(sc-bad-sp) end\n"); + return 0; +} diff --git a/grading/userprog/sc-bad-sp.exp b/grading/userprog/sc-bad-sp.exp new file mode 100644 index 0000000..4d72143 --- /dev/null +++ b/grading/userprog/sc-bad-sp.exp @@ -0,0 +1,2 @@ +(sc-bad-sp) begin +sc-bad-sp: exit(-1) diff --git a/grading/userprog/tests.txt b/grading/userprog/tests.txt index fbebaac..73027a4 100644 --- a/grading/userprog/tests.txt +++ b/grading/userprog/tests.txt @@ -29,7 +29,7 @@ System calls: create -1 create-long: pass long file name to create system call -1 create-exists: pass name of an existing file to create system call -1 create-bound: pass name of file crossing page boundary -Score: /7 +Score: /8 System calls: open -2 open-normal: open a file in the most normal way @@ -38,7 +38,7 @@ System calls: open -1 open-empty: pass empty string to open system call -1 open-null: pass null pointer to open system call -1 open-twice: open the same file twice -Score: /7 +Score: /9 System calls: close -2 close-normal: close an open file in the most normal way @@ -55,7 +55,7 @@ System calls: read -1 read-zero: try to read zero bytes -1 read-stdout: try to read from stdout -1 read-bad-fd: try to read from invalid file descriptor -Score: /7 +Score: /9 System calls: write -2 write-normal: write to open file in most normal way @@ -64,7 +64,7 @@ System calls: write -1 write-zero: try to write zero bytes -1 write-stdin: try to write to stdin -1 write-bad-fd: try to write to invalid file descriptor -Score: /7 +Score: /9 System calls: exec -2 exec-once: call exec/join once -- 2.30.2