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

ruby-changes:54354

From: mame <ko1@a...>
Date: Wed, 26 Dec 2018 14:31:26 +0900 (JST)
Subject: [ruby-changes:54354] mame:r66568 (trunk): test/ruby/test_process.rb (test_execopts_uid): rescue Errno::EACCES

mame	2018-12-26 14:31:22 +0900 (Wed, 26 Dec 2018)

  New Revision: 66568

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

  Log:
    test/ruby/test_process.rb (test_execopts_uid): rescue Errno::EACCES
    
    The tests fail under the following condition:
    
        * executed as a root
        * the code is in a directory that uid:30000 user cannot access
          (e.g., /root)
    
    So, this change rescues Errno::EACCES explicitly.
    Also, this change adds `exception: true` to `Kernel#system` calls.

  Modified files:
    trunk/test/ruby/test_process.rb
Index: test/ruby/test_process.rb
===================================================================
--- test/ruby/test_process.rb	(revision 66567)
+++ test/ruby/test_process.rb	(revision 66568)
@@ -1871,16 +1871,16 @@ class TestProcess < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L1871
       if user
         assert_nothing_raised(feature6975) do
           begin
-            system(*TRUECOMMAND, uid: user)
-          rescue Errno::EPERM, NotImplementedError
+            system(*TRUECOMMAND, uid: user, exception: true)
+          rescue Errno::EPERM, Errno::EACCES, NotImplementedError
           end
         end
       end
 
       assert_nothing_raised(feature6975) do
         begin
-          system(*TRUECOMMAND, uid: uid)
-        rescue Errno::EPERM, NotImplementedError
+          system(*TRUECOMMAND, uid: uid, exception: true)
+        rescue Errno::EPERM, Errno::EACCES, NotImplementedError
         end
       end
 
@@ -1888,7 +1888,7 @@ class TestProcess < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L1888
         begin
           u = IO.popen([RUBY, "-e", "print Process.uid", uid: user||uid], &:read)
           assert_equal(uid.to_s, u, feature6975)
-        rescue Errno::EPERM, NotImplementedError
+        rescue Errno::EPERM, Errno::EACCES, NotImplementedError
         end
       end
     end

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

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