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

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
This commit is contained in:
normal 2018-06-30 07:53:31 +00:00
parent fed4ba5948
commit 671c9ef32f

View file

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