summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorOlivier Dufour2013-05-29 15:21:30 +0200
committerOlivier Dufour2013-05-30 16:06:33 +0200
commit5324ed17d0a3f302715173060378c688d952398e (patch)
tree8d9d3c8b4ee582e68684c0ffe0f89f01c63902e0 /common
parent886502eccf84d52280a2b55cc501cd1b52dabae5 (diff)
common/tests: replace test stdin, closes #3997
As the script will fork to execute the test, its stdin is duplicated with its content. In some cases (especially for bundle test), a read on stdin is an error, so we make sure no data will be available on stdin.
Diffstat (limited to 'common')
-rwxr-xr-xcommon/tests/run-test.pl5
1 files changed, 5 insertions, 0 deletions
diff --git a/common/tests/run-test.pl b/common/tests/run-test.pl
index 5b75bff2df..bbf5f22283 100755
--- a/common/tests/run-test.pl
+++ b/common/tests/run-test.pl
@@ -222,6 +222,7 @@ sub valgrind_macro
sub timed_system
{
+ pipe READEND, WRITEEND;
my $cmd = shift;
my $pid = fork;
defined $pid or die "fork: $!,";
@@ -229,12 +230,16 @@ sub timed_system
{
# Son.
setpgrp ($$, $$);
+ close WRITEEND;
+ close STDIN;
+ open (STDIN, "<&READEND");
exec $cmd;
exit 128;
}
else
{
# Father.
+ close READEND;
eval {
local $SIG{ALRM} = sub { die "alarm\n" };
alarm $timeout;