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

Comparing IO-AIO/t/02_read.t (file contents):
Revision 1.2 by root, Sun Jul 10 18:16:50 2005 UTC vs.
Revision 1.5 by root, Sun Jul 17 17:30:15 2011 UTC

1$| = 1; 1$| = 1;
2 2
3if (-f "/etc/passwd" and -d "/etc") { 3if (-f "AIO.xs" and -d "bin") {
4 print "1..2\n"; 4 print "1..2\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
10# relies on /etc/passwd to exist...
11 9
12use Fcntl; 10use Fcntl;
13use IO::AIO; 11use IO::AIO;
14 12
15IO::AIO::min_parallel 2; 13IO::AIO::min_parallel 2;
21 } 19 }
22} 20}
23 21
24my $pwd; 22my $pwd;
25 23
26aio_open "/etc/passwd", O_RDONLY, 0, sub { 24aio_open "AIO.xs", O_RDONLY, 0, sub {
27 print $_[0] ? "ok" : "not ok", " 1\n"; 25 print $_[0] ? "ok" : "not ok", " 1\n";
28 $pwd = $_[0]; 26 $pwd = $_[0];
29}; 27};
30 28
31pcb; 29pcb;
35sysseek $pwd, 7, 0; 33sysseek $pwd, 7, 0;
36sysread $pwd, $sysread, 15; 34sysread $pwd, $sysread, 15;
37 35
38# I found no way to silence the stupid "uninitialized...subroutine entry" warning. 36# I found no way to silence the stupid "uninitialized...subroutine entry" warning.
39# this is just braindamaged. Don't use -w, it introduces more bugs than it fixes. 37# this is just braindamaged. Don't use -w, it introduces more bugs than it fixes.
40$aioread = ""; 38$aioread = "xxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy";
41 39
42aio_read $pwd, 7, 15, $aioread, 0, sub { 40aio_read $pwd, 7, 15, $aioread, 3, sub {
43 print +($aioread eq $sysread) ? "ok" : "not ok", " 2\n"; 41 print +($aioread eq "xxx$sysread") ? "ok" : "not ok", " 2\n";
44}; 42};
45 43
46pcb; 44pcb;
47 45

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines