summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-28 18:29:41 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-28 18:29:41 +0000
commit8ad98918235c6642be5c6b9b81cb5099616a824a (patch)
tree1677a9877aa17eaa7b9601ea6f13ec8ed9f72388
parent95bfac2e21ea3acb3903d05ff3909028af4a340f (diff)
merge revision(s) 52222,52229,52273,52277,52357: [Backport #11613]
limit the number of FDs in a process for stress test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@52779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--test/ruby/test_io.rb8
-rw-r--r--test/ruby/test_process.rb6
-rw-r--r--version.h2
3 files changed, 12 insertions, 4 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index d0ca5e6e51..96c9ebc1eb 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -1065,7 +1065,9 @@ class TestIO < Test::Unit::TestCase
def ruby(*args)
args = ['-e', '$>.write($<.read)'] if args.empty?
ruby = EnvUtil.rubybin
- f = IO.popen([ruby] + args, 'r+')
+ opts = {}
+ opts[:rlimit_nproc] = 1024 if defined?(Process::RLIMIT_NPROC)
+ f = IO.popen([ruby] + args, 'r+', opts)
pid = f.pid
yield(f)
ensure
@@ -1120,6 +1122,10 @@ class TestIO < Test::Unit::TestCase
def test_dup_many
ruby('-e', <<-'End') {|f|
+ 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
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
index 8847f6b917..471f73442c 100644
--- a/test/ruby/test_process.rb
+++ b/test/ruby/test_process.rb
@@ -1484,7 +1484,7 @@ class TestProcess < Test::Unit::TestCase
end
def test_aspawn_too_long_path
- bug4315 = '[ruby-core:34833]'
+ bug4315 = '[ruby-core:34833] #7904 [ruby-core:52628] #11613'
assert_fail_too_long_path(%w"echo |", bug4315)
end
@@ -1494,11 +1494,13 @@ class TestProcess < Test::Unit::TestCase
cmds = Array.new(min, cmd)
exs = [Errno::ENOENT]
exs << Errno::E2BIG if defined?(Errno::E2BIG)
+ opts = {[STDOUT, STDERR]=>File::NULL}
+ opts[:rlimit_nproc] = 128 if defined?(Process::RLIMIT_NPROC)
EnvUtil.suppress_warning do
assert_raise(*exs, mesg) do
begin
loop do
- Process.spawn(cmds.join(sep), [STDOUT, STDERR]=>File::NULL)
+ Process.spawn(cmds.join(sep), opts)
min = [cmds.size, min].max
cmds *= 100
end
diff --git a/version.h b/version.h
index eafb4555e9..be0140acc2 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.2.4"
#define RUBY_RELEASE_DATE "2015-11-29"
-#define RUBY_PATCHLEVEL 207
+#define RUBY_PATCHLEVEL 208
#define RUBY_RELEASE_YEAR 2015
#define RUBY_RELEASE_MONTH 11