1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mame 2018-12-26 05:31:22 +00:00
parent b8d28b33b4
commit 1df30008b2

View file

@ -1871,16 +1871,16 @@ class TestProcess < Test::Unit::TestCase
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
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