Merge branch 'jk/t5562-racefix'
Test update. * jk/t5562-racefix: t5562: use alarm() to interrupt timed child-wait
This commit is contained in:
@ -13,11 +13,6 @@ my $body_data;
|
|||||||
defined read($body_fh, $body_data, $body_size) or die "Cannot read $body_filename: $!";
|
defined read($body_fh, $body_data, $body_size) or die "Cannot read $body_filename: $!";
|
||||||
close($body_fh);
|
close($body_fh);
|
||||||
|
|
||||||
my $exited = 0;
|
|
||||||
$SIG{"CHLD"} = sub {
|
|
||||||
$exited = 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
# write data
|
# write data
|
||||||
my $pid = open(my $out, "|-", @command);
|
my $pid = open(my $out, "|-", @command);
|
||||||
{
|
{
|
||||||
@ -29,8 +24,13 @@ my $pid = open(my $out, "|-", @command);
|
|||||||
}
|
}
|
||||||
print $out $body_data or die "Cannot write data: $!";
|
print $out $body_data or die "Cannot write data: $!";
|
||||||
|
|
||||||
sleep 60; # is interrupted by SIGCHLD
|
$SIG{ALRM} = sub {
|
||||||
if (!$exited) {
|
kill 'KILL', $pid;
|
||||||
close($out);
|
|
||||||
die "Command did not exit after reading whole body";
|
die "Command did not exit after reading whole body";
|
||||||
|
};
|
||||||
|
alarm 60;
|
||||||
|
|
||||||
|
my $ret = waitpid($pid, 0);
|
||||||
|
if ($ret != $pid) {
|
||||||
|
die "confusing return from waitpid: $ret";
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user