summaryrefslogtreecommitdiff
path: root/test/test_find.rb
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-10 10:39:09 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-10 10:39:09 +0000
commitb496220a1f70f8393070ffebcb883c7c5fc036d7 (patch)
treee7df67accf737556f78bf7dcae236d10cc287dea /test/test_find.rb
parent0542d61e2717a3b8e1e4a2972bd32385a036cab8 (diff)
skip some tests so that no failure occurs in root privilege
Some tests had failed on `sudo make test-all`, mainly because root can access any files regardless of permission. This change adds `skip` guards into such tests. Note that almost all tests in which `skip` guards is added, already have "windows" guard. This is because there is no support to avoid read access by owner on Windows. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_find.rb')
-rw-r--r--test/test_find.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/test_find.rb b/test/test_find.rb
index d4d958859d..01b1fcc121 100644
--- a/test/test_find.rb
+++ b/test/test_find.rb
@@ -104,6 +104,8 @@ class TestFind < Test::Unit::TestCase
def test_unreadable_dir
skip "no meaning test on Windows" if /mswin|mingw/ =~ RUBY_PLATFORM
+ skip if Process.uid == 0 # because root can read anything
+
Dir.mktmpdir {|d|
Dir.mkdir(dir = "#{d}/dir")
File.open("#{dir}/foo", "w"){}
@@ -157,6 +159,8 @@ class TestFind < Test::Unit::TestCase
assert_equal([d, dir, file], a)
skip "no meaning test on Windows" if /mswin|mingw/ =~ RUBY_PLATFORM
+ skip "skipped because root can read anything" if Process.uid == 0
+
a = []
assert_raise_with_message(Errno::EACCES, /#{Regexp.quote(file)}/) do
Find.find(d, ignore_error: false) {|f| a << f }