summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-03 17:11:43 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-03 17:11:43 +0000
commit4ef849bd9014746821402e21053a53ea61b3690d (patch)
tree2e39257fd947b41ff8ee6c24cb7f7ee1cb5b4aa0 /test
parenta75bc36dd27006ef5534da44c1cf2af4a1cbd171 (diff)
test_require.rb: ignore EPERM at UNC
* test/ruby/test_require.rb (test_require_with_unc): ignore EPERM. GetFileAttributes and CreateFile with backup semantics fail at a symlink in a shared folder to another shared folder. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_require.rb21
1 files changed, 14 insertions, 7 deletions
diff --git a/test/ruby/test_require.rb b/test/ruby/test_require.rb
index 7dc7b4eb49..666f2fcd82 100644
--- a/test/ruby/test_require.rb
+++ b/test/ruby/test_require.rb
@@ -222,13 +222,20 @@ class TestRequire < Test::Unit::TestCase
end
def test_require_with_unc
- ruby = File.expand_path(EnvUtil.rubybin).sub(/\A(\w):/, '//127.0.0.1/\1$/')
- skip "local drive #$1: is not shared" unless File.exist?(ruby)
- pid = nil
- assert_nothing_raised {pid = spawn(ruby, "-rabbrev", "-e0")}
- ret, status = Process.wait2(pid)
- assert_equal(pid, ret)
- assert_predicate(status, :success?)
+ Tempfile.create(["test_ruby_test_require", ".rb"]) {|t|
+ t.puts "puts __FILE__"
+ t.close
+
+ path = File.expand_path(t.path).sub(/\A(\w):/, '//127.0.0.1/\1$/')
+ skip "local drive #$1: is not shared" unless File.exist?(path)
+ args = ['--disable-gems', "-I#{File.dirname(path)}"]
+ assert_in_out_err(args, "#{<<~"END;"}", [path], [])
+ begin
+ require '#{File.basename(path)}'
+ rescue Errno::EPERM
+ end
+ END;
+ }
end if /mswin|mingw/ =~ RUBY_PLATFORM
def test_require_twice