From: Mathieu Bouchard Date: 2002-01-21T06:46:09+09:00 Subject: Re: some more tests On Tue, 4 Dec 2001, Yukihiro Matsumoto wrote: > IO#read should not raise exception for EWOULDBLOCK. Does the > following patch fix the problem? thank you very much. here is some more meat to put in Rubicon. tell me whether the bugs are in my tests or in ruby. 1. nonblocking IO#sysread,#syswrite both seeming to work well 2. nonblocking IO#read/#write, failing 3. unrelated to the two others, a failing test for Module#include. Index: TestIO.rb =================================================================== RCS file: /src/rubicon/builtin/TestIO.rb,v retrieving revision 1.30 diff -u -r1.30 TestIO.rb --- TestIO.rb 2001/11/26 15:13:04 1.30 +++ TestIO.rb 2002/01/20 21:41:42 @@ -989,6 +989,48 @@ assert_equal("**********!!!!!12.3\n", file.gets) end end + + def test_nonblocking_io + require "fcntl" + ws = "qwertyuiopblah!!"*4096 + wscopy = ws.dup + rs = "" + (r,w = IO.pipe).each {|f| f.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK) } + loop do + begin + n = w.syswrite ws + ws[0,n]="" + rescue Errno::EWOULDBLOCK + end + begin + while x=r.sysread(523) do rs<