From bebd27b097bb769d05f81b5c1f9ce6cc640da232 Mon Sep 17 00:00:00 2001 From: normal Date: Mon, 27 Oct 2014 02:33:51 +0000 Subject: test/ruby/test_process.rb: reduce garbage during forks * test/ruby/test_process.rb (test_deadlock_by_signal_at_forking): reduce garbage during forks This seems to reduce failures on my memory-constrained VM when doing a full test-all. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_process.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index 0738c50b69..5d252e116b 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -1919,18 +1919,21 @@ EOS end def test_deadlock_by_signal_at_forking + GC.start # reduce garbage + buf = '' ruby = EnvUtil.rubybin er, ew = IO.pipe - unless runner = IO.popen("-") + unless runner = IO.popen("-".freeze) er.close status = true + GC.disable # avoid triggering CoW after forks begin $stderr.reopen($stdout) trap(:QUIT) {} parent = $$ 100.times do |i| pid = fork {Process.kill(:QUIT, parent)} - IO.popen(ruby, 'r+'){} + IO.popen(ruby, 'r+'.freeze){} Process.wait(pid) $stdout.puts $stdout.flush @@ -1948,7 +1951,7 @@ EOS begin loop do runner.wait_readable(5) - runner.read_nonblock(100) + runner.read_nonblock(100, buf) end rescue EOFError => e _, status = Process.wait2(runner.pid) -- cgit v1.2.3