ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/Linux-AIO/t/01_stat.t
Revision: 1.2
Committed: Sun Jul 31 17:05:58 2005 UTC (21 years, 2 months ago) by root
Content type: application/x-troff
Branch: MAIN
CVS Tags: rel-1_9, rel-1_8, HEAD
Changes since 1.1: +28 -28 lines
Log Message:
*** empty log message ***

File Contents

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