X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=grading%2Fuserprog%2Frun-tests;fp=grading%2Fuserprog%2Frun-tests;h=c51089eb023234a0e95910851995b5d8100cb0fb;hb=5f5e3ca7e9d053549bd4c6f55672ae867857ec54;hp=9ca9381a99d5e5257ed0f0097cdd597b57f83ccd;hpb=53c6e81d1cff87ffccfca368adcca8b092f2a0d1;p=pintos-anon diff --git a/grading/userprog/run-tests b/grading/userprog/run-tests index 9ca9381..c51089e 100755 --- a/grading/userprog/run-tests +++ b/grading/userprog/run-tests @@ -50,6 +50,7 @@ sub usage { 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 ) unless @TESTS > 0; our (%args); @@ -296,7 +297,29 @@ sub grade_write_normal { compare_output ("$GRADES_DIR/write-normal.exp", @output); my ($test_txt) = "output/$test/test.txt"; get_file ("test.txt", $test_txt) if ! -e $test_txt; - compare_output ("$GRADES_DIR/sample.txt", snarf ($test_txt)); + + my (@actual) = snarf ($test_txt); + my (@expected) = snarf ("$GRADES_DIR/sample.txt"); + + my ($eq); + if ($#actual == $#expected) { + $eq = 1; + for my $i (0...$#actual) { + $eq = 0 if $actual[$i] ne $expected[$i]; + } + } else { + $eq = 0; + } + if (!$eq) { + my ($details); + $details = "Expected file content:\n"; + $details .= join ('', map (" $_\n", @expected)); + $details .= "Actual file content:\n"; + $details .= join ('', map (" $_\n", @actual)); + $extra{$test} = $details; + + die "File written didn't have expected content.\n"; + } } sub get_file {