ruby-changes:51892
From: normal <ko1@a...>
Date: Mon, 30 Jul 2018 05:29:05 +0900 (JST)
Subject: [ruby-changes:51892] normal:r64105 (trunk): test/ruby/test_process.rb (test_wait_and_sigchld): improve reliability
normal 2018-07-30 05:28:56 +0900 (Mon, 30 Jul 2018) New Revision: 64105 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64105 Log: test/ruby/test_process.rb (test_wait_and_sigchld): improve reliability This should fix CI failure under MJIT, 100ms wait may not be enough for signal handler to fire: http://ci.rvm.jp/results/trunk-mjit@silicon-docker/1169472 Modified files: trunk/test/ruby/test_process.rb Index: test/ruby/test_process.rb =================================================================== --- test/ruby/test_process.rb (revision 64104) +++ test/ruby/test_process.rb (revision 64105) @@ -1588,20 +1588,22 @@ class TestProcess < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L1588 skip "this fails on FreeBSD and OpenBSD on multithreaded environment" end signal_received = [] - Signal.trap(:CHLD) { signal_received << true } - pid = nil - IO.pipe do |r, w| - pid = fork { r.read(1); exit } - Thread.start { - Thread.current.report_on_exception = false - raise - } - w.puts - end - Process.wait pid - 10.times do - break unless signal_received.empty? - sleep 0.01 + IO.pipe do |sig_r, sig_w| + Signal.trap(:CHLD) do + signal_received << true + sig_w.write('?') + end + pid = nil + IO.pipe do |r, w| + pid = fork { r.read(1); exit } + Thread.start { + Thread.current.report_on_exception = false + raise + } + w.puts + end + Process.wait pid + assert sig_r.wait_readable(5), 'self-pipe not readable' end assert_equal [true], signal_received, " [ruby-core:19744]" rescue NotImplementedError, ArgumentError -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/