From: Ben Pfaff Date: Mon, 19 Jun 2006 21:50:53 +0000 (+0000) Subject: Allow user fault messages in output in bad-* tests. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dbe9fc1bca4ce78ab36dfea71d441ceda0a81ceb;p=pintos-anon Allow user fault messages in output in bad-* tests. Add "pass;" at end of each bad-* test checker script. --- diff --git a/src/tests/tests.pm b/src/tests/tests.pm index 74b6905..e167cf5 100644 --- a/src/tests/tests.pm +++ b/src/tests/tests.pm @@ -149,10 +149,22 @@ sub compare_output { my (@output) = get_core_output ($run, @$output); fail "\u$run didn't produce any output" if !@output; - if (exists $options{IGNORE_EXIT_CODES}) { + my $ignore_exit_codes = exists $options{IGNORE_EXIT_CODES}; + if ($ignore_exit_codes) { delete $options{IGNORE_EXIT_CODES}; @output = grep (!/^[a-zA-Z0-9-_]+: exit\(\d+\)$/, @output); } + my $ignore_user_faults = exists $options{IGNORE_USER_FAULTS}; + if ($ignore_user_faults) { + delete $options{IGNORE_USER_FAULTS}; + @output = grep (!/^Page fault at.*in user context\.$/ + && !/: dying due to interrupt 0x0e \(.*\).$/ + && !/^Interrupt 0x0e \(.*\) at eip=/ + && !/^ cr2=.* error=.*/ + && !/^ eax=.* ebx=.* ecx=.* edx=.*/ + && !/^ esi=.* edi=.* esp=.* ebp=.*/ + && !/^ cs=.* ds=.* es=.* ss=.*/, @output); + } die "unknown option " . (keys (%options))[0] . "\n" if %options; my ($msg); @@ -196,6 +208,10 @@ sub compare_output { } # Failed to match. Report failure. + $msg .= "\n(Process exit codes are excluded for matching purposes.)\n" + if $ignore_exit_codes; + $msg .= "\n(User fault messages are excluded for matching purposes.)\n" + if $ignore_user_faults; fail "Test output failed to match any acceptable form.\n\n$msg"; } diff --git a/src/tests/userprog/bad-jump.ck b/src/tests/userprog/bad-jump.ck index 71662e8..e1c178b 100644 --- a/src/tests/userprog/bad-jump.ck +++ b/src/tests/userprog/bad-jump.ck @@ -2,7 +2,8 @@ use strict; use warnings; use tests::tests; -check_expected ([<<'EOF']); +check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']); (bad-jump) begin bad-jump: exit(-1) EOF +pass; diff --git a/src/tests/userprog/bad-jump2.ck b/src/tests/userprog/bad-jump2.ck index 8226115..35f0f97 100644 --- a/src/tests/userprog/bad-jump2.ck +++ b/src/tests/userprog/bad-jump2.ck @@ -2,7 +2,8 @@ use strict; use warnings; use tests::tests; -check_expected ([<<'EOF']); +check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']); (bad-jump2) begin bad-jump2: exit(-1) EOF +pass; diff --git a/src/tests/userprog/bad-read.ck b/src/tests/userprog/bad-read.ck index 8a531d9..4d4d926 100644 --- a/src/tests/userprog/bad-read.ck +++ b/src/tests/userprog/bad-read.ck @@ -2,7 +2,8 @@ use strict; use warnings; use tests::tests; -check_expected ([<<'EOF']); +check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']); (bad-read) begin bad-read: exit(-1) EOF +pass; diff --git a/src/tests/userprog/bad-read2.ck b/src/tests/userprog/bad-read2.ck index cabe862..fa27c7d 100644 --- a/src/tests/userprog/bad-read2.ck +++ b/src/tests/userprog/bad-read2.ck @@ -2,7 +2,8 @@ use strict; use warnings; use tests::tests; -check_expected ([<<'EOF']); +check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']); (bad-read2) begin bad-read2: exit(-1) EOF +pass; diff --git a/src/tests/userprog/bad-write.ck b/src/tests/userprog/bad-write.ck index 7b2e2d7..d213b49 100644 --- a/src/tests/userprog/bad-write.ck +++ b/src/tests/userprog/bad-write.ck @@ -2,7 +2,8 @@ use strict; use warnings; use tests::tests; -check_expected ([<<'EOF']); +check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']); (bad-write) begin bad-write: exit(-1) EOF +pass; diff --git a/src/tests/userprog/bad-write2.ck b/src/tests/userprog/bad-write2.ck index c94a10f..c6a3420 100644 --- a/src/tests/userprog/bad-write2.ck +++ b/src/tests/userprog/bad-write2.ck @@ -2,7 +2,8 @@ use strict; use warnings; use tests::tests; -check_expected ([<<'EOF']); +check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']); (bad-write2) begin bad-write2: exit(-1) EOF +pass;