ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Linux-AIO/t/01_stat.t
Revision: 1.1
Committed: Tue Apr 2 14:32:38 2002 UTC (22 years, 2 months ago) by root
Content type: application/x-troff
Branch: MAIN
CVS Tags: rel-1_71, rel-1_5, rel-1_6
Log Message:
*** empty log message ***

File Contents

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