bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Mark McLoughlin] [PATCH] gnulib/tests: allow test-getaddrinfo to pa


From: Jim Meyering
Subject: Re: [Mark McLoughlin] [PATCH] gnulib/tests: allow test-getaddrinfo to pass when offline
Date: Tue, 27 Jan 2009 19:09:34 +0100

Simon Josefsson <address@hidden> wrote:
> Jim Meyering <address@hidden> writes:
>> Mark McLoughlin noticed that the getaddrinfo test fails
>> when there's no network, and sent the patch below.
>>
>> This looks like a good idea.
>> Though maybe we should make it skip the test (return 77) after saying why:
>>
>>       fprintf (stderr, "skipping getaddrinfo test: no network?\n")
>>
>> If you like it, let me know and I'll take care of it.
>
> Hi.  I'm away on vacation, but it looks good, so please install it.

I've adjusted it as planned.
Here's what I expect to push:

>From 4f9195e68fd2c8563d7d5d9a0d29783641db46cd Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <address@hidden>
Date: Tue, 27 Jan 2009 19:06:31 +0100
Subject: [PATCH] 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.
---
 tests/test-getaddrinfo.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/tests/test-getaddrinfo.c b/tests/test-getaddrinfo.c
index a887cb1..a8b2fd5 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)
--
1.6.1.1.363.g2a3bd




reply via email to

[Prev in Thread] Current Thread [Next in Thread]