mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
merge revision(s) 39417: [Backport #7904]
test_process.rb: fix test * test/ruby/test_process.rb (assert_fail_too_long_path): get rid of syntax error on sh, increase command line size until it exceeds the limit. [Bug #7904] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@39665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
79b2fb0559
commit
fa4e355e57
2 changed files with 17 additions and 7 deletions
|
|
@ -1380,24 +1380,34 @@ class TestProcess < Test::Unit::TestCase
|
|||
|
||||
def test_spawn_too_long_path
|
||||
bug4314 = '[ruby-core:34842]'
|
||||
assert_fail_too_long_path("a", bug4314)
|
||||
assert_fail_too_long_path(%w"echo", bug4314)
|
||||
end
|
||||
|
||||
def test_aspawn_too_long_path
|
||||
bug4315 = '[ruby-core:34833]'
|
||||
assert_fail_too_long_path("a|", bug4315)
|
||||
assert_fail_too_long_path(%w"echo |", bug4315)
|
||||
end
|
||||
|
||||
def assert_fail_too_long_path(cmd, mesg)
|
||||
size = 1_000_000 / cmd.size
|
||||
def assert_fail_too_long_path((cmd, sep), mesg)
|
||||
sep ||= ""
|
||||
min = 1_000 / (cmd.size + sep.size)
|
||||
cmds = Array.new(min, cmd)
|
||||
exs = [Errno::ENOENT]
|
||||
exs << Errno::E2BIG if defined?(Errno::E2BIG)
|
||||
EnvUtil.suppress_warning do
|
||||
assert_raise(*exs, mesg) do
|
||||
begin
|
||||
Process.spawn(cmd * size)
|
||||
loop do
|
||||
Process.spawn(cmds.join(sep), [STDOUT, STDERR]=>:close)
|
||||
min = [cmds.size, min].max
|
||||
cmds *= 100
|
||||
end
|
||||
rescue NoMemoryError
|
||||
raise if (size /= 2) < 250
|
||||
size = cmds.size
|
||||
raise if min >= size - 1
|
||||
min = [min, size /= 2].max
|
||||
cmds[size..-1] = []
|
||||
raise if size < 250
|
||||
retry
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#define RUBY_VERSION "2.0.0"
|
||||
#define RUBY_RELEASE_DATE "2013-03-09"
|
||||
#define RUBY_PATCHLEVEL 34
|
||||
#define RUBY_PATCHLEVEL 35
|
||||
|
||||
#define RUBY_RELEASE_YEAR 2013
|
||||
#define RUBY_RELEASE_MONTH 3
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue