mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test setrlimit in a child process.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5610e5dc70
commit
af14ba145e
1 changed files with 14 additions and 2 deletions
|
@ -107,8 +107,20 @@ class TestProcess < Test::Unit::TestCase
|
|||
def test_rlimit_value
|
||||
return unless rlimit_exist?
|
||||
assert_raise(ArgumentError) { Process.setrlimit(:CORE, :FOO) }
|
||||
assert_raise(Errno::EPERM, Errno::EINVAL) { Process.setrlimit(:NOFILE, :INFINITY) }
|
||||
assert_raise(Errno::EPERM, Errno::EINVAL) { Process.setrlimit(:NOFILE, "INFINITY") }
|
||||
with_tmpchdir do
|
||||
s = run_in_child(<<-'End')
|
||||
cur, max = Process.getrlimit(:NOFILE)
|
||||
Process.setrlimit(:NOFILE, max-10)
|
||||
Process.setrlimit(:NOFILE, :INFINITY) rescue exit 1
|
||||
End
|
||||
assert_not_equal(0, s.exitstatus)
|
||||
s = run_in_child(<<-'End')
|
||||
cur, max = Process.getrlimit(:NOFILE)
|
||||
Process.setrlimit(:NOFILE, max-10)
|
||||
Process.setrlimit(:NOFILE, "INFINITY") rescue exit 1
|
||||
End
|
||||
assert_not_equal(0, s.exitstatus)
|
||||
end
|
||||
end
|
||||
|
||||
TRUECOMMAND = [RUBY, '-e', '']
|
||||
|
|
Loading…
Reference in a new issue