Skip Menu |
 

This queue is for tickets about the IO-Async CPAN distribution.

Report information
The Basics
Id: 129806
Status: patched
Priority: 0/
Queue: IO-Async

People
Owner: Nobody in particular
Requestors: XENU [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: 51loop-connect.t fails on Windows 10
Download (untitled) / with headers
text/plain 2.4k
It doesn't fail on older Windowses, because they don't support PF_UNIX sockets. I have attached a patch that fixes the issue. It's a bit ugly, I'd rather use cmp_deeply() with any() from Test::Deep, but that would introduce a new dependency. Also, if Socket.pm is older than 2.029, the test will fail even with my patch applied. I think that IO::Async should declare dependency on that version of Socket. C:\Users\xenu\documents\IO-Async-0.73\t>perl -I ..\lib 51loop-connect.t ok 1 - '$future' isa 'Future' ok 2 - IO::Socket::IP->can(...) ok 3 - by addr: $sock->getpeername is $addr from future ok 4 - '$future for ->connect( handle )' isa 'Future' ok 5 - $future->get returns given Stream ok 6 - $stream has a read handle ok 7 - Returned $stream->read_handle->getpeername is $addr ok 8 - IO::Socket::IP->can(...) ok 9 - by addr: $sock->getpeername is $addr ok 10 - '$future' isa 'Future' ok 11 - IO::Socket::IP->can(...) ok 12 - by host/service: $sock->getpeername is $addr from future ok 13 - $sock->sockhost is INADDR_LOOPBACK_HOST from future ok 14 - IO::Socket::IP->can(...) ok 15 - by host/service: $sock->getpeername is $addr ok 16 - $sock->sockhost is INADDR_LOOPBACK_HOST ok 17 - $sock->sockhost is 127.0.0.2 ok 18 - 'on_stream $stream isa IO::Async::Stream' isa 'IO::Async::Stream' ok 19 - on_stream $sock->getpeername is $addr ok 20 - '$future for ->connect( handle socket )' isa 'Future' ok 21 - $future->get returns given Socket ok 22 - Returned $socket->read_handle->getpeername is $addr ok 23 - 'on_socket $sock isa IO::Async::Socket' isa 'IO::Async::Socket' ok 24 - on_socket $sock->read_handle->getpeername is $addr ok 25 - $failop is connect not ok 26 - $failerr is ENOENT # Failed test '$failerr is ENOENT' # at 51loop-connect.t line 265. # got: '116' # expected: '2' ok 27 - $failop is connect not ok 28 - $failerr is ENOENT # Failed test '$failerr is ENOENT' # at 51loop-connect.t line 281. # got: '116' # expected: '2' ok 29 - $future failed ok 30 - $future fail op is connect not ok 31 - $future fail err is ENOENT # Failed test '$future fail err is ENOENT' # at 51loop-connect.t line 285. # got: '116' # expected: '2' ok 32 - $failop is connect ok 33 - $failerr is 'Nie mo┐na nawi╣zaŠ po│╣czenia, poniewa┐ komputer docelowy aktywnie go odmawia.' ok 34 - $error[0] is connect ok 35 - $error[1] is 'Nie mo┐na nawi╣zaŠ po│╣czenia, poniewa┐ komputer docelowy aktywnie go odmawia.' 1..35 # Looks like you failed 3 tests of 35.
Subject: enetdown.patch
Download enetdown.patch
text/x-diff 1.1k
diff --git a/t/51loop-connect.t b/t/51loop-connect.t index 29f6ca8..2e5c857 100644 --- a/t/51loop-connect.t +++ b/t/51loop-connect.t @@ -9,7 +9,7 @@ use Test::More; use Test::Identity; use IO::Socket::INET; -use POSIX qw( ENOENT ); +use POSIX qw( ENOENT ENETDOWN ); use Socket qw( AF_UNIX inet_ntoa ); use IO::Async::Loop; @@ -262,7 +262,7 @@ SKIP: { wait_for { $error }; is( $failop, "connect", '$failop is connect' ); - is( $failerr+0, ENOENT, '$failerr is ENOENT' ); + like( $failerr+0, qr/^${\ENOENT}|${\ENETDOWN}$/, '$failerr is ENOENT' ); } SKIP: { @@ -278,11 +278,11 @@ SKIP: { ); is( $failop, "connect", '$failop is connect' ); - is( $failerr+0, ENOENT, '$failerr is ENOENT' ); + like( $failerr+0, qr/^${\ENOENT}|${\ENETDOWN}$/, '$failerr is ENOENT' ); ok( $future->is_failed, '$future failed' ); is( ( $future->failure )[2], "connect", '$future fail op is connect' ); - is( ( $future->failure )[3]+0, ENOENT, '$future fail err is ENOENT' ); + like( ( $future->failure )[3]+0, qr/^${\ENOENT}|${\ENETDOWN}$/, '$future fail err is ENOENT' ); } # UNIX sockets always connect(2) synchronously, meaning if they fail, the error
Oops, I forgot parens in regexes. The fixed patch is attached.
Subject: enetdown2.patch
Download enetdown2.patch
text/x-diff 1.1k
diff --git a/t/51loop-connect.t b/t/51loop-connect.t index 29f6ca8..fd9485f 100644 --- a/t/51loop-connect.t +++ b/t/51loop-connect.t @@ -9,7 +9,7 @@ use Test::More; use Test::Identity; use IO::Socket::INET; -use POSIX qw( ENOENT ); +use POSIX qw( ENOENT ENETDOWN ); use Socket qw( AF_UNIX inet_ntoa ); use IO::Async::Loop; @@ -262,7 +262,7 @@ SKIP: { wait_for { $error }; is( $failop, "connect", '$failop is connect' ); - is( $failerr+0, ENOENT, '$failerr is ENOENT' ); + like( $failerr+0, qr/^(${\ENOENT}|${\ENETDOWN})$/, '$failerr is ENOENT' ); } SKIP: { @@ -278,11 +278,11 @@ SKIP: { ); is( $failop, "connect", '$failop is connect' ); - is( $failerr+0, ENOENT, '$failerr is ENOENT' ); + like( $failerr+0, qr/^(${\ENOENT}|${\ENETDOWN})$/, '$failerr is ENOENT' ); ok( $future->is_failed, '$future failed' ); is( ( $future->failure )[2], "connect", '$future fail op is connect' ); - is( ( $future->failure )[3]+0, ENOENT, '$future fail err is ENOENT' ); + like( ( $future->failure )[3]+0, qr/^(${\ENOENT}|${\ENETDOWN})$/, '$future fail err is ENOENT' ); } # UNIX sockets always connect(2) synchronously, meaning if they fail, the error
Download (untitled) / with headers
text/plain 235b
Seems reasonable. I was initially a bit hesitant to apply regexps to errno tests, but I can't think of a nicer way to do it that gives good diagnostics if it fails, so we might as well do that. Thanks. Patch applied. -- Paul Evans


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.