ruby-changes:10552
From: akr <ko1@a...>
Date: Sat, 7 Feb 2009 19:22:26 +0900 (JST)
Subject: [ruby-changes:10552] Ruby:r22107 (trunk): test setrlimit in a child process.
akr 2009-02-07 19:22:20 +0900 (Sat, 07 Feb 2009) New Revision: 22107 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=22107 Log: test setrlimit in a child process. Modified files: trunk/test/ruby/test_process.rb Index: test/ruby/test_process.rb =================================================================== --- test/ruby/test_process.rb (revision 22106) +++ test/ruby/test_process.rb (revision 22107) @@ -107,8 +107,20 @@ 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', ''] -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/