From 04093f69db5aa7a5af5452eaf78dee1f9bc64b21 Mon Sep 17 00:00:00 2001 From: Ali Polatel Date: Fri, 15 Oct 2010 17:15:34 -0700 Subject: [PATCH] dist/IO: Always bind to localhost in tests. This is necessary on Exherbo, at least, because of the network sandboxing that is done by 'sydbox'. And, in general, tests shouldn't be listening on all interfaces. --- dist/IO/t/io_multihomed.t | 3 ++- dist/IO/t/io_sock.t | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dist/IO/t/io_multihomed.t b/dist/IO/t/io_multihomed.t index f1bd5b9..f2a8e11 100644 --- a/dist/IO/t/io_multihomed.t +++ b/dist/IO/t/io_multihomed.t @@ -74,7 +74,8 @@ package main; use IO::Socket; -$listen = IO::Socket::INET->new(Listen => 2, +$listen = IO::Socket::INET->new(LocalAddr => 'localhost', + Listen => 2, Proto => 'tcp', Timeout => 5, ) or die "$!"; diff --git a/dist/IO/t/io_sock.t b/dist/IO/t/io_sock.t index 38aefee..9c964f0 100644 --- a/dist/IO/t/io_sock.t +++ b/dist/IO/t/io_sock.t @@ -36,7 +36,8 @@ eval { use IO::Socket; -$listen = IO::Socket::INET->new(Listen => 2, +$listen = IO::Socket::INET->new(LocalAddr => 'localhost', + Listen => 2, Proto => 'tcp', # some systems seem to need as much as 10, # so be generous with the timeout @@ -97,7 +98,7 @@ if($pid = fork()) { # Test various other ways to create INET sockets that should # also work. -$listen = IO::Socket::INET->new(Listen => '', Timeout => 15) or die "$!"; +$listen = IO::Socket::INET->new(LocalAddr => 'localhost', Listen => '', Timeout => 15) or die "$!"; $port = $listen->sockport; if($pid = fork()) { @@ -224,7 +225,7 @@ if( !open( SRC, "< $0")) { ### TEST 16 ### Start the server # -my $listen = IO::Socket::INET->new( Listen => 2, Proto => 'tcp', Timeout => 15) || +my $listen = IO::Socket::INET->new(LocalAddr => 'localhost', Listen => 2, Proto => 'tcp', Timeout => 15) || print "not "; print "ok 16\n"; die if( !defined( $listen)); -- 1.8.3.1