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

Fix tests which fail with extra stderr output when a Thread dies

* [Feature #14143] [ruby-core:83979].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eregon 2017-12-12 18:44:21 +00:00
parent 2dfbc64fab
commit 6671a826ac
2 changed files with 11 additions and 6 deletions

View file

@ -264,6 +264,7 @@ module TestDigest
assert_nothing_raised { assert_nothing_raised {
t = Thread.start { t = Thread.start {
sleep 0.1 sleep 0.1
Thread.current.report_on_exception = false
Digest::Foo.new Digest::Foo.new
} }
Digest(:Foo).new Digest(:Foo).new

View file

@ -2911,11 +2911,15 @@ __END__
$stdin.reopen(r) $stdin.reopen(r)
r.close r.close
read_thread = Thread.new do read_thread = Thread.new do
begin
$stdin.read(1) $stdin.read(1)
rescue IOError => e
e
end
end end
sleep(0.1) until read_thread.stop? sleep(0.1) until read_thread.stop?
$stdin.close $stdin.close
assert_raise(IOError) {read_thread.join} assert_kind_of(IOError, read_thread.value)
end end
end; end;
end end
@ -3539,8 +3543,10 @@ __END__
thread = Thread.new do thread = Thread.new do
begin begin
q << true q << true
assert_raise_with_message(IOError, /stream closed/) do
while r.gets while r.gets
end end
end
ensure ensure
closed = r.closed? closed = r.closed?
end end
@ -3548,9 +3554,7 @@ __END__
q.pop q.pop
sleep 0.01 until thread.stop? sleep 0.01 until thread.stop?
r.close r.close
assert_raise_with_message(IOError, /stream closed/) do
thread.join thread.join
end
assert_equal(true, closed, bug13158 + ': stream should be closed') assert_equal(true, closed, bug13158 + ': stream should be closed')
end end
end; end;