Revision: | 1.2 |
Committed: | Tue Aug 30 15:45:10 2005 UTC (18 years, 9 months ago) by root |
Content type: | application/x-troff |
Branch: | MAIN |
CVS Tags: | rel-2_32, rel-2_33, rel-2_31, rel-1_61, rel-1_73, rel-1_72, rel-1_71, rel-2_6, rel-2_4, rel-2_5, rel-2_2, rel-2_3, rel-2_0, rel-2_1, rel-1_8, rel-1_7, rel-1_6, rel-2_21, rel-3_1, rel-3_0, rel-2_51, rel-3_01, rel-3_02, rel-3_03, rel-3_04, rel-3_05, rel-3_06, rel-3_07, rel-2_41, rel-3_19, rel-3_18, rel-3_17, rel-3_16, rel-3_15, rel-2_61, rel-2_62 |
Changes since 1.1: | +26 -6 lines |
Log Message: | *** empty log message *** |
# | User | Rev | Content |
---|---|---|---|
1 | root | 1.1 | #!/usr/bin/perl |
2 | |||
3 | use Test; | ||
4 | use IO::AIO; | ||
5 | |||
6 | # this is a lame test, but.... | ||
7 | |||
8 | root | 1.2 | BEGIN { plan tests => 8 } |
9 | root | 1.1 | |
10 | my %f; | ||
11 | ok ((opendir my $dir, "."), 1, "$!"); | ||
12 | $f{$_}++ for readdir $dir; | ||
13 | |||
14 | root | 1.2 | my %x = %f; |
15 | |||
16 | root | 1.1 | aio_readdir ".", sub { |
17 | root | 1.2 | delete $x{"."}; |
18 | delete $x{".."}; | ||
19 | root | 1.1 | if ($_[0]) { |
20 | ok (1); | ||
21 | my $ok = 1; | ||
22 | root | 1.2 | $ok &&= delete $x{$_} for @{$_[0]}; |
23 | root | 1.1 | ok ($ok); |
24 | root | 1.2 | ok (!scalar keys %x); |
25 | root | 1.1 | } else { |
26 | ok (0,1,"$!"); | ||
27 | } | ||
28 | }; | ||
29 | |||
30 | IO::AIO::poll; | ||
31 | |||
32 | root | 1.2 | %x = %f; |
33 | |||
34 | aio_scandir ".", 0, sub { | ||
35 | delete $x{"."}; | ||
36 | delete $x{".."}; | ||
37 | if (@_) { | ||
38 | ok (1); | ||
39 | my $ok = 1; | ||
40 | $ok &&= delete $x{$_} for (@{$_[0]}, @{$_[1]}); | ||
41 | ok ($ok); | ||
42 | ok (!scalar keys %x); | ||
43 | } else { | ||
44 | ok (0,1,"$!"); | ||
45 | } | ||
46 | }; | ||
47 | |||
48 | IO::AIO::poll while IO::AIO::nreqs; | ||
49 | |||
50 | ok (1); | ||
51 | root | 1.1 |