Skip to content

Commit

Permalink
XXX temp: dist/Tie-File/t/29a_upcopy.t: Up alarm
Browse files Browse the repository at this point in the history
  • Loading branch information
khwilliamson committed Nov 13, 2023
1 parent 7ce0aa7 commit efac274
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions dist/Tie-File/t/29a_upcopy.t
Expand Up @@ -132,6 +132,19 @@ sub try {
my $o = tie my @lines, 'Tie::File', $file or die $!;
# allocate more time for the test if we are running parallel tests
my $alarm_time = ($ENV{TEST_JOBS} || $ENV{HARNESS_OPTIONS}) ? 20 : 10;

# Accept either spelling
my $timeout_factor = $ENV{PERL_TEST_TIME_OUT_FACTOR}
|| $ENV{PERL_TEST_TIMEOUT_FACTOR}
|| 10;
$timeout_factor = 1 if $timeout_factor < 1;
$timeout_factor = $1 if $timeout_factor =~ /^(\d+)$/;

# Valgrind slows perl way down so give it more time before dying.
$timeout_factor = 10 if $timeout_factor < 10 && $ENV{PERL_VALGRIND};

$alarm_time *= $timeout_factor;

local $SIG{ALRM} = sub { die "Alarm clock" };
my $a_retval = eval { alarm($alarm_time) unless $^P; $o->_upcopy($src, $dst, $len) };
my $err = $@;
Expand Down

0 comments on commit efac274

Please sign in to comment.