1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
normal 2014-10-27 02:33:51 +00:00
parent 512c0364b3
commit bebd27b097
2 changed files with 11 additions and 3 deletions

View file

@ -1,3 +1,8 @@
Mon Oct 27 11:18:32 2014 Eric Wong <e@80x24.org>
* test/ruby/test_process.rb (test_deadlock_by_signal_at_forking):
reduce garbage during forks
Sun Oct 25 12:26:26 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
* template/insns.inc.tmpl, insns_info.inc.tmpl, known_errors.inc.tmpl,

View file

@ -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)