Bug #13491
closedMinGW 58400 - TestSocket_BasicSocket#test_read_write_nonblock
Description
The test TestSocket_BasicSocket#test_read_write_nonblock
was recently add via 58400 / c32fc82.
On a MinGW build, it fails. The following change at line 197 allows a MinGW build to pass.
case r = ssock.read_nonblock(16384, buf, exception: false)
when String
next
when nil
break
else
- flunk "unexpected read_nonblock return: #{r.inspect}"
+ flunk "unexpected read_nonblock return: #{r.inspect}" unless set_nb
end while true
See GitHub PR 1595
Updated by normalperson (Eric Wong) over 7 years ago
Greg.mpls@gmail.com wrote:
The test
TestSocket_BasicSocket#test_read_write_nonblock
was recently add via 58400 / c32fc82.On a MinGW build, it fails. The following change at line 197 allows a MinGW build to pass.
case r = ssock.read_nonblock(16384, buf, exception: false) when String next when nil break else - flunk "unexpected read_nonblock return: #{r.inspect}" + flunk "unexpected read_nonblock return: #{r.inspect}" unless set_nb end while true
Oops, but wouldn't checking for :wait_readable be more correct?
Can you try the following, instead?
diff --git a/test/socket/test_basicsocket.rb b/test/socket/test_basicsocket.rb
index 0b13a7f1af..4d11521e9e 100644
--- a/test/socket/test_basicsocket.rb
+++ b/test/socket/test_basicsocket.rb
@@ -193,6 +193,9 @@ def test_read_write_nonblock
next
when nil
break
-
when :wait_readable
-
IO.select([ssock], nil, nil, 10) or
-
flunk 'socket did not become readable'
else
flunk "unexpected read_nonblock return: #{r.inspect}"
end while true
Thanks.
Updated by normalperson (Eric Wong) over 7 years ago
Can you try r58437? I made it call IO.select on :wait_readable
instead of using your change.
Thanks.
Updated by MSP-Greg (Greg L) over 7 years ago
normalperson (Eric Wong) wrote:
Can you try r58437?
Works. I guess I was staring at the case statement, I should have added the test for :wait_readable
. I tried IO.select
, but I left of the timeout...
Thank you. I'll close the PR and this can be closed.
Updated by usa (Usaku NAKAMURA) over 7 years ago
- Status changed from Open to Closed
I got same error, too.
And it seems that r58437 has fixed it.
I still doubt that there is something wrong with IO#read_nonblock
on Windows, but, about this issue, can be closed.
Updated by normalperson (Eric Wong) over 7 years ago
usa@garbagecollect.jp wrote:
I got same error, too.
And it seems that r58437 has fixed it.
I still doubt that there is something wrong withIO#read_nonblock
on Windows, but, about this issue, can be closed.
Nothing wrong, just different behavior and I was sloppy.
I have encountered similar socket behavior differences before,
even between Linux and *BSD.