3 # There are few filetest operators that are portable enough to test.
4 # See pod/perlport.pod for details.
9 unshift @INC, '../lib' if -d '../lib';
15 print "not " unless -d 'op';
18 print "not " unless -f 'TEST';
21 print "not " if -f 'op';
24 print "not " if -d 'TEST';
27 print "not " unless -r 'TEST';
30 # make sure TEST is r-x
31 eval { chmod 0555, 'TEST' };
34 $oldeuid = $>; # root can read and write anything
35 eval '$> = 1'; # so switch uid (may not be implemented)
37 print "# oldeuid = $oldeuid, euid = $>\n";
40 print "#[$@]\nok 6 #skipped\n";
43 print "not " if -w 'TEST';
47 # Scripts are not -x everywhere so cannot test that.
49 print "not " unless -r 'op';
52 eval '$> = $oldeuid'; # switch uid back (may not be implemented)
54 # this would fail for the euid 1
55 # (unless we have unpacked the source code as uid 1...)
56 if ($Config{d_seteuid}) {
57 print "not " unless -w 'op';
60 print "ok 8 #skipped, no seteuid\n";
63 print "not " unless -x 'op'; # Hohum. Are directories -x everywhere?
66 print "not " unless "@{[grep -r, qw(foo io noo op zoo)]}" eq "io op";