ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Linux-AIO/t/01_stat.t
Revision: 1.2
Committed: Sun Jul 31 17:05:58 2005 UTC (18 years, 10 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

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