|
@@ -615,7 +615,10 @@ sub testCmd {
|
|
|
my $class = shift;
|
|
my $class = shift;
|
|
|
my $command = shift or die "No command passed to testCmd";
|
|
my $command = shift or die "No command passed to testCmd";
|
|
|
my $object = $class->new;
|
|
my $object = $class->new;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ local $SIG{'ALRM'} = sub { die("timeout in command: $command"); };
|
|
|
|
|
+ alarm(120); # no test should take longer than 120 seconds
|
|
|
|
|
+
|
|
|
my $output = `$command`;
|
|
my $output = `$command`;
|
|
|
$object->return_code($? >> 8);
|
|
$object->return_code($? >> 8);
|
|
|
$_ = $? & 127;
|
|
$_ = $? & 127;
|
|
@@ -625,6 +628,8 @@ sub testCmd {
|
|
|
chomp $output;
|
|
chomp $output;
|
|
|
$object->output($output);
|
|
$object->output($output);
|
|
|
|
|
|
|
|
|
|
+ alarm(0);
|
|
|
|
|
+
|
|
|
my ($pkg, $file, $line) = caller(0);
|
|
my ($pkg, $file, $line) = caller(0);
|
|
|
print "Testing: $command", $/;
|
|
print "Testing: $command", $/;
|
|
|
if ($ENV{'NPTEST_DEBUG'}) {
|
|
if ($ENV{'NPTEST_DEBUG'}) {
|