test-getaddrinfo: skip (don't fail) this test when there's no network
authorMark McLoughlin <markmc@redhat.com>
Tue, 27 Jan 2009 18:06:31 +0000 (19:06 +0100)
committerJim Meyering <meyering@redhat.com>
Tue, 27 Jan 2009 20:19:18 +0000 (21:19 +0100)
* tests/test-getaddrinfo.c: Skip test upon failure with EAI_AGAIN,
on the presumption that it means you lack network access.

ChangeLog
tests/test-getaddrinfo.c

index 3dab71e..3b3a0f0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-01-27  Mark McLoughlin  <markmc@redhat.com>
+
+       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.
+
 2009-01-26  Jim Meyering  <meyering@redhat.com>
 
        fflush: avoid warnings on modern systems
index a887cb1..a8b2fd5 100644 (file)
@@ -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)