ruby-changes:46264
From: usa <ko1@a...>
Date: Sun, 16 Apr 2017 11:00:29 +0900 (JST)
Subject: [ruby-changes:46264] usa:r58368 (trunk): * test/ruby/test_io.rb (test_race_closed_stream): separate because it stops
usa 2017-04-16 11:00:24 +0900 (Sun, 16 Apr 2017) New Revision: 58368 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58368 Log: * test/ruby/test_io.rb (test_race_closed_stream): separate because it stops entire test process on Windows. Modified files: trunk/test/ruby/test_io.rb Index: test/ruby/test_io.rb =================================================================== --- test/ruby/test_io.rb (revision 58367) +++ test/ruby/test_io.rb (revision 58368) @@ -3398,27 +3398,30 @@ __END__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_io.rb#L3398 end def test_race_closed_stream - bug13158 = '[ruby-core:79262] [Bug #13158]' - closed = nil - q = Queue.new - IO.pipe do |r, w| - thread = Thread.new do - begin - q << true - while r.gets + assert_separately([], "#{<<-"begin;"}\n#{<<-"end;"}") + begin; + bug13158 = '[ruby-core:79262] [Bug #13158]' + closed = nil + q = Queue.new + IO.pipe do |r, w| + thread = Thread.new do + begin + q << true + while r.gets + end + ensure + closed = r.closed? end - ensure - closed = r.closed? end + q.pop + sleep 0.01 while thread.status != 'sleep' + r.close + assert_raise_with_message(IOError, /stream closed/) do + thread.join + end + assert_equal(true, closed, bug13158 + ': stream should be closed') end - q.pop - sleep 0.01 while thread.status != 'sleep' - r.close - assert_raise_with_message(IOError, /stream closed/) do - thread.join - end - assert_equal(true, closed, "#{bug13158}: stream should be closed") - end + end; end if RUBY_ENGINE == "ruby" # implementation details -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/