1 | $| = 1; |
1 | $| = 1; |
2 | |
2 | |
3 | if (-f "/etc/passwd" and -d "/etc") { |
3 | if (-f "AIO.xs" and -d "bin") { |
4 | print "1..10\n"; |
4 | print "1..10\n"; |
5 | } else { |
5 | } else { |
6 | print "1..0 # Skipped: unexpected /etc and/or /etc/passwd\n"; |
6 | print "1..0 # Skipped: unexpected bin and/or AIO.xs\n"; |
7 | exit; |
7 | exit; |
8 | } |
8 | } |
9 | |
9 | |
10 | # relies on /etc/passwd to exist... |
10 | # relies on /etc/passwd to exist... |
11 | |
11 | |
… | |
… | |
19 | my $rfd = ""; vec ($rfd, IO::AIO::poll_fileno, 1) = 1; select $rfd, undef, undef, undef; |
19 | my $rfd = ""; vec ($rfd, IO::AIO::poll_fileno, 1) = 1; select $rfd, undef, undef, undef; |
20 | IO::AIO::poll_cb; |
20 | IO::AIO::poll_cb; |
21 | } |
21 | } |
22 | } |
22 | } |
23 | |
23 | |
24 | aio_open "/etc/passwd", O_RDONLY, 0, sub { |
24 | aio_open "AIO.xs", O_RDONLY, 0, sub { |
25 | print $_[0] ? "ok" : "not ok", " 1\n"; |
25 | print $_[0] ? "ok" : "not ok", " 1\n"; |
26 | |
26 | |
27 | $pwd = $_[0]; |
27 | $pwd = $_[0]; |
28 | }; |
28 | }; |
29 | |
29 | |
30 | pcb; |
30 | pcb; |
31 | |
31 | |
32 | aio_stat "/etc", sub { |
32 | aio_stat "bin", sub { |
33 | print -d _ ? "ok" : "not ok", " 2\n"; |
33 | print -d _ ? "ok" : "not ok", " 2\n"; |
34 | }; |
34 | }; |
35 | |
35 | |
36 | pcb; |
36 | pcb; |
37 | |
37 | |
38 | aio_stat "/etc/passwd", sub { |
38 | aio_stat "AIO.xs", sub { |
39 | @pwd = stat _; |
39 | @pwd = stat _; |
40 | print -f _ ? "ok" : "not ok", " 3\n"; |
40 | print -f _ ? "ok" : "not ok", " 3\n"; |
41 | print eval { lstat _; 1 } ? "not ok" : "ok", " 4\n"; |
41 | print eval { lstat _; 1 } ? "not ok" : "ok", " 4\n"; |
42 | }; |
42 | }; |
43 | |
43 | |
44 | pcb; |
44 | pcb; |
45 | |
45 | |
46 | aio_lstat "/etc/passwd", sub { |
46 | aio_lstat "AIO.xs", sub { |
47 | lstat _; |
47 | lstat _; |
48 | print -f _ ? "ok" : "not ok", " 5\n"; |
48 | print -f _ ? "ok" : "not ok", " 5\n"; |
49 | print eval { stat _; 1 } ? "ok" : "not ok", " 6\n"; |
49 | print eval { stat _; 1 } ? "ok" : "not ok", " 6\n"; |
50 | }; |
50 | }; |
51 | |
51 | |