Proper timeouts now working. Also display incremental progress reports during a test to make hung things easier to see.

This commit is contained in:
Your Name 2017-04-06 12:48:05 -04:00
parent 3b050e25be
commit a826de8da7
3 changed files with 13 additions and 5 deletions

Binary file not shown.

View file

@ -8,7 +8,7 @@ use Data::Dumper;
use List::Util qw/uniq/; use List::Util qw/uniq/;
use IPC::Run qw/run timeout harness/; use IPC::Run qw/run timeout harness/;
use Module; use Module;
use Time::HiRes qw/sleep/; use Time::HiRes qw/sleep time/;
our $perlbrew_env = 'blead'; our $perlbrew_env = 'blead';
@ -57,21 +57,29 @@ sub run_cpanm {
my $out; my $out;
my $in=''; my $in='';
my $h = harness \@cmd, '<', \$in, '>&', \$out, timeout(10*60); # timeout after 10 minutes $|++;
my $timeout = 10*60;
my $h = harness \@cmd, '<', \$in, '>&', \$out, timeout($timeout); # timeout after 10 minutes
eval { eval {
$h->start(); $h->start();
my $st = time();
while($h->pumpable()) { # still getting output while($h->pumpable()) { # still getting output
$h->pump(); $h->pump_nb();
if (length($out) > 20*1024*1024) { # 20 meg limit on output if (length($out) > 20*1024*1024) { # 20 meg limit on output
die "Output too long. Failing build\n"; die "Output too long. Failing build\n";
} }
sleep(0.1);
printf "%03.03f %08d\r", time()-$st, length($out);
die "Timeout" if time()-$st > $timeout;
} }
$h->finish(); $h->finish();
}; };
my $err = $@; my $err = $@;
$h->finish() if $err; print " "x20, "\r";
eval {$h->finish()} if $err;
$h->kill_kill(); # reap all the kids $h->kill_kill(); # reap all the kids
my $exitcode = $err || $h->full_result(); my $exitcode = $err || $h->full_result();

Binary file not shown.