[前][次][番号順一覧][スレッド一覧]

ruby-changes:40196

From: nobu <ko1@a...>
Date: Sun, 25 Oct 2015 16:47:28 +0900 (JST)
Subject: [ruby-changes:40196] nobu:r52277 (trunk): fix conditions to setrlimit

nobu	2015-10-25 16:47:16 +0900 (Sun, 25 Oct 2015)

  New Revision: 52277

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52277

  Log:
    fix conditions to setrlimit
    
    * 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

  Modified files:
    trunk/test/ruby/test_io.rb
    trunk/test/ruby/test_process.rb
Index: test/ruby/test_io.rb
===================================================================
--- test/ruby/test_io.rb	(revision 52276)
+++ test/ruby/test_io.rb	(revision 52277)
@@ -1137,8 +1137,10 @@ class TestIO < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_io.rb#L1137
 
   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
Index: test/ruby/test_process.rb
===================================================================
--- test/ruby/test_process.rb	(revision 52276)
+++ test/ruby/test_process.rb	(revision 52277)
@@ -1597,7 +1597,7 @@ class TestProcess < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L1597
     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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]