From 4133458deea151c67d0001af9e822c2dbbc04ef0 Mon Sep 17 00:00:00 2001 From: mame Date: Wed, 16 Apr 2008 15:48:54 +0000 Subject: * test/ruby/test_process.rb (test_rlimit_nofile): reset RLIMIT_NOFILE before exit (for gcov). * test/ruby/test_rubyoptions.rb: new tests for option of ruby interpreter, to achieve over 95% test coverage of ruby.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_process.rb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'test/ruby/test_process.rb') diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index 167f21ae44..7ed0029565 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -23,17 +23,21 @@ class TestProcess < Test::Unit::TestCase return unless rlimit_exist? pid = fork { cur_nofile, max_nofile = Process.getrlimit(Process::RLIMIT_NOFILE) + result = 1 begin Process.setrlimit(Process::RLIMIT_NOFILE, 0, max_nofile) rescue Errno::EINVAL - exit 0 + result = 0 end - begin - IO.pipe - rescue Errno::EMFILE - exit 0 + if result == 1 + begin + IO.pipe + rescue Errno::EMFILE + result = 0 + end end - exit 1 + Process.setrlimit(Process::RLIMIT_NOFILE, cur_nofile, max_nofile) + exit result } Process.wait pid assert_equal(0, $?.to_i, "#{$?}") -- cgit v1.2.3