--- AnyEvent/t/09_multi.t 2011/08/04 09:14:03 1.3 +++ AnyEvent/t/09_multi.t 2011/08/27 16:01:49 1.8 @@ -14,20 +14,24 @@ } } +$^W = 0; # 5.8.6 bugs + use AnyEvent; use AnyEvent::Util; BEGIN { require AnyEvent::Impl::Perl unless $ENV{PERL_ANYEVENT_MODEL} } -$| = 1; print "1..14\n"; +$| = 1; print "1..15\n"; print "ok 1\n"; +$AnyEvent::MAX_SIGNAL_LATENCY = 0.05; + my ($a, $b) = AnyEvent::Util::portable_socketpair; # I/O write { my $cv = AE::cv; - my $wt = AE::timer 0.1, 0, $cv; + my $wt = AE::timer 1, 0, $cv; my $s = 0; $cv->begin; my $wa = AE::io $a, 1, sub { $cv->end; $s |= 1 }; @@ -41,7 +45,7 @@ # I/O read { my $cv = AE::cv; - my $wt = AE::timer 0.1, 0, $cv; + my $wt = AE::timer 0.01, 0, $cv; my $s = 0; my $wa = AE::io $a, 0, sub { $cv->end; $s |= 1 }; @@ -54,7 +58,7 @@ syswrite $b, "x"; $cv = AE::cv; - $wt = AE::timer 0.1, 0, $cv; + $wt = AE::timer 1, 0, $cv; $s = 0; $cv->begin; @@ -66,7 +70,7 @@ sysread $a, my $dummy, 1; $cv = AE::cv; - $wt = AE::timer 0.1, 0, $cv; + $wt = AE::timer 0.01, 0, $cv; $s = 0; $cv->recv; @@ -77,7 +81,7 @@ # signal { my $cv = AE::cv; - my $wt = AE::timer 0.1, 0, $cv; + my $wt = AE::timer 0.01, 0, $cv; my $s = 0; $cv->begin; my $wa = AE::signal INT => sub { $cv->end; $s |= 1 }; @@ -90,7 +94,7 @@ kill INT => $$; $cv = AE::cv; - $wt = AE::timer 0.1, 0, $cv; + $wt = AE::timer 0.2, 0, $cv; # maybe OS X needs more time here? $s = 0; $cv->recv; @@ -98,7 +102,7 @@ print $s == 3 ? "" : "not ", "ok 7 # $s\n"; $cv = AE::cv; - $wt = AE::timer 0.1, 0, $cv; + $wt = AE::timer 0.01, 0, $cv; $s = 0; $cv->recv; @@ -106,12 +110,10 @@ print $s == 0 ? "" : "not ", "ok 8 # $s\n"; } -$AnyEvent::MAX_SIGNAL_LATENCY = 0.2; - # child { my $cv = AE::cv; - my $wt = AE::timer 0.1, 0, $cv; + my $wt = AE::timer 0.01, 0, $cv; my $s = 0; my $pid = fork; @@ -133,7 +135,7 @@ kill 9, $pid; $cv = AE::cv; - $wt = AE::timer 0.1, 0, $cv; + $wt = AE::timer 0.2, 0, $cv; # cygwin needs ages for this $s = 0; $cv->recv; @@ -143,7 +145,7 @@ print $astatus == 9 && $bstatus == 9 ? "" : "not ", "ok 12 # $astatus == $bstatus == 9\n"; $cv = AE::cv; - $wt = AE::timer 0.1, 0, $cv; + $wt = AE::timer 0.01, 0, $cv; $s = 0; $cv->recv; @@ -151,7 +153,22 @@ print $s == 0 ? "" : "not ", "ok 13 # $s\n"; } -print "ok 14\n"; +# timers (don't laugh, some event loops are more broken...) +{ + my $cv = AE::cv; + my $wt = AE::timer 1, 0, $cv; + my $s = 0; + + $cv->begin; my $wa = AE::timer 0 , 0, sub { $cv->end; $s |= 1 }; + $cv->begin; my $wb = AE::timer 0 , 0, sub { $cv->end; $s |= 2 }; + $cv->begin; my $wc = AE::timer 0.01, 0, sub { $cv->end; $s |= 4 }; + + $cv->recv; + + print $s == 7 ? "" : "not ", "ok 14 # $s\n"; +} + +print "ok 15\n"; exit 0;