ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/IO-AIO/t/02_read.t
Revision: 1.5
Committed: Sun Jul 17 17:30:15 2011 UTC (12 years, 11 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_12, rel-4_11, rel-4_18, rel-4_19, rel-4_4, rel-4_5, rel-4_6, rel-4_7, rel-4_0, rel-4_1, 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.4: +3 -5 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 $| = 1;
2
3 if (-f "AIO.xs" and -d "bin") {
4 print "1..2\n";
5 } else {
6 print "1..0 # Skipped: unexpected bin and/or AIO.xs\n";
7 exit;
8 }
9
10 use Fcntl;
11 use IO::AIO;
12
13 IO::AIO::min_parallel 2;
14
15 sub pcb {
16 while (IO::AIO::nreqs) {
17 my $rfd = ""; vec ($rfd, IO::AIO::poll_fileno, 1) = 1; select $rfd, undef, undef, undef;
18 IO::AIO::poll_cb;
19 }
20 }
21
22 my $pwd;
23
24 aio_open "AIO.xs", O_RDONLY, 0, sub {
25 print $_[0] ? "ok" : "not ok", " 1\n";
26 $pwd = $_[0];
27 };
28
29 pcb;
30
31 my ($sysread, $aioread);
32
33 sysseek $pwd, 7, 0;
34 sysread $pwd, $sysread, 15;
35
36 # I found no way to silence the stupid "uninitialized...subroutine entry" warning.
37 # this is just braindamaged. Don't use -w, it introduces more bugs than it fixes.
38 $aioread = "xxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy";
39
40 aio_read $pwd, 7, 15, $aioread, 3, sub {
41 print +($aioread eq "xxx$sysread") ? "ok" : "not ok", " 2\n";
42 };
43
44 pcb;
45