summaryrefslogtreecommitdiff
path: root/test/fiber/test_io.rb
diff options
context:
space:
mode:
authorSamuel Williams <samuel.williams@oriontransfer.co.nz>2021-03-30 20:31:19 +1300
committerSamuel Williams <samuel.williams@oriontransfer.co.nz>2021-03-30 23:16:59 +1300
commit611e711085c7e3984555a79626d025c8b876eced (patch)
tree0f65989868c47c58a1b383ebffadfe0066f0cfd5 /test/fiber/test_io.rb
parentb507f65d4461757c577a9f90325967e92a895520 (diff)
downloadruby-611e711085c7e3984555a79626d025c8b876eced.tar.gz
Test incorrect behaviour of `rb_io_wait_readable/writable`.
Diffstat (limited to 'test/fiber/test_io.rb')
-rw-r--r--test/fiber/test_io.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/fiber/test_io.rb b/test/fiber/test_io.rb
index f01cc3af1b..fafda7c310 100644
--- a/test/fiber/test_io.rb
+++ b/test/fiber/test_io.rb
@@ -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