mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Test incorrect behaviour of rb_io_wait_readable/writable
.
This commit is contained in:
parent
b507f65d44
commit
611e711085
Notes:
git
2021-03-30 19:17:26 +09:00
1 changed files with 35 additions and 0 deletions
|
@ -62,4 +62,39 @@ class TestFiberIO < Test::Unit::TestCase
|
|||
end
|
||||
end.each(&:join)
|
||||
end
|
||||
|
||||
def test_epipe_on_read
|
||||
skip "UNIXSocket is not defined!" unless defined?(UNIXSocket)
|
||||
|
||||
i, o = UNIXSocket.pair
|
||||
|
||||
unless i.nonblock? && o.nonblock?
|
||||
i.close
|
||||
o.close
|
||||
skip "I/O is not non-blocking!"
|
||||
end
|
||||
|
||||
error = nil
|
||||
|
||||
thread = Thread.new do
|
||||
scheduler = Scheduler.new
|
||||
Fiber.set_scheduler scheduler
|
||||
|
||||
Fiber.schedule do
|
||||
begin
|
||||
i.close
|
||||
o.write(MESSAGE)
|
||||
rescue => error
|
||||
# Saved into error.
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
thread.join
|
||||
|
||||
i.close
|
||||
o.close
|
||||
|
||||
assert_kind_of Errno::EPIPE, error
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue