mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
54394b3b71
commit
d93f3bad36
1 changed files with 6 additions and 3 deletions
|
@ -1456,7 +1456,9 @@ class TestProcess < Test::Unit::TestCase
|
||||||
def test_wait_exception
|
def test_wait_exception
|
||||||
bug11340 = '[ruby-dev:49176] [Bug #11340]'
|
bug11340 = '[ruby-dev:49176] [Bug #11340]'
|
||||||
t0 = t1 = nil
|
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
|
pid = f.pid
|
||||||
f.gets
|
f.gets
|
||||||
t0 = Time.now
|
t0 = Time.now
|
||||||
|
@ -1470,10 +1472,11 @@ class TestProcess < Test::Unit::TestCase
|
||||||
th.kill.join
|
th.kill.join
|
||||||
end
|
end
|
||||||
t1 = Time.now
|
t1 = Time.now
|
||||||
|
diff = t1 - t0
|
||||||
|
assert_operator(diff, :<, sec,
|
||||||
|
->{"#{bug11340}: #{diff} seconds to interrupt Process.wait"})
|
||||||
f.puts
|
f.puts
|
||||||
end
|
end
|
||||||
assert_operator(t1 - t0, :<, 3,
|
|
||||||
->{"#{bug11340}: #{t1-t0} seconds to interrupt Process.wait"})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_abort
|
def test_abort
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue