unless exists $ENV{'IPCRUNDEBUG'};
}
-my ($timeout) = 0;
-my ($time_to_wait) = 0;
-my $path = $0;
my $enable_coverage = 0;
my $diff_tool = 0;
my $diff_tool_tmp_fh = 0;
my @bg_cmds;
my (%environ);
$SIG{'PIPE'} = 'IGNORE';
+
+my $path = $0;
$path =~ s|[^/]*$||;
push @INC, $path;
#### Command line option handling
####
-if ( $ARGV[0] eq "--internal-killer-process" ) {
-
- # We fork+exec a waiter process in charge of killing the command after timeout
- # If the command stops earlier, that's fine: the killer sends a signal to an already stopped process, fails, and quits.
- # Nobody cares about the killer issues.
- # The only problem could arise if another process is given the same PID than cmd. We bet it won't happen :)
- my $time_to_wait = $ARGV[1];
- my $pid = $ARGV[2];
- sleep $time_to_wait;
- kill( 'TERM', $pid );
- sleep 1;
- kill( 'KILL', $pid );
- exit $time_to_wait;
-}
-
my %opts = ( "debug" => 0,
"timeout" => 120, # No command should run any longer than 2 minutes by default
);
$tesh_file = pop @ARGV;
-if ($enable_coverage) {
- print "Enable coverage\n";
-}
+print "Enable coverage\n" if ($enable_coverage);
if ($diff_tool) {
use File::Temp qw/ tempfile /;
print "Test suite from stdin\n";
}
-##
-## File parsing
-##
-my ($return) = -1;
-my ($forked);
-my ($config) = "";
-my (@buffer_tesh) = ();
-
###########################################################################
sub exit_status {
}
}
- # Did we timeout ? If yes, handle it. If not, kill the forked process.
+ # Did we timeout?
if ( $cmd{'timeouted'} ) {
$gotret = "timeout after $cmd{'timeout'} sec";
print STDERR "$msg";
}
- ###
- # Check the result of execution
- ###
+ # Does the output match?
my $diff;
if ( defined( $cmd{'output display'} ) ) {
print "[Tesh/INFO] Here is the (ignored) command output:\n";
$line_num++;
print "[TESH/debug] $line_num: $line\n" if $opts{'debug'};
- my $next;
# deal with line continuations
while ( $line =~ /^(.*?)\\$/ ) {
- $next = <$infh>;
+ my $next = <$infh>;
die "[TESH/CRITICAL] Continued line at end of file\n"
unless defined($next);
$line_num++;
} else {
die "[TESH/CRITICAL] parse error: $line\n";
}
- if ($forked) {
- kill( 'KILL', $forked );
- $timeout = 0;
- }
}
# We're done reading the input file
%cmd = ();
}
-if ($forked) {
- kill( 'KILL', $forked );
- $timeout = 0;
-}
-
foreach (@bg_cmds) {
my %test = %{$_};
analyze_result( \%test );
print "Test suite `$tesh_name' OK\n";
}
+exit 0;
+
####
#### Helper functions
####