[前][次][番号順一覧][スレッド一覧]

ruby-changes:39633

From: nobu <ko1@a...>
Date: Fri, 28 Aug 2015 10:24:54 +0900 (JST)
Subject: [ruby-changes:39633] nobu:r51714 (trunk): test: File.symlink needs administrator privilege

nobu	2015-08-28 10:24:36 +0900 (Fri, 28 Aug 2015)

  New Revision: 51714

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51714

  Log:
    test: File.symlink needs administrator privilege

  Modified files:
    trunk/test/fileutils/test_fileutils.rb
    trunk/test/pathname/test_pathname.rb
    trunk/test/ruby/test_dir.rb
    trunk/test/ruby/test_file_exhaustive.rb
    trunk/test/ruby/test_require.rb
    trunk/test/ruby/test_rubyoptions.rb
    trunk/test/test_find.rb
Index: test/ruby/test_require.rb
===================================================================
--- test/ruby/test_require.rb	(revision 51713)
+++ test/ruby/test_require.rb	(revision 51714)
@@ -403,7 +403,7 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L403
           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
       }
Index: test/ruby/test_file_exhaustive.rb
===================================================================
--- test/ruby/test_file_exhaustive.rb	(revision 51713)
+++ test/ruby/test_file_exhaustive.rb	(revision 51714)
@@ -110,7 +110,7 @@ class TestFileExhaustive < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file_exhaustive.rb#L110
     @symlinkfile = make_tmp_filename("symlinkfile")
     begin
       File.symlink(regular_file, @symlinkfile)
-    rescue NotImplementedError
+    rescue NotImplementedError, Errno::EACCES
       @symlinkfile = nil
     end
     @symlinkfile
Index: test/ruby/test_dir.rb
===================================================================
--- test/ruby/test_dir.rb	(revision 51713)
+++ test/ruby/test_dir.rb	(revision 51714)
@@ -224,7 +224,7 @@ class TestDir < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_dir.rb#L224
 	File.symlink(File.join(@root, f),
 		     File.join(@root, "symlink-#{ f }"))
       end
-    rescue NotImplementedError
+    rescue NotImplementedError, Errno::EACCES
       return
     end
 
@@ -303,7 +303,7 @@ class TestDir < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_dir.rb#L303
       Dir.chdir(dirname) do
         begin
           File.symlink('some-dir', 'dir-symlink')
-        rescue NotImplementedError
+        rescue NotImplementedError, Errno::EACCES
           return
         end
 
Index: test/ruby/test_rubyoptions.rb
===================================================================
--- test/ruby/test_rubyoptions.rb	(revision 51713)
+++ test/ruby/test_rubyoptions.rb	(revision 51714)
@@ -437,10 +437,14 @@ class TestRubyOptions < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rubyoptions.rb#L437
       }
       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'
Index: test/fileutils/test_fileutils.rb
===================================================================
--- test/fileutils/test_fileutils.rb	(revision 51713)
+++ test/fileutils/test_fileutils.rb	(revision 51714)
@@ -48,7 +48,7 @@ class TestFileUtils < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/fileutils/test_fileutils.rb#L48
 
     def check_have_symlink?
       File.symlink nil, nil
-    rescue NotImplementedError
+    rescue NotImplementedError, Errno::EACCES
       return false
     rescue
       return true
Index: test/pathname/test_pathname.rb
===================================================================
--- test/pathname/test_pathname.rb	(revision 51713)
+++ test/pathname/test_pathname.rb	(revision 51714)
@@ -340,7 +340,7 @@ class TestPathname < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/pathname/test_pathname.rb#L340
   def has_symlink?
     begin
       File.symlink(nil, nil)
-    rescue NotImplementedError
+    rescue NotImplementedError, Errno::EACCES
       return false
     rescue TypeError
     end
Index: test/test_find.rb
===================================================================
--- test/test_find.rb	(revision 51713)
+++ test/test_find.rb	(revision 51714)
@@ -47,7 +47,7 @@ class TestFind < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/test_find.rb#L47
       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 @@ class TestFind < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/test_find.rb#L168
     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 @@ class TestFind < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/test_find.rb#L182
     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 @@ class TestFind < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/test_find.rb#L228
           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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]