Remove showing stderr log files unconditionally for tests 518 and 537.
Add failure checking for servers when fork()ed. Use same code path in 'stopserver' when called with a single or multiple pids.
This commit is contained in:
@@ -235,8 +235,13 @@ sub startnew {
|
|||||||
my $child = fork();
|
my $child = fork();
|
||||||
my $pid2;
|
my $pid2;
|
||||||
|
|
||||||
|
if(not defined $child) {
|
||||||
|
logmsg "fork() failure detected\n";
|
||||||
|
return (-1,-1);
|
||||||
|
}
|
||||||
|
|
||||||
if(0 == $child) {
|
if(0 == $child) {
|
||||||
# a child, run the given command instead!
|
# Here we are the child. Run the given command.
|
||||||
|
|
||||||
# Calling exec() within a pseudo-process actually spawns the requested
|
# Calling exec() within a pseudo-process actually spawns the requested
|
||||||
# executable in a separate process and waits for it to complete before
|
# executable in a separate process and waits for it to complete before
|
||||||
@@ -244,7 +249,12 @@ sub startnew {
|
|||||||
# the process ID reported within the running executable will be
|
# the process ID reported within the running executable will be
|
||||||
# different from what the earlier Perl fork() might have returned.
|
# different from what the earlier Perl fork() might have returned.
|
||||||
|
|
||||||
exec($cmd);
|
# exec() should never return back here to this process. We protect
|
||||||
|
# ourselfs calling die() just in case something goes really bad.
|
||||||
|
|
||||||
|
exec($cmd) || die "Can't exec() $cmd: $!";
|
||||||
|
|
||||||
|
die "error: exec() has returned !!!";
|
||||||
}
|
}
|
||||||
|
|
||||||
my $count=5;
|
my $count=5;
|
||||||
@@ -390,22 +400,23 @@ sub torture {
|
|||||||
sub stopserver {
|
sub stopserver {
|
||||||
my ($pid) = @_;
|
my ($pid) = @_;
|
||||||
|
|
||||||
if($pid <= 0) {
|
if(not defined $pid) {
|
||||||
return; # this is not a good pid
|
return; # whad'da'ya wanna'da with no pid ?
|
||||||
}
|
}
|
||||||
|
|
||||||
if($pid =~ / /) {
|
# it might be more than one pid
|
||||||
# if it contains space, it might be more than one pid
|
|
||||||
my @pids = split(" ", $pid);
|
my @pids = split(/\s+/, $pid);
|
||||||
for (@pids) {
|
for (@pids) {
|
||||||
kill (9, $_); # die!
|
chomp($_);
|
||||||
}
|
if($_ =~ /^(\d+)$/) {
|
||||||
}
|
if(($1 > 0) && kill(0, $1)) {
|
||||||
|
|
||||||
my $res = kill (9, $pid); # die!
|
|
||||||
|
|
||||||
if($verbose) {
|
if($verbose) {
|
||||||
logmsg "RUN: Test server pid $pid signalled to die\n";
|
logmsg "RUN: Test server pid $1 signalled to die\n";
|
||||||
|
}
|
||||||
|
kill(9, $1); # die!
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1216,13 +1227,7 @@ sub singletest {
|
|||||||
$cmd = $precheck[0];
|
$cmd = $precheck[0];
|
||||||
chomp $cmd;
|
chomp $cmd;
|
||||||
if($cmd) {
|
if($cmd) {
|
||||||
my @o;
|
my @o = `$cmd 2>/dev/null`;
|
||||||
if(($testnum == 518) || ($testnum == 537)) {
|
|
||||||
@o = `$cmd 2>"$LOGDIR/stderr$testnum"`;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
@o = `$cmd 2>/dev/null`;
|
|
||||||
}
|
|
||||||
if($o[0]) {
|
if($o[0]) {
|
||||||
$why = $o[0];
|
$why = $o[0];
|
||||||
chomp $why;
|
chomp $why;
|
||||||
@@ -1231,12 +1236,6 @@ sub singletest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(($testnum == 518) || ($testnum == 537)) {
|
|
||||||
logmsg "== Start of file $LOGDIR/stderr$testnum\n";
|
|
||||||
displaylogcontent("$LOGDIR/stderr$testnum");
|
|
||||||
logmsg "== End of file $LOGDIR/stderr$testnum\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if($why) {
|
if($why) {
|
||||||
# there's a problem, count it as "skipped"
|
# there's a problem, count it as "skipped"
|
||||||
$skipped++;
|
$skipped++;
|
||||||
|
|||||||
Reference in New Issue
Block a user