--- AnyEvent/t/65_event_03_child.t 2011/08/02 22:07:17 1.10 +++ AnyEvent/t/65_event_03_child.t 2012/03/30 04:22:22 1.13 @@ -19,8 +19,11 @@ } use AnyEvent; -BEGIN { eval q{use AnyEvent::Impl::Event;1} or ((print qq{1..0 # SKIP AnyEvent::Impl::Event not loadable -}), exit 0) } + + BEGIN { $ENV{PERL_ANYEVENT_LOOP_TESTS} or ((print qq{1..0 # SKIP PERL_ANYEVENT_LOOP_TESTS not true\n}), exit 0) } + BEGIN { eval q{use AnyEvent::Impl::Event;1} or ((print qq{1..0 # SKIP AnyEvent::Impl::Event not loadable\n}), exit 0) } + + $| = 1; print "1..50\n"; @@ -41,10 +44,16 @@ my $cv = AnyEvent->condvar; unless ($pid) { - print "ok ${it}2\n"; + print "ok ${it}2 # child $$\n"; + + # POE hits a race condition when the child dies too quickly + # because it checks for child exit before installing the signal handler. + # seen in version 1.352 - earlier versions had the same bug, but + # polled for child exits regularly, so only caused a delay. + sleep 1 if $AnyEvent::MODEL eq "POE"; + POSIX::_exit 3; } - my $w = AnyEvent->child (pid => $pid, cb => sub { print $pid == $_[0] ? "" : "not ", "ok ${it}3\ # $pid == $_[0]\n"; print 3 == ($_[1] >> 8) ? "" : "not ", "ok ${it}4 # 3 == $_[1] >> 8 ($_[1])\n";