From: Ben Pfaff Date: Fri, 12 Nov 2004 06:01:17 +0000 (+0000) Subject: Update tests. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06aa2c0d714c83f0300559b48972bf454f3dab56;p=pintos-anon Update tests. --- diff --git a/grading/threads/review.txt b/grading/threads/review.txt index 62c5d81..08585b5 100644 --- a/grading/threads/review.txt +++ b/grading/threads/review.txt @@ -14,7 +14,6 @@ DESIGN [[/40]] -------------- -20 Missing or far too brief DESIGNDOC - -2 Troublesome or unexplained dependencies -2 Changing interfaces, each (max -6) DESIGNDOC (per problem): diff --git a/grading/userprog/child-bad.c b/grading/userprog/child-bad.c index a256e63..914bde6 100644 --- a/grading/userprog/child-bad.c +++ b/grading/userprog/child-bad.c @@ -5,7 +5,7 @@ int main (void) { printf ("(child-bad) begin\n"); - asm volatile ("mov $0xc0101234, %esp; int $0x30"); + asm volatile ("mov $0x20101234, %esp; int $0x30"); printf ("(child-bad) end\n"); return 0; } diff --git a/grading/userprog/close-bad-fd.c b/grading/userprog/close-bad-fd.c index cdea3c5..ad929a8 100644 --- a/grading/userprog/close-bad-fd.c +++ b/grading/userprog/close-bad-fd.c @@ -5,7 +5,7 @@ int main (void) { printf ("(close-bad-fd) begin\n"); - close (0xc0101234); + close (0x20101234); printf ("(close-bad-fd) end\n"); return 0; } diff --git a/grading/userprog/create-bad-ptr.c b/grading/userprog/create-bad-ptr.c index 514234e..a6b7f76 100644 --- a/grading/userprog/create-bad-ptr.c +++ b/grading/userprog/create-bad-ptr.c @@ -5,7 +5,7 @@ int main (void) { printf ("(create-bad-ptr) begin\n"); - create ((char *) 0xc0101234, 0); + create ((char *) 0x20101234, 0); printf ("(create-bad-ptr) end\n"); return 0; } diff --git a/grading/userprog/exec-bad-ptr.c b/grading/userprog/exec-bad-ptr.c index 28dcc9b..fce7adb 100644 --- a/grading/userprog/exec-bad-ptr.c +++ b/grading/userprog/exec-bad-ptr.c @@ -5,7 +5,7 @@ int main (void) { printf ("(exec-bad-ptr) begin\n"); - exec ((char *) 0xc0101234); + exec ((char *) 0x20101234); printf ("(exec-bad-ptr) end\n"); return 0; } diff --git a/grading/userprog/join-bad-pid.c b/grading/userprog/join-bad-pid.c index 9729097..d2902bb 100644 --- a/grading/userprog/join-bad-pid.c +++ b/grading/userprog/join-bad-pid.c @@ -5,7 +5,7 @@ int main (void) { printf ("(join-bad-pid) begin\n"); - join ((pid_t) 0xc0101234); + join ((pid_t) 0x20101234); printf ("(join-bad-pid) end\n"); return 0; } diff --git a/grading/userprog/open-bad-ptr.c b/grading/userprog/open-bad-ptr.c index 71bd119..f73e6d8 100644 --- a/grading/userprog/open-bad-ptr.c +++ b/grading/userprog/open-bad-ptr.c @@ -5,7 +5,7 @@ int main (void) { printf ("(open-bad-ptr) begin\n"); - open ((char *) 0xc0101234); + open ((char *) 0x20101234); printf ("(open-bad-ptr) end\n"); return 0; } diff --git a/grading/userprog/read-bad-fd.c b/grading/userprog/read-bad-fd.c index eb9700d..959687c 100644 --- a/grading/userprog/read-bad-fd.c +++ b/grading/userprog/read-bad-fd.c @@ -6,7 +6,7 @@ main (void) { char buf; printf ("(read-bad-fd) begin\n"); - read (0xc0101234, &buf, 1); + read (0x20101234, &buf, 1); printf ("(read-bad-fd) end\n"); return 0; } diff --git a/grading/userprog/read-bad-ptr.c b/grading/userprog/read-bad-ptr.c index 860e485..5ddb2a3 100644 --- a/grading/userprog/read-bad-ptr.c +++ b/grading/userprog/read-bad-ptr.c @@ -11,7 +11,7 @@ main (void) if (handle < 2) printf ("(read-bad-ptr) fail: open() returned %d\n", handle); - read (handle, (char *) 0xc0101234, 123); + read (handle, (char *) 0x20101234, 123); printf ("(read-bad-ptr) end\n"); return 0; diff --git a/grading/userprog/review.txt b/grading/userprog/review.txt index 38ea7ac..c48657e 100644 --- a/grading/userprog/review.txt +++ b/grading/userprog/review.txt @@ -1,65 +1,55 @@ -Design (/120 points) --------------------- +Test cases [[/25]] +------------------ + -15 Didn't write own test cases + -10 Insufficient testing -a) DESIGNDOC (/60 pts) - a) Arg passing (/10) - b) System calls (/20) - Didn't discuss global vs local allocation of fileID's - How to handle exceptions & why (ie killing processes - that do bad things) - Explaining choice of openFileID's & ASIDS - c) Multiprogramming (/30) - How to find a free page. - Explaining how new processes are executed. - How they deal with running out of memory error on loading. +Design [[/100]] +--------------- -b) Other Design (/60 pts) +Quality of DESIGNDOC + -10 Arg passing + -20 Copying data around: + User-to-kernel copying. + Kernel-to-user copying. + String copying. + -20 System calls: + Allocation of file descriptors. + Handling exceptions and related cleanup. + pid_t rationale (if they changed tid_t -> pid_t mapping). + Synchronization of system calls and filesystem. - 1. Argument passing - No checking for page boundaries in argument passing -10 - Uses memcpy/bcopy/memmove or file reading/writing for +5 - copying up to/starting from page boundaries -- good job! - (Search for memcpy/bcopy, not just extern, make sure they call it - with the possibility of copying more than 4 bytes at a time. ALSO if - they do File Read/Writes then that is not byte-by-byte but they will - fail page crossing only take off for failing the pagecrossing test.) - Don't decomp / reuse translation code -5 - Using strtok instead of strtok_r or strsep -1 - (strtok is not thread-safe) +Overall: + -1 Gratuitous use of malloc() (e.g. for allocating a list or a lock) + -1 Inappropriate use of ASSERT (e.g. to verify that malloc() succeeded) - 2. System calls - No checking for page boundaries in system calls -20 - (-5 if they only forgot for some system calls but did it somewhere) - Interrupts turned off for all system calls -10 - Doesn't close open files after process exits -2 - table/when file is closed, it is not removed from file table - Uses printf/fscanf/putc/getc when interacting -5 - with StandardInput / StandardOutput - Using fixed length buffer for Read/Write -5 - Using pointer to int casts as ASID/FileId without justifying -5 +Program arguments: + +1 Support multiple pages of arguments. - 3. Multiprogramming - Don't use the bitmap object -5 - Bitmap is not cleared when process dies -5 - Access to bitmap is not sychronized -5 - getting next ASID is not synchronized -5 - ...or (mututally exclusive, depending on their solution)... - Doesn't use ASID's at all, but their system for identifying -5 - processes has synchronization or uniqueness problems (e.g. - careless use of AddrSpace*'s) - Multiple translations for a page -10 - (One vaddr maps to two paddr's, or vice versa) +User/kernel copying: + -5 Too many copies of user/kernel copying code + -10 Doesn't check for page boundaries + -3 Imperfect checking for page boundaries + -5 Doesn't check whether pointers are at or above PHYS_BASE + -2 Imperfect checking whether pointers are at or above PHYS_BASE + +3 Copies large chunks while properly observing page boundaries + +3 Scans for string null terminators w/o checking individual bytes + while properly observing page boundaries + +3 Uses get_user() and put_user() functions from FAQ for copying -Style (/30 points) ------------------- -0) Had to modify code to get to compile the first -10 - time -1) Minor changes to machine code -10 -2) Extraneous output -5 -3) Unexplained dependencies -5 -4) Not Decomposing Exception handler -5 +System call design: + -5 Disables interrupts without reasonable justification + -2 Doesn't close open files at process exit + -2 Doesn't acquire file system lock to close files at process exit + -5 Buffer overflow in read or write system call + -5 System call error exit leaks memory/fails to release global lock + -5 Uses a pointer as a file descriptor or pid without justifying + +Style [[/25]] +------------- + -5 Extraneous output caused warnings + -5 Didn't print process termination messages + -5 One big function for handling system calls + -5 No attempt to conform to existing coding style -TESTCASEs (/30 points) ----------------------- - Don't write own testcases -15 - Not sufficient testing up to -10 +Comments +-------- diff --git a/grading/userprog/run-tests b/grading/userprog/run-tests index dd7cd21..4f4bb10 100755 --- a/grading/userprog/run-tests +++ b/grading/userprog/run-tests @@ -489,11 +489,12 @@ sub fix_exit_codes { local ($_) = $output[$i]; my ($process, $code); - if ((($process, $code) = /^([-a-zA-Z0-9 ]+):.*[ \(](-?\d+)\b\)?$/) - || (($process, $code) = /^([-a-zA-Z0-9 ]+) exit\((-?\d+)\)$/) + if ((($process, $code) = /^([-a-z0-9 ]+):.*[ \(](-?\d+)\b\)?$/) + || (($process, $code) = /^([-a-z0-9 ]+) exit\((-?\d+)\)$/) || (($process, $code) - = /^([-a-zA-Z0-9 ]+) \(.*\): exit\((-?\d+)\)$/) - || (($process, $code) = /^([-a-zA-Z0-9 ]+):\( (-?\d+) \) $/) + = /^([-a-z0-9 ]+) \(.*\): exit\((-?\d+)\)$/) + || (($process, $code) = /^([-a-z0-9 ]+):\( (-?\d+) \) $/) + || (($code, $process) = /^shell: exit\((-?\d+)\) \| ([-a-z0-9]+)/) ) { $process = substr ($process, 0, 15); $process =~ s/\s.*//; diff --git a/grading/userprog/sc-bad-sp.c b/grading/userprog/sc-bad-sp.c index d7a0f82..1153878 100644 --- a/grading/userprog/sc-bad-sp.c +++ b/grading/userprog/sc-bad-sp.c @@ -5,7 +5,7 @@ int main (void) { printf ("(sc-bad-sp) begin\n"); - asm volatile ("mov $0xc0101234, %esp; int $0x30"); + asm volatile ("mov $0x20101234, %esp; int $0x30"); printf ("(sc-bad-sp) end\n"); return 0; } diff --git a/grading/userprog/write-bad-fd.c b/grading/userprog/write-bad-fd.c index 33df001..5f46d6b 100644 --- a/grading/userprog/write-bad-fd.c +++ b/grading/userprog/write-bad-fd.c @@ -6,7 +6,7 @@ main (void) { char buf = 123; printf ("(write-bad-fd) begin\n"); - write (0xc0101234, &buf, 1); + write (0x20101234, &buf, 1); printf ("(write-bad-fd) end\n"); return 0; } diff --git a/grading/userprog/write-bad-ptr.c b/grading/userprog/write-bad-ptr.c index 9431c70..b36f447 100644 --- a/grading/userprog/write-bad-ptr.c +++ b/grading/userprog/write-bad-ptr.c @@ -11,7 +11,7 @@ main (void) if (handle < 2) printf ("(write-bad-ptr) fail: open() returned %d\n", handle); - write (handle, (char *) 0xc0101234, 123); + write (handle, (char *) 0x20101234, 123); printf ("(write-bad-ptr) end\n"); return 0;