bug 462178: Need better error handling when running NSPR tests (runtests.pl).

r=slavo, sr=wtc.


git-svn-id: svn://10.0.0.236/trunk@254830 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
christophe.ravel.bugs%sun.com
2008-10-30 20:03:54 +00:00
parent 988dd6bb17
commit ca9bae84d0

View File

@@ -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 {