Skip to content

Commit bc3280a

Browse files
mamehsbt
authored andcommitted
Guard out the test when it is run under root permission
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 70f21e8 commit bc3280a

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

test/fileutils/test_fileutils.rb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -741,12 +741,14 @@ def test_remove_entry_secure
741741
assert_file_not_exist 'tmp/tmpdir/a'
742742
assert_file_not_exist 'tmp/tmpdir/c'
743743

744-
File.chmod(01777, 'tmp/tmpdir')
745-
if File.sticky?('tmp/tmpdir')
746-
Dir.mkdir 'tmp/tmpdir/d', 0
747-
assert_raise(Errno::EACCES) {remove_entry_secure 'tmp/tmpdir/d'}
748-
File.chmod 0777, 'tmp/tmpdir/d'
749-
Dir.rmdir 'tmp/tmpdir/d'
744+
unless root_in_posix?
745+
File.chmod(01777, 'tmp/tmpdir')
746+
if File.sticky?('tmp/tmpdir')
747+
Dir.mkdir 'tmp/tmpdir/d', 0
748+
assert_raise(Errno::EACCES) {remove_entry_secure 'tmp/tmpdir/d'}
749+
File.chmod 0777, 'tmp/tmpdir/d'
750+
Dir.rmdir 'tmp/tmpdir/d'
751+
end
750752
end
751753

752754
Dir.rmdir 'tmp/tmpdir'

0 commit comments

Comments
 (0)