Subject: | 51loop-connect.t fails on Windows 10 |
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 |
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