ruby-changes:51572
From: normal <ko1@a...>
Date: Fri, 29 Jun 2018 14:38:55 +0900 (JST)
Subject: [ruby-changes:51572] normal:r63786 (trunk): test_process.rb (test_wait_exception): check assertion sooner
normal 2018-06-29 11:53:11 +0900 (Fri, 29 Jun 2018) New Revision: 63786 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63786 Log: test_process.rb (test_wait_exception): check assertion sooner To diagnose f.puts => EPIPE failures in CI(*). I'm not sure what's wrong and can't reproduce EPIPE even with my slow laptop from 2005. (*) http://ci.rvm.jp/results/trunk_gcc5@silicon-docker/1058203 Modified files: trunk/test/ruby/test_process.rb Index: test/ruby/test_process.rb =================================================================== --- test/ruby/test_process.rb (revision 63785) +++ test/ruby/test_process.rb (revision 63786) @@ -1456,7 +1456,9 @@ class TestProcess < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L1456 def test_wait_exception bug11340 = '[ruby-dev:49176] [Bug #11340]' t0 = t1 = nil - IO.popen([RUBY, '-e', 'puts;STDOUT.flush;Thread.start{gets;exit};sleep(3)'], 'r+') do |f| + sec = 3 + code = "puts;STDOUT.flush;Thread.start{gets;exit};sleep(#{sec})" + IO.popen([RUBY, '-e', code], 'r+') do |f| pid = f.pid f.gets t0 = Time.now @@ -1470,10 +1472,11 @@ class TestProcess < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L1472 th.kill.join end t1 = Time.now + diff = t1 - t0 + assert_operator(diff, :<, sec, + ->{"#{bug11340}: #{diff} seconds to interrupt Process.wait"}) f.puts end - assert_operator(t1 - t0, :<, 3, - ->{"#{bug11340}: #{t1-t0} seconds to interrupt Process.wait"}) end def test_abort -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/