summaryrefslogtreecommitdiff
path: root/tests/test-getaddrinfo.c
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2009-01-27 19:06:31 +0100
committerJim Meyering <meyering@redhat.com>2009-01-27 21:19:18 +0100
commit283dd26efdfbeeff672cbcb0e6811f54e032364f (patch)
treecd4b17fe23705cd0b62f36a8308444006cdd6098 /tests/test-getaddrinfo.c
parent159eae9ff30acac95b6d397f053df8cd6fca62a3 (diff)
downloadgnulib-283dd26efdfbeeff672cbcb0e6811f54e032364f.tar.gz
test-getaddrinfo: skip (don't fail) this test when there's no network
* tests/test-getaddrinfo.c: Skip test upon failure with EAI_AGAIN, on the presumption that it means you lack network access.
Diffstat (limited to 'tests/test-getaddrinfo.c')
-rw-r--r--tests/test-getaddrinfo.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/test-getaddrinfo.c b/tests/test-getaddrinfo.c
index a887cb1a99..a8b2fd5d46 100644
--- a/tests/test-getaddrinfo.c
+++ b/tests/test-getaddrinfo.c
@@ -1,6 +1,6 @@
/* Test the getaddrinfo module.
- Copyright (C) 2006-2008 Free Software Foundation, Inc.
+ Copyright (C) 2006-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -64,6 +64,14 @@ int simple (char *host, char *service)
if (res != 0)
{
+ /* EAI_AGAIN is returned if no network is available. Don't fail
+ the test merely because someone is down the country on their
+ in-law's farm. */
+ if (res == EAI_AGAIN)
+ {
+ fprintf (stderr, "skipping getaddrinfo test: no network?\n");
+ return 77;
+ }
/* IRIX reports EAI_NONAME for "https". Don't fail the test
merely because of this. */
if (res == EAI_NONAME)