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:
akr 2009-02-07 10:22:20 +00:00
Родитель 5610e5dc70
Коммит af14ba145e
1 изменённых файлов: 14 добавлений и 2 удалений

Просмотреть файл

@ -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', '']