This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
dist/threads/t/libc.t: Add timer to avoid deadlock
authorKarl Williamson <khw@cpan.org>
Thu, 10 Dec 2020 15:58:53 +0000 (08:58 -0700)
committerKarl Williamson <khw@cpan.org>
Sat, 12 Dec 2020 15:37:02 +0000 (08:37 -0700)
This test file can deadlock if there are bugs.  Add a timeout to keep
the test from hanging indefinitely.

dist/threads/t/libc.t

index 4f6f6ed..6595894 100644 (file)
@@ -9,6 +9,12 @@ 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);
+
     plan(11);
 }