aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_process.rb
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-07-29 20:28:56 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-07-29 20:28:56 +0000
commit5db03b7b5008d63031224462b9fb30f25fb2b584 (patch)
tree904af7c7637a601df5baa0ee72ad67646492f8ac /test/ruby/test_process.rb
parent93d74cffa096811c1c67525745b4db4e7e2f04e5 (diff)
downloadruby-5db03b7b5008d63031224462b9fb30f25fb2b584.tar.gz
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 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_process.rb')
-rw-r--r--test/ruby/test_process.rb30
1 files changed, 16 insertions, 14 deletions
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
index 6a32702b03..5cc49c1a1d 100644
--- a/test/ruby/test_process.rb
+++ b/test/ruby/test_process.rb
@@ -1588,20 +1588,22 @@ class TestProcess < Test::Unit::TestCase
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