Skip to content

Commit

Permalink
fix conditions to setrlimit
Browse files Browse the repository at this point in the history
* test/ruby/test_io.rb (test_dup_many): limit FD only if possible.

* test/ruby/test_process.rb (assert_fail_too_long_path): fix the
  condition for platform specific feature

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Oct 25, 2015
1 parent 1a98528 commit 7d95b96
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions test/ruby/test_io.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1137,8 +1137,10 @@ def test_dup

def test_dup_many
ruby('-e', <<-'End') {|f|
lim = Process.getrlimit(Process::RLIMIT_NOFILE)[0]
Process.setrlimit(Process::RLIMIT_NOFILE, [lim, 1024].min)
if defined?(Process::RLIMIT_NOFILE)
lim = Process.getrlimit(Process::RLIMIT_NOFILE)[0]
Process.setrlimit(Process::RLIMIT_NOFILE, [lim, 1024].min)
end
ok = 0
a = []
begin
Expand Down
2 changes: 1 addition & 1 deletion test/ruby/test_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1597,7 +1597,7 @@ def assert_fail_too_long_path((cmd, sep), mesg)
exs = [Errno::ENOENT]
exs << Errno::E2BIG if defined?(Errno::E2BIG)
opts = {[STDOUT, STDERR]=>File::NULL}
opts[:rlimit_nproc] = 128 if /mswin|mingw/ =~ RUBY_PLATFORM
opts[:rlimit_nproc] = 128 if defined?(Process::RLIMIT_NPROC)
EnvUtil.suppress_warning do
assert_raise(*exs, mesg) do
begin
Expand Down

0 comments on commit 7d95b96

Please sign in to comment.