ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/IO-AIO/t/01_stat.t
Revision: 1.7
Committed: Sat Jan 7 18:42:43 2012 UTC (12 years, 6 months ago) by root
Content type: application/x-troff
Branch: MAIN
CVS Tags: rel-4_81, rel-4_80, rel-4_17, rel-4_14, rel-4_15, rel-4_18, rel-4_19, rel-4_4, rel-4_5, rel-4_6, rel-4_7, rel-4_2, rel-4_3, rel-4_78, rel-4_79, rel-4_74, rel-4_75, rel-4_76, rel-4_77, rel-4_71, rel-4_72, rel-4_73, rel-4_52, rel-4_53, rel-4_51, rel-4_54, rel-4_34, rel-4_31, rel-4_32, rel-4_33, HEAD
Changes since 1.6: +4 -3 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 $| = 1;
2    
3 root 1.6 if (-f "AIO.xs" and -d "bin") {
4 root 1.1 print "1..10\n";
5     } else {
6 root 1.6 print "1..0 # Skipped: unexpected bin and/or AIO.xs\n";
7 root 1.1 exit;
8     }
9    
10     # relies on /etc/passwd to exist...
11    
12     use Fcntl;
13     use IO::AIO;
14    
15     IO::AIO::min_parallel 2;
16    
17     sub pcb {
18     while (IO::AIO::nreqs) {
19     my $rfd = ""; vec ($rfd, IO::AIO::poll_fileno, 1) = 1; select $rfd, undef, undef, undef;
20     IO::AIO::poll_cb;
21     }
22     }
23    
24 root 1.6 aio_open "AIO.xs", O_RDONLY, 0, sub {
25 root 1.2 print $_[0] ? "ok" : "not ok", " 1\n";
26    
27 root 1.1 $pwd = $_[0];
28     };
29    
30     pcb;
31    
32 root 1.6 aio_stat "bin", sub {
33 root 1.1 print -d _ ? "ok" : "not ok", " 2\n";
34     };
35    
36     pcb;
37    
38 root 1.6 aio_stat "AIO.xs", sub {
39 root 1.1 @pwd = stat _;
40     print -f _ ? "ok" : "not ok", " 3\n";
41     print eval { lstat _; 1 } ? "not ok" : "ok", " 4\n";
42     };
43    
44     pcb;
45    
46 root 1.6 aio_lstat "AIO.xs", sub {
47 root 1.1 lstat _;
48     print -f _ ? "ok" : "not ok", " 5\n";
49     print eval { stat _; 1 } ? "ok" : "not ok", " 6\n";
50     };
51    
52     pcb;
53    
54 root 1.2 print open (PWD, "<&" . fileno $pwd) ? "ok" : "not ok", " 7\n";
55 root 1.1
56     aio_stat *PWD, sub {
57     print -f _ ? "ok" : "not ok", " 8\n";
58 root 1.5 my @stat = stat _;
59 root 1.7 $stat[0] = $pwd[0]; # dev unreliable on windows
60     $stat[6] = $pwd[6]; # rdev unreliable on windows
61     $stat[8] = $pwd[8]; # atime unreliable on windows
62     print +(join ":", @pwd) eq (join ":", @stat) ? "ok" : "not ok", " 9 # @pwd == @stat\n";
63 root 1.1 };
64    
65     pcb;
66    
67     aio_close *PWD, sub {
68 root 1.4 print $_[0] ? "not ok" : "ok", " 10 # <@_>\n";
69 root 1.1 };
70    
71     pcb;
72 root 1.3