|
|
1 | use POSIX (); |
|
|
2 | |
|
|
3 | use AnyEvent; |
|
|
4 | BEGIN { eval q{use AnyEvent::Impl::IOAsync;1} or ((print qq{1..0 # SKIP AnyEvent::Impl::IOAsync not found}), exit 0) } use IO::Async::Loop; AnyEvent::Impl::IOAsync::set_loop new IO::Async::Loop; |
|
|
5 | |
1 | BEGIN { |
6 | BEGIN { |
2 | # check for broken perls |
7 | # check for broken perls |
3 | if ($^O =~ /mswin32/i) { |
8 | if ($^O =~ /mswin32/i) { |
4 | my $ok; |
9 | my $ok; |
5 | local $SIG{CHLD} = sub { $ok = 1 }; |
10 | local $SIG{CHLD} = sub { $ok = 1 }; |
… | |
… | |
12 | exit 0; |
17 | exit 0; |
13 | } |
18 | } |
14 | } |
19 | } |
15 | } |
20 | } |
16 | |
21 | |
17 | BEGIN { |
|
|
18 | $|=1; |
|
|
19 | print "1..7\n" |
22 | $| = 1; print "1..7\n"; |
20 | } |
|
|
21 | |
23 | |
22 | use POSIX (); |
24 | $AnyEvent::MAX_SIGNAL_LATENCY = 1; |
23 | |
|
|
24 | use AnyEvent; |
|
|
25 | use AnyEvent::Impl::IOAsync; use IO::Async::Loop; AnyEvent::Impl::IOAsync::set_loop new IO::Async::Loop; |
|
|
26 | |
25 | |
27 | print "ok 1\n"; |
26 | print "ok 1\n"; |
28 | |
27 | |
29 | AnyEvent::detect; # force-load event model |
28 | AnyEvent::detect; # force-load event model |
30 | |
29 | |
… | |
… | |
58 | print $pid2 == $_[0] ? "" : "not ", "ok 5 # $pid2 == $_[0]\n"; |
57 | print $pid2 == $_[0] ? "" : "not ", "ok 5 # $pid2 == $_[0]\n"; |
59 | print 7 == ($_[1] >> 8) ? "" : "not ", "ok 6 # 7 == $_[1] >> 8 ($_[1])\n"; |
58 | print 7 == ($_[1] >> 8) ? "" : "not ", "ok 6 # 7 == $_[1] >> 8 ($_[1])\n"; |
60 | $cv2->broadcast; |
59 | $cv2->broadcast; |
61 | }); |
60 | }); |
62 | |
61 | |
63 | my $error = AnyEvent->timer (after => 15, cb => sub { |
62 | my $error = AnyEvent->timer (after => 5, cb => sub { |
64 | print <<EOF; |
63 | print <<EOF; |
65 | Bail out! No child exit detected. This is either a bug in AnyEvent or a bug in your Perl (mostly some windows distributions suffer from that): child watchers might not work properly on this platform. You can force installation of this module if you do not rely on child watchers, or you could upgrade to a working version of Perl for your platform.\n"; |
64 | Bail out! No child exit detected. This is either a bug in AnyEvent or a bug in your Perl (mostly some windows distributions suffer from that): child watchers might not work properly on this platform. You can force installation of this module if you do not rely on child watchers, or you could upgrade to a working version of Perl for your platform.\n"; |
66 | EOF |
65 | EOF |
67 | exit 0; |
66 | exit 0; |
68 | }); |
|
|
69 | |
|
|
70 | my $inter = AnyEvent->timer (after => 14, cb => sub { |
|
|
71 | print "not ok 5 # inter\n"; |
|
|
72 | print "not ok 6 # inter\n"; |
|
|
73 | $cv2->send; |
|
|
74 | }); |
67 | }); |
75 | |
68 | |
76 | $cv2->wait; |
69 | $cv2->wait; |
77 | |
70 | |
78 | print "ok 7\n"; |
71 | print "ok 7\n"; |