mirror of
https://github.com/Perl/perl5.git
synced 2026-01-26 16:39:36 +00:00
Consolidate PERL_TEST_TIME_OUT_FACTOR to watchdog()
This changes test.pl watchdog() to always consider this potential setting of an environment variable, and removes the distributed uses. This means that no code needs to change when tests start failing on a slow platform due to timing out; or when you need to temporarily increase the timeout of a test for debugging. This will correspondingly increase the timeout of all tests, but who cares for debugging purposes.
This commit is contained in:
parent
3751ea9823
commit
ec8902ce0f
5
dist/threads/t/libc.t
vendored
5
dist/threads/t/libc.t
vendored
@ -9,11 +9,8 @@ BEGIN {
|
||||
skip_all(q/Perl not compiled with 'useithreads'/);
|
||||
}
|
||||
|
||||
my $time_out_factor = $ENV{PERL_TEST_TIME_OUT_FACTOR} || 1;
|
||||
$time_out_factor = 1 if $time_out_factor < 1;
|
||||
|
||||
# Guard against bugs that result in deadlock
|
||||
watchdog(1 * 60 * $time_out_factor);
|
||||
watchdog(1 * 60);
|
||||
|
||||
plan(11);
|
||||
}
|
||||
|
||||
@ -17,10 +17,8 @@ BEGIN {
|
||||
if ($^O eq 'dec_osf') {
|
||||
skip_all("$^O cannot handle this test");
|
||||
}
|
||||
my $time_out_factor = $ENV{PERL_TEST_TIME_OUT_FACTOR} || 1;
|
||||
$time_out_factor = 1 if $time_out_factor < 1;
|
||||
|
||||
watchdog(5 * 60 * $time_out_factor);
|
||||
watchdog(5 * 60);
|
||||
require './loc_tools.pl';
|
||||
}
|
||||
|
||||
|
||||
@ -2382,7 +2382,7 @@ EOF
|
||||
TODO: { # Was looping
|
||||
todo_skip('Triggers thread clone SEGV. See #86550')
|
||||
if $::running_as_thread && $::running_as_thread;
|
||||
watchdog(10 * ($ENV{PERL_TEST_TIME_OUT_FACTOR} || 1));
|
||||
watchdog(10);
|
||||
like("\x{00DF}", qr/[\x{1E9E}_]*/i, "\"\\x{00DF}\" =~ /[\\x{1E9E}_]*/i was looping");
|
||||
}
|
||||
|
||||
|
||||
@ -24,10 +24,8 @@ BEGIN {
|
||||
if ($^O eq 'dec_osf') {
|
||||
skip_all("$^O cannot handle this test");
|
||||
}
|
||||
my $time_out_factor = $ENV{PERL_TEST_TIME_OUT_FACTOR} || 1;
|
||||
$time_out_factor = 1 if $time_out_factor < 1;
|
||||
|
||||
watchdog(5 * 60 * $time_out_factor);
|
||||
watchdog(5 * 60);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -42,9 +42,7 @@ run_tests() unless caller;
|
||||
sub run_tests {
|
||||
|
||||
|
||||
watchdog(($ENV{PERL_TEST_TIME_OUT_FACTOR} || 1)
|
||||
* (($::running_as_thread && $::running_as_thread)
|
||||
? 150 : 225));
|
||||
watchdog((($::running_as_thread && $::running_as_thread) ? 150 : 225));
|
||||
|
||||
{
|
||||
# [perl #120446]
|
||||
|
||||
16
t/test.pl
16
t/test.pl
@ -1724,7 +1724,11 @@ sub warning_like {
|
||||
}
|
||||
}
|
||||
|
||||
# Set a watchdog to timeout the entire test file
|
||||
# Set a watchdog to timeout the entire test file. The input seconds is
|
||||
# multiplied by $ENV{PERL_TEST_TIME_OUT_FACTOR} (default 1; minimum 1).
|
||||
# Set this in your profile for slow boxes, or use it to override the timeout
|
||||
# temporarily for debugging.
|
||||
#
|
||||
# NOTE: If the test file uses 'threads', then call the watchdog() function
|
||||
# _AFTER_ the 'threads' module is loaded.
|
||||
sub watchdog ($;$)
|
||||
@ -1733,8 +1737,16 @@ sub watchdog ($;$)
|
||||
my $method = shift || "";
|
||||
my $timeout_msg = 'Test process timed out - terminating';
|
||||
|
||||
# Accept either spelling
|
||||
my $timeout_factor = $ENV{PERL_TEST_TIME_OUT_FACTOR}
|
||||
|| $ENV{PERL_TEST_TIMEOUT_FACTOR}
|
||||
|| 1;
|
||||
$timeout_factor = 1 if $timeout_factor < 1;
|
||||
|
||||
# Valgrind slows perl way down so give it more time before dying.
|
||||
$timeout *= 10 if $ENV{PERL_VALGRIND};
|
||||
$timeout_factor = 10 if $timeout_factor < 10 && $ENV{PERL_VALGRIND};
|
||||
|
||||
$timeout *= $timeout_factor;
|
||||
|
||||
my $pid_to_kill = $$; # PID for this process
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user