diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb index 5f1cc41e3aafcd..28488cd27f39a6 100644 --- a/test/fileutils/test_fileutils.rb +++ b/test/fileutils/test_fileutils.rb @@ -48,7 +48,7 @@ def have_symlink? def check_have_symlink? File.symlink nil, nil - rescue NotImplementedError + rescue NotImplementedError, Errno::EACCES return false rescue return true diff --git a/test/pathname/test_pathname.rb b/test/pathname/test_pathname.rb index 53baa5cbc86a16..4842f96d0f9df1 100644 --- a/test/pathname/test_pathname.rb +++ b/test/pathname/test_pathname.rb @@ -340,7 +340,7 @@ def with_tmpchdir(base=nil) def has_symlink? begin File.symlink(nil, nil) - rescue NotImplementedError + rescue NotImplementedError, Errno::EACCES return false rescue TypeError end diff --git a/test/ruby/test_dir.rb b/test/ruby/test_dir.rb index 44c9b7c5f7a12f..33d83cbca324f5 100644 --- a/test/ruby/test_dir.rb +++ b/test/ruby/test_dir.rb @@ -224,7 +224,7 @@ def test_symlink File.symlink(File.join(@root, f), File.join(@root, "symlink-#{ f }")) end - rescue NotImplementedError + rescue NotImplementedError, Errno::EACCES return end @@ -303,7 +303,7 @@ def test_symlinks_not_resolved Dir.chdir(dirname) do begin File.symlink('some-dir', 'dir-symlink') - rescue NotImplementedError + rescue NotImplementedError, Errno::EACCES return end diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb index b36b6168ee5350..e4b92152e53417 100644 --- a/test/ruby/test_file_exhaustive.rb +++ b/test/ruby/test_file_exhaustive.rb @@ -110,7 +110,7 @@ def symlinkfile @symlinkfile = make_tmp_filename("symlinkfile") begin File.symlink(regular_file, @symlinkfile) - rescue NotImplementedError + rescue NotImplementedError, Errno::EACCES @symlinkfile = nil end @symlinkfile diff --git a/test/ruby/test_require.rb b/test/ruby/test_require.rb index 1d70e39605380a..25116e4912e12f 100644 --- a/test/ruby/test_require.rb +++ b/test/ruby/test_require.rb @@ -403,7 +403,7 @@ def test_relative_symlink File.symlink("../a/tst.rb", "b/tst.rb") result = IO.popen([EnvUtil.rubybin, "b/tst.rb"], &:read) assert_equal("a/lib.rb\n", result, "[ruby-dev:40040]") - rescue NotImplementedError + rescue NotImplementedError, Errno::EACCES skip "File.symlink is not implemented" end } diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb index ef9a8f257e661c..efdaeed2379fde 100644 --- a/test/ruby/test_rubyoptions.rb +++ b/test/ruby/test_rubyoptions.rb @@ -437,10 +437,14 @@ def test_program_name } if File.respond_to? :symlink n2 = File.join(d, 't2') - File.symlink(n1, n2) - IO.popen([ruby, n2]) {|f| - assert_equal(n2, f.read) - } + begin + File.symlink(n1, n2) + rescue Errno::EACCES + else + IO.popen([ruby, n2]) {|f| + assert_equal(n2, f.read) + } + end end Dir.chdir(d) { n3 = '-e' diff --git a/test/test_find.rb b/test/test_find.rb index cb2ce5612955ef..2fa81eb0b41ad4 100644 --- a/test/test_find.rb +++ b/test/test_find.rb @@ -47,7 +47,7 @@ def test_dont_follow_symlink File.open("#{d}/b/b", "w"){} begin File.symlink("#{d}/b", "#{d}/c") - rescue NotImplementedError + rescue NotImplementedError, Errno::EACCES skip "symlink is not supported." end a = [] @@ -168,7 +168,7 @@ def test_dangling_symlink Dir.mktmpdir {|d| begin File.symlink("foo", "#{d}/bar") - rescue NotImplementedError + rescue NotImplementedError, Errno::EACCES skip "symlink is not supported." end a = [] @@ -182,7 +182,7 @@ def test_dangling_symlink_stat_error Dir.mktmpdir {|d| begin File.symlink("foo", "#{d}/bar") - rescue NotImplementedError + rescue NotImplementedError, Errno::EACCES skip "symlink is not supported." end assert_raise(Errno::ENOENT) { @@ -228,7 +228,7 @@ def test_change_dir_to_symlink_loop File.rename(dir_1, dir_2) begin File.symlink("d1", dir_1) - rescue NotImplementedError + rescue NotImplementedError, Errno::EACCES skip "symlink is not supported." end end