X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fop%2Ffiletest.t;h=e00d5fb7b06b82eeaf782d13f74f8f819d1080a6;hb=dfed14d211a4828e9d879513466e41afb47fa3fb;hp=13c5917adc070dd3f66ad70ac6444398a3a8471e;hpb=22c35a8c2392967a5ba6b5370695be464bd7012c;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/op/filetest.t b/t/op/filetest.t index 13c5917..e00d5fb 100644 --- a/t/op/filetest.t +++ b/t/op/filetest.t @@ -5,8 +5,10 @@ BEGIN { chdir 't' if -d 't'; + unshift @INC, '../lib' if -d '../lib'; } +use Config; print "1..10\n"; print "not " unless -d 'op'; @@ -26,21 +28,41 @@ print "ok 5\n"; # make sure TEST is r-x eval { chmod 0555, 'TEST' }; -if ($@) { - print "#[$@]\nok 6 # skipped\n"; +$bad_chmod = $@; + +$oldeuid = $>; # root can read and write anything +eval '$> = 1'; # so switch uid (may not be implemented) + +print "# oldeuid = $oldeuid, euid = $>\n"; + +if (!$Config{d_seteuid}) { + print "ok 6 #skipped, no seteuid\n"; +} +elsif ($bad_chmod) { + print "#[$@]\nok 6 #skipped\n"; } else { - print "not " if -w 'TEST'; - print "ok 6\n"; + print "not " if -w 'TEST'; + print "ok 6\n"; } -# Scripts are not -x everywhere. +# Scripts are not -x everywhere so cannot test that. + +eval '$> = $oldeuid'; # switch uid back (may not be implemented) +# this would fail for the euid 1 +# (unless we have unpacked the source code as uid 1...) print "not " unless -r 'op'; print "ok 7\n"; -print "not " unless -w 'op'; -print "ok 8\n"; +# this would fail for the euid 1 +# (unless we have unpacked the source code as uid 1...) +if ($Config{d_seteuid}) { + print "not " unless -w 'op'; + print "ok 8\n"; +} else { + print "ok 8 #skipped, no seteuid\n"; +} print "not " unless -x 'op'; # Hohum. Are directories -x everywhere? print "ok 9\n";