1 | #! perl |
1 | #! perl |
2 | |
2 | |
3 | $| = 1; |
3 | $| = 1; |
4 | |
4 | |
|
|
5 | # not tested: symlink, readlink, link, utime, chown, chmod |
|
|
6 | |
5 | BEGIN { |
7 | BEGIN { |
6 | print "1..37\n"; |
8 | print "1..38\n"; |
7 | print "ok 1 # MODEL=$AnyEvent::IO::MODEL\n"; |
9 | print "ok 1 # MODEL=$AnyEvent::IO::MODEL\n"; |
8 | } |
10 | } |
9 | use AnyEvent; |
11 | use AnyEvent; |
10 | use AnyEvent::IO qw(:DEFAULT :flags); |
12 | use AnyEvent::IO qw(:DEFAULT :flags); |
11 | BEGIN { |
13 | BEGIN { |
… | |
… | |
14 | |
16 | |
15 | our $t = 3; |
17 | our $t = 3; |
16 | |
18 | |
17 | sub t { |
19 | sub t { |
18 | my $ok = shift; |
20 | my $ok = shift; |
19 | my $f = "io_" . shift; |
21 | my $f = "aio_" . shift; |
20 | $f->(@_, my $cv = AE::cv); |
22 | $f->(@_, my $cv = AE::cv); |
21 | my @res = $cv->recv; |
23 | my @res = $cv->recv; |
22 | |
24 | |
23 | print !@res != !$ok ? "not " : "", "ok ", $t++, " # $f (@_) = (@res)\n"; |
25 | print !@res != !$ok ? "not " : "", "ok ", $t++, " # $f (@_) = (@res)\n"; |
24 | |
26 | |
… | |
… | |
39 | t 0, open => "$DIR/test", O_CREAT | O_EXCL | O_WRONLY, 0666; |
41 | t 0, open => "$DIR/test", O_CREAT | O_EXCL | O_WRONLY, 0666; |
40 | |
42 | |
41 | t 0, rmdir => $DIR; |
43 | t 0, rmdir => $DIR; |
42 | |
44 | |
43 | t 1, write => $fh, "tes--"; |
45 | t 1, write => $fh, "tes--"; |
44 | t 1, write => $fh, "test2"; |
46 | t 1, write => $fh, "test2truncate"; |
45 | t 1, write => $fh, ""; |
47 | t 1, write => $fh, ""; |
46 | |
48 | |
47 | t 1, seek => $fh, 3, 0; |
49 | t 1, seek => $fh, 3, 0; |
48 | t 1, write => $fh, "t1"; |
50 | t 1, write => $fh, "t1"; |
|
|
51 | |
|
|
52 | t 1, truncate => $fh, 5+5; |
49 | |
53 | |
50 | t 1, stat => $fh; |
54 | t 1, stat => $fh; |
51 | print -s _ != 10 ? "not " : "", "ok ", $t++, " # stat size\n"; |
55 | print -s _ != 10 ? "not " : "", "ok ", $t++, " # stat size\n"; |
52 | |
56 | |
53 | t 1, close => $fh; |
57 | t 1, close => $fh; |