diff options
author | christophe.ravel.bugs%sun.com <devnull@localhost> | 2008-10-30 20:03:54 +0000 |
---|---|---|
committer | christophe.ravel.bugs%sun.com <devnull@localhost> | 2008-10-30 20:03:54 +0000 |
commit | b2f9982ddb3ea7359a1d3811ee031b7ecb3a9593 (patch) | |
tree | 6a70017c561c2021e2be820432449529c67a020d | |
parent | 22cc970d9d0db62d108246fd04e5cd67742c62de (diff) | |
download | nspr-hg-b2f9982ddb3ea7359a1d3811ee031b7ecb3a9593.tar.gz |
bug 462178: Need better error handling when running NSPR tests (runtests.pl).
r=slavo, sr=wtc.
-rwxr-xr-x | pr/tests/runtests.pl | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/pr/tests/runtests.pl b/pr/tests/runtests.pl index 990df776..08088877 100755 --- a/pr/tests/runtests.pl +++ b/pr/tests/runtests.pl @@ -121,18 +121,27 @@ $lprog = shift; } sub print_end { -$lprog = shift; -$lstatus = shift; +($lprog, $exit_status, $exit_signal, $exit_core) = @_; - if ($lstatus == 0) { + if (($exit_status == 0) && ($exit_signal == 0) && ($exit_core == 0)) { $str_status = "Passed"; } else { $str_status = "FAILED"; } + if ($exit_signal != 0) { + $str_signal = " - signal $exit_signal"; + } else { + $str_signal = ""; + } + if ($exit_core != 0) { + $str_core = " - core dumped"; + } else { + $str_core = ""; + } $now = getTime; # Full output print "\nEND TEST: $lprog ($now)\n"; - print "TEST STATUS: $lprog = $str_status (exit status $lstatus)\n"; + print "TEST STATUS: $lprog = $str_status (exit status " . $exit_status . $str_signal . $str_core . ")\n"; print "--------------------------------------------------\n\n"; # Summary output print OF "\t\t\t$str_status\n"; @@ -147,6 +156,9 @@ $lprog = shift; # command to run setsid or die "setsid failed: $!"; # Start test program exec("./$lprog"); + # We should not be here unless exec failed. + print "Faild to exec $lprog"; + exit 1 << 8; } sub ux_wait_timeout { @@ -171,7 +183,7 @@ $ltimeout = shift; # timeout $ltimeout--; } else { # Child has ended - $lstatus = $? % 256; + $lstatus = $?; # Exit the wait loop and don't kill $ltimeout = -1; } @@ -183,7 +195,7 @@ $ltimeout = shift; # timeout print "Timeout ! Kill child process $lpid\n"; # Kill the child process and group kill(-9,$lpid); - $lstatus = 1; + $lstatus = 9; } return $lstatus; @@ -201,7 +213,11 @@ $prog = shift; # Program to test } else { # we are in the parent process $status = ux_wait_timeout($child_pid,$timeout); - print_end($prog, $status); + # See Perlvar for documentation of $? + # exit status = $status >> 8 + # exit signal = $status & 127 (no signal = 0) + # core dump = $status & 128 (no core = 0) + print_end($prog, $status >> 8, $status & 127, $status & 128); } return $status; @@ -251,7 +267,8 @@ $prog = shift; # Program to test # the prog finished before the timeout: get exit status $ProcessObj->GetExitCode($status); } - print_end($prog,$status); + # There is no signal, no core on Windows + print_end($prog, $status, 0, 0); return $status } @@ -373,7 +390,6 @@ $prog = shift; # Program to test open_log; foreach $current_prog (@progs) { -# print "Current_prog=$current_prog\n"; if ($osname =~ $WINOS) { win_test_prog($current_prog); } else { |