1*0Sstevel@tonic-gate#!./perl 2*0Sstevel@tonic-gateuse FileCache maxopen=>2; 3*0Sstevel@tonic-gateuse Test; 4*0Sstevel@tonic-gateuse vars qw(@files); 5*0Sstevel@tonic-gateBEGIN { 6*0Sstevel@tonic-gate @files = qw(foo bar baz quux); 7*0Sstevel@tonic-gate chdir 't' if -d 't'; 8*0Sstevel@tonic-gate 9*0Sstevel@tonic-gate #For tests within the perl distribution 10*0Sstevel@tonic-gate @INC = '../lib' if -d '../lib'; 11*0Sstevel@tonic-gate END; 12*0Sstevel@tonic-gate plan tests=>5; 13*0Sstevel@tonic-gate} 14*0Sstevel@tonic-gateEND{ 15*0Sstevel@tonic-gate 1 while unlink @files; 16*0Sstevel@tonic-gate} 17*0Sstevel@tonic-gate 18*0Sstevel@tonic-gate{# Test 2: that we actually adhere to maxopen 19*0Sstevel@tonic-gate for my $path ( @files ){ 20*0Sstevel@tonic-gate cacheout $path; 21*0Sstevel@tonic-gate print $path "$path 1\n"; 22*0Sstevel@tonic-gate } 23*0Sstevel@tonic-gate 24*0Sstevel@tonic-gate my @cat; 25*0Sstevel@tonic-gate for my $path ( @files ){ 26*0Sstevel@tonic-gate ok(fileno($path) || $path =~ /^(?:foo|bar)$/); 27*0Sstevel@tonic-gate next unless fileno($path); 28*0Sstevel@tonic-gate print $path "$path 2\n"; 29*0Sstevel@tonic-gate close($path); 30*0Sstevel@tonic-gate open($path, $path); 31*0Sstevel@tonic-gate <$path>; 32*0Sstevel@tonic-gate push @cat, <$path>; 33*0Sstevel@tonic-gate close($path); 34*0Sstevel@tonic-gate } 35*0Sstevel@tonic-gate ok( grep(/^(?:baz|quux) 2$/, @cat) == 2 ); 36*0Sstevel@tonic-gate} 37