Skip to content

Commit

Permalink
test: File.symlink needs administrator privilege
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Aug 28, 2015
1 parent 7b2c963 commit 1a8c38e
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion test/fileutils/test_fileutils.rb
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/pathname/test_pathname.rb
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/ruby/test_dir.rb
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion test/ruby/test_file_exhaustive.rb
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/ruby/test_require.rb
Expand Up @@ -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
}
Expand Down
12 changes: 8 additions & 4 deletions test/ruby/test_rubyoptions.rb
Expand Up @@ -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'
Expand Down
8 changes: 4 additions & 4 deletions test/test_find.rb
Expand Up @@ -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 = []
Expand Down Expand Up @@ -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 = []
Expand All @@ -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) {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1a8c38e

Please sign in to comment.