summaryrefslogtreecommitdiff
path: root/test/ruby/test_process.rb
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-16 15:48:54 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-16 15:48:54 +0000
commit4133458deea151c67d0001af9e822c2dbbc04ef0 (patch)
tree533fba5b26d0a05780e861984234f796a7a82277 /test/ruby/test_process.rb
parent6cdd421a9b5445512ab554155362d0c979a2a556 (diff)
* 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
Diffstat (limited to 'test/ruby/test_process.rb')
-rw-r--r--test/ruby/test_process.rb16
1 files changed, 10 insertions, 6 deletions
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, "#{$?}")