diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-07 10:22:20 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-07 10:22:20 +0000 |
commit | af14ba145e5b74e72f508be35cbfab4677659825 (patch) | |
tree | 3d8cbce9031c3a237bd72cd8a028940ea5ffcfad /test | |
parent | 5610e5dc70196d9dc6c884c4f977572b05db67e3 (diff) | |
download | ruby-af14ba145e5b74e72f508be35cbfab4677659825.tar.gz |
test setrlimit in a child process.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_process.rb | 16 |
1 files 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', ''] |