X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=grading%2Fuserprog%2Frun-tests;h=e81b5330804911c0ecd3f3a00be89875d6b67970;hb=2cfc156c39840ce7f1cda6b473de1322691a8a0b;hp=afb9317ee357b30a389e4742753334fe8009fe85;hpb=aa611970d5cbcfd5b0170c03effd74c2cab05708;p=pintos-anon diff --git a/grading/userprog/run-tests b/grading/userprog/run-tests index afb9317..e81b533 100755 --- a/grading/userprog/run-tests +++ b/grading/userprog/run-tests @@ -20,26 +20,31 @@ our ($test); our (%extra); our ($action); -parse_cmd_line (); - -# Default set of tests. -@TESTS = qw (args-argc args-argv0 args-argvn args-single args-multiple - args-dbl-space - sc-bad-sp sc-bad-arg sc-boundary - halt exit - create-normal create-empty create-null create-bad-ptr - create-long create-exists create-bound - open-normal open-missing open-boundary open-empty open-null - open-bad-ptr open-twice - close-normal close-twice close-stdin close-stdout close-bad-fd - read-normal read-bad-ptr read-boundary read-zero read-stdout - read-bad-fd - write-normal write-bad-ptr write-boundary write-zero write-stdin - write-bad-fd - exec-once exec-arg exec-multiple exec-missing exec-bad-ptr - join-simple join-twice join-killed join-bad-pid - multi-recurse multi-oom multi-child-fd - ) unless @TESTS > 0; +if ($#ARGV == 0 && $ARGV[0] eq 'null') { + @TESTS = ('null'); + extract_sources (); + build (); + run_and_grade_tests (); + exit success (); +} + +parse_cmd_line qw (args-argc args-argv0 args-argvn args-single args-multiple + args-dbl-space + sc-bad-sp sc-bad-arg sc-boundary + halt exit + create-normal create-empty create-null create-bad-ptr + create-long create-exists create-bound + open-normal open-missing open-boundary open-empty open-null + open-bad-ptr open-twice + close-normal close-twice close-stdin close-stdout + close-bad-fd + read-normal read-bad-ptr read-boundary read-zero read-stdout + read-bad-fd + write-normal write-bad-ptr write-boundary write-zero + write-stdin write-bad-fd + exec-once exec-arg exec-multiple exec-missing exec-bad-ptr + wait-simple wait-twice wait-killed wait-bad-pid + multi-recurse multi-oom multi-child-fd); clean_dir (), exit if $action eq 'clean'; @@ -52,10 +57,10 @@ exit if $action eq 'build'; run_and_grade_tests (); write_grades (); write_details (); -exit if $action eq 'test'; +exit success () if $action eq 'test'; assemble_final_grade (); -exit if $action eq 'assemble'; +exit success () if $action eq 'assemble'; die "Don't know how to '$action'"; @@ -77,10 +82,9 @@ sub run_test { # Run. my ($timeout) = $test !~ /^multi-/ ? 10 : 600; - my ($result) = run_pintos ("pintos " - . "--os-disk=pintos/src/userprog/build/os.dsk " - . "--fs-disk=output/$test/fs.dsk " - . "-v run -q -ex \"$test$args\"", + my ($result) = run_pintos (["--os-disk=pintos/src/userprog/build/os.dsk", + "--fs-disk=output/$test/fs.dsk", + "-v", "run", "-q", "-ex", "$test$args"], LOG => "$test/run", TIMEOUT => $timeout); rename "output/$test/fs.dsk", "output/$test/fs.dsk.keep" @@ -159,13 +163,11 @@ sub grade_multi_oom { sub get_file { my ($guest_fn, $host_fn) = @_; - my ($result) = run_pintos ("pintos " - . "--os-disk=pintos/src/userprog/build/os.dsk " - . "--fs-disk=output/$test/fs.dsk.keep " - . "-v get $guest_fn $host_fn", + my ($result) = run_pintos (["--os-disk=pintos/src/userprog/build/os.dsk", + "--fs-disk=output/$test/fs.dsk.keep", + "-v", "get", "$guest_fn", "$host_fn"], LOG => "$test/get-$guest_fn", - TIMEOUT => 10, - EXPECT => 0); + TIMEOUT => 10); die "`pintos get $guest_fn' failed - $result\n" if $result ne 'ok'; }