diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-06-30 07:53:31 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-06-30 07:53:31 +0000 |
commit | 671c9ef32fffb78c3c94da49077b39158f254dd1 (patch) | |
tree | 485a2cbce43a1923a5f4243b4733dd4dd4a781dd /test/ruby/test_rubyoptions.rb | |
parent | fed4ba5948c7743c589ea0a70790734b22a5a790 (diff) |
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
Diffstat (limited to 'test/ruby/test_rubyoptions.rb')
-rw-r--r-- | test/ruby/test_rubyoptions.rb | 15 |
1 files changed, 11 insertions, 4 deletions
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 |