From: Nicholas Clark Date: Thu, 27 Aug 2009 19:37:49 +0000 (+0100) Subject: Don't use t/TEST to test a "read only file", repeatedly chmod-ing it a-w. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d418880282b996e8cb066a570596b473fa7900da;p=p5sagit%2Fp5-mst-13.2.git Don't use t/TEST to test a "read only file", repeatedly chmod-ing it a-w. --- diff --git a/t/op/filetest.t b/t/op/filetest.t index 0d4f7c7..4659c70 100644 --- a/t/op/filetest.t +++ b/t/op/filetest.t @@ -18,9 +18,15 @@ ok( !-f 'op' ); ok( !-d 'TEST' ); ok( -r 'TEST' ); -# make sure TEST is r-x -eval { chmod 0555, 'TEST' or die "chmod 0555, 'TEST' failed: $!" }; -chomp ($bad_chmod = $@); +# Make a read only file +my $ro_file = tempfile(); + +{ + open my $fh, '>', $ro_file or die "open $fh: $!"; + close $fh or die "close $fh: $!"; +} + +chmod 0555, $ro_file or die "chmod 0555, '$ro_file' failed: $!"; $oldeuid = $>; # root can read and write anything eval '$> = 1'; # so switch uid (may not be implemented) @@ -31,14 +37,8 @@ SKIP: { if (!$Config{d_seteuid}) { skip('no seteuid'); } - elsif ($Config{config_args} =~/Dmksymlinks/) { - skip('we cannot chmod symlinks'); - } - elsif ($bad_chmod) { - skip( $bad_chmod ); - } else { - ok( !-w 'TEST' ); + ok( !-w $ro_file ); } }