[前][次][番号順一覧][スレッド一覧]

ruby-changes:65710

From: Samuel <ko1@a...>
Date: Tue, 30 Mar 2021 19:17:23 +0900 (JST)
Subject: [ruby-changes:65710] 611e711085 (master): Test incorrect behaviour of `rb_io_wait_readable/writable`.

https://git.ruby-lang.org/ruby.git/commit/?id=611e711085

From 611e711085c7e3984555a79626d025c8b876eced Mon Sep 17 00:00:00 2001
From: Samuel Williams <samuel.williams@o...>
Date: Tue, 30 Mar 2021 20:31:19 +1300
Subject: Test incorrect behaviour of `rb_io_wait_readable/writable`.

---
 test/fiber/test_io.rb | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/test/fiber/test_io.rb b/test/fiber/test_io.rb
index f01cc3a..fafda7c 100644
--- a/test/fiber/test_io.rb
+++ b/test/fiber/test_io.rb
@@ -62,4 +62,39 @@ class TestFiberIO < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/fiber/test_io.rb#L62
       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
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]