From 671c9ef32fffb78c3c94da49077b39158f254dd1 Mon Sep 17 00:00:00 2001 From: normal Date: Sat, 30 Jun 2018 07:53:31 +0000 Subject: test/ruby/test_rubyoptions.rb: improve diagnostics for failures rubyci.org OSX CI instances seem to hang on this, but I'm not sure why... git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_rubyoptions.rb | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb index d67cdcb984..27a24f0764 100644 --- a/test/ruby/test_rubyoptions.rb +++ b/test/ruby/test_rubyoptions.rb @@ -1,6 +1,7 @@ # -*- coding: us-ascii -*- require 'test/unit' +require 'timeout' require 'tmpdir' require 'tempfile' require_relative '../lib/jit_support' @@ -590,14 +591,17 @@ class TestRubyOptions < Test::Unit::TestCase pid = spawn(EnvUtil.rubybin, "test-script") ps = nil + stop = Process.clock_gettime(Process::CLOCK_MONOTONIC) + 30 begin sleep 0.1 ps = `#{PSCMD.join(' ')} #{pid}` break if /hello world/ =~ ps - end until Process.wait(pid, Process::WNOHANG) + now = Process.clock_gettime(Process::CLOCK_MONOTONIC) + end until Process.wait(pid, Process::WNOHANG) || now > stop assert_match(/hello world/, ps) + assert_operator now, :<, stop Process.kill :KILL, pid - Process.wait(pid) + Timeout.timeout(5) { Process.wait(pid) } end end @@ -616,14 +620,17 @@ class TestRubyOptions < Test::Unit::TestCase pid = spawn(EnvUtil.rubybin, "test-script") ps = nil + stop = Process.clock_gettime(Process::CLOCK_MONOTONIC) + 30 begin sleep 0.1 ps = `#{PSCMD.join(' ')} #{pid}` break if /hello world/ =~ ps - end until Process.wait(pid, Process::WNOHANG) + now = Process.clock_gettime(Process::CLOCK_MONOTONIC) + end until Process.wait(pid, Process::WNOHANG) || now > stop assert_match(/hello world/, ps) + assert_operator now, :<, stop Process.kill :KILL, pid - Process.wait(pid) + Timeout.timeout(5) { Process.wait(pid) } end end -- cgit v1.2.3