summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rwxr-xr-x[-rw-r--r--]t/io/openpid.t2
-rwxr-xr-x[-rw-r--r--]t/test.pl8
2 files changed, 8 insertions, 2 deletions
diff --git a/t/io/openpid.t b/t/io/openpid.t
index ee4702cb8f..0e814d5c20 100644..100755
--- a/t/io/openpid.t
+++ b/t/io/openpid.t
@@ -18,7 +18,7 @@ if ($^O eq 'dos') {
}
plan tests => 10;
-watchdog(15);
+watchdog(15, "alarm");
use Config;
$| = 1;
diff --git a/t/test.pl b/t/test.pl
index 6109d8ee7b..c43c275f6c 100644..100755
--- a/t/test.pl
+++ b/t/test.pl
@@ -809,9 +809,10 @@ WHOA
# Set a watchdog to timeout the entire test file
# NOTE: If the test file uses 'threads', then call the watchdog() function
# _AFTER_ the 'threads' module is loaded.
-sub watchdog ($)
+sub watchdog ($;$)
{
my $timeout = shift;
+ my $method = shift;
my $timeout_msg = 'Test process timed out - terminating';
# Valgrind slows perl way down so give it more time before dying.
@@ -819,6 +820,10 @@ sub watchdog ($)
my $pid_to_kill = $$; # PID for this process
+ if ($method eq "alarm") {
+ goto WATCHDOG_VIA_ALARM;
+ }
+
# Don't use a watchdog process if 'threads' is loaded -
# use a watchdog thread instead
if (! $threads::threads) {
@@ -925,6 +930,7 @@ sub watchdog ($)
}
# If everything above fails, then just use an alarm timeout
+WATCHDOG_VIA_ALARM:
if (eval { alarm($timeout); 1; }) {
# Load POSIX if available
eval { require POSIX; };