From af14ba145e5b74e72f508be35cbfab4677659825 Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 7 Feb 2009 10:22:20 +0000 Subject: [PATCH] test setrlimit in a child process. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_process.rb | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index 23cb4e6112..9b5559dfa1 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -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', '']