ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/IO-AIO/t/01_stat.t
(Generate patch)

Comparing IO-AIO/t/01_stat.t (file contents):
Revision 1.1 by root, Sun Jul 10 17:07:44 2005 UTC vs.
Revision 1.7 by root, Sat Jan 7 18:42:43 2012 UTC

1$| = 1; 1$| = 1;
2 2
3if (-f "/etc/passwd" and -d "/etc") { 3if (-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
24aio_open "/etc/passwd", O_RDONLY, 0, sub { 24aio_open "AIO.xs", O_RDONLY, 0, sub {
25 print $_[0] >= 0 ? "ok" : "not ok", " 1\n"; 25 print $_[0] ? "ok" : "not ok", " 1\n";
26
26 $pwd = $_[0]; 27 $pwd = $_[0];
27}; 28};
28 29
29pcb; 30pcb;
30 31
31aio_stat "/etc", sub { 32aio_stat "bin", sub {
32 print -d _ ? "ok" : "not ok", " 2\n"; 33 print -d _ ? "ok" : "not ok", " 2\n";
33}; 34};
34 35
35pcb; 36pcb;
36 37
37aio_stat "/etc/passwd", sub { 38aio_stat "AIO.xs", sub {
38 @pwd = stat _; 39 @pwd = stat _;
39 print -f _ ? "ok" : "not ok", " 3\n"; 40 print -f _ ? "ok" : "not ok", " 3\n";
40 print eval { lstat _; 1 } ? "not ok" : "ok", " 4\n"; 41 print eval { lstat _; 1 } ? "not ok" : "ok", " 4\n";
41}; 42};
42 43
43pcb; 44pcb;
44 45
45aio_lstat "/etc/passwd", sub { 46aio_lstat "AIO.xs", sub {
46 lstat _; 47 lstat _;
47 print -f _ ? "ok" : "not ok", " 5\n"; 48 print -f _ ? "ok" : "not ok", " 5\n";
48 print eval { stat _; 1 } ? "ok" : "not ok", " 6\n"; 49 print eval { stat _; 1 } ? "ok" : "not ok", " 6\n";
49}; 50};
50 51
51pcb; 52pcb;
52 53
53print open (PWD, "<&$pwd") ? "ok" : "not ok", " 7\n"; 54print open (PWD, "<&" . fileno $pwd) ? "ok" : "not ok", " 7\n";
54 55
55aio_stat *PWD, sub { 56aio_stat *PWD, sub {
56 print -f _ ? "ok" : "not ok", " 8\n"; 57 print -f _ ? "ok" : "not ok", " 8\n";
58 my @stat = stat _;
59 $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
57 print +(join ":", @pwd) eq (join ":", stat _) ? "ok" : "not ok", " 9\n"; 62 print +(join ":", @pwd) eq (join ":", @stat) ? "ok" : "not ok", " 9 # @pwd == @stat\n";
58}; 63};
59 64
60pcb; 65pcb;
61 66
62aio_close *PWD, sub { 67aio_close *PWD, sub {
63 print $_[0] ? "not ok" : "ok", " 10\n"; 68 print $_[0] ? "not ok" : "ok", " 10 # <@_>\n";
64}; 69};
65 70
66pcb; 71pcb;
72

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines