[prev in list] [next in list] [prev in thread] [next in thread]
List: perl5-porters
Subject: 5.10.0 fails make test if can't resolve localhost: PATCH
From: David Cantrell <david () cantrell ! org ! uk>
Date: 2009-03-30 20:57:15
Message-ID: 20090330205715.GA29690 () bytemark ! barnyard ! co ! uk
[Download RAW message or body]
If it can't resolve localhost, .../lib/Net/hostent.t fails. This happens
on boxes which otherwise work Just Fine and whose resolvers work Just
Fine if they don't have /etc/hosts.
This patch fixes the test file by making it skip if localhost can't be
resolved and /etc/hosts doesn't exist. Making it portable to other OSes
is left as an exercise for a reader who knows anything about them :-)
and who might like to make it a *little* more robust by, eg, trying to
resolve www.perl.org as well before skipping:
$ diff -u ../lib/Net/hostent.t~ ../lib/Net/hostent.t
--- ../lib/Net/hostent.t~ 2009-03-30 21:47:25.000000000 +0100
+++ ../lib/Net/hostent.t 2009-03-30 21:52:10.000000000 +0100
@@ -33,6 +33,10 @@
use Socket;
my $h = gethost('localhost');
+SKIP: {
+skip "Can't resolve localhost and you don't have /etc/hosts", 6
+ if(!defined($h) && !-e '/etc/hosts');
+
ok(defined $h, "gethost('localhost')") ||
DIE("Can't continue without working gethost: $!");
@@ -89,3 +93,4 @@
print "# " . $h->name . " " . join (",", @{$h->aliases}) . "\n";
}
}
+}
--
David Cantrell | London Perl Mongers Deputy Chief Heretic
When a man is tired of London, he is tired of life
-- Samuel Johnson
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic