In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/1a34b28b1ed3a7c3a6b92fad22f321ae7c49f0e7?hp=95c65df765b81f2fea5997dc4a1383f080eaa715>
- Log ----------------------------------------------------------------- commit 1a34b28b1ed3a7c3a6b92fad22f321ae7c49f0e7 Author: Tony Cook <[email protected]> Date: Fri Dec 2 23:23:00 2011 +1100 more reliably kill a runaway test process on cygwin Sometimes a plain kill isn't enough. Along with the previous change this reliably kills a blocked t/op/threads.t on cygwin as needed. This doesn't attempt to fix the underlying bug (which may be in Win32, cygwin or perl itself) M t/test.pl commit 78325d7a7e6183fba46cbfb1dbd40def2996b940 Author: Tony Cook <[email protected]> Date: Fri Dec 2 23:25:33 2011 +1100 don't depend on threads to do a watchdog when testing threads adds a "process" watchdog method that forces use of a separate process for the watchdog "watcher". M t/op/threads.t M t/test.pl ----------------------------------------------------------------------- Summary of changes: t/op/threads.t | 2 +- t/test.pl | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/t/op/threads.t b/t/op/threads.t index 2991f5e..a07fc4a 100644 --- a/t/op/threads.t +++ b/t/op/threads.t @@ -135,6 +135,7 @@ EOI # # run-time usage of newCONSTSUB (as done by the IO boot code) wasn't # thread-safe - got occasional coredumps or malloc corruption +watchdog(60, "process"); { local $SIG{__WARN__} = sub {}; # Ignore any thread creation failure warnings my @t; @@ -376,7 +377,6 @@ EOF # [perl #78494] Pipes shared between threads block when closed -watchdog 10; { my $perl = which_perl; $perl = qq'"$perl"' if $perl =~ /\s/; diff --git a/t/test.pl b/t/test.pl index a287bc2..66d6e07 100644 --- a/t/test.pl +++ b/t/test.pl @@ -1262,7 +1262,7 @@ sub watchdog ($;$) # Don't use a watchdog process if 'threads' is loaded - # use a watchdog thread instead - if (!$threads_on) { + if (!$threads_on || $method eq "process") { # On Windows and VMS, try launching a watchdog process # using system(1, ...) (see perlport.pod) @@ -1329,6 +1329,11 @@ sub watchdog ($;$) if (kill(0, $pid_to_kill)) { _diag($timeout_msg); kill('KILL', $pid_to_kill); + if ($is_cygwin) { + # sometimes the above isn't enough on cygwin + sleep 1; # wait a little, it might have worked after all + system("/bin/kill -f $pid_to_kill"); + } } # Don't execute END block (added at beginning of this file) -- Perl5 Master Repository
