Jim Meyering wrote:
> +      if (res == EAI_AGAIN)
> +     {
> +       fprintf (stderr, "skipping getaddrinfo test: no network?\n");
> +       return 77;
> +     }

Actually this does break the test-suite if more than one of the subtests
are skipped (network unavailable - e.g. coreutils koji build). I guess
the easiest way would be to have static variable skip and after skip,
return 0 for any other tests (without doing anything). It should not
break anything - as if the result before skip was 0, it will be 77
(skip), if the result was 1(fail), it will be 78(which is still fail).
Now if all of the getaddr tries (now 4) are skipped, result is 4x77 -
which is not skip.


Attached patch fixes that behaviour.

Greetings,
         Ondrej Vasik
From 4c43f335b5d816b024ed6e6c9fa7190b89968eaa Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= <ova...@redhat.com>
Date: Wed, 25 Feb 2009 15:41:55 +0100
Subject: [PATCH] test-getaddrinfo: fix usage of skip return code 77

* tests/test-gettaddrinfo.c: Return skip code 77 only
  for first occurance of skip (4x77 is not 77)
---
 ChangeLog                |    6 ++++++
 tests/test-getaddrinfo.c |    6 ++++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3c3521a..c0cd271 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-02-25  Ondřej Vašík  <ova...@redhat.com>
+
+	test-getaddrinfo: fix usage of skip return code 77
+	* tests/test-gettaddrinfo.c: Return skip code 77 only
+	  for first occurance of skip (4x77 is not 77)
+
 2009-02-25  Gary V. Vaughan  <g...@gnu.org>
 
 	strtod: avoid C99 decl-after-statement
diff --git a/tests/test-getaddrinfo.c b/tests/test-getaddrinfo.c
index a8b2fd5..5e33bb2 100644
--- a/tests/test-getaddrinfo.c
+++ b/tests/test-getaddrinfo.c
@@ -45,10 +45,15 @@
 int simple (char *host, char *service)
 {
   char buf[BUFSIZ];
+  static int skip = 0;
   struct addrinfo hints;
   struct addrinfo *ai0, *ai;
   int res;
 
+  /* Once we skipped the test, do not try anything else */
+  if (skip)
+    return 0;
+
   dbgprintf ("Finding %s service %s...\n", host, service);
 
   /* This initializes "hints" but does not use it.  Is there a reason
@@ -69,6 +74,7 @@ int simple (char *host, char *service)
 	 in-law's farm. */
       if (res == EAI_AGAIN)
 	{
+	  skip++;
 	  fprintf (stderr, "skipping getaddrinfo test: no network?\n");
 	  return 77;
 	}
-- 
1.5.6.1.156.ge903b

Attachment: signature.asc
Description: Toto je digitálně podepsaná část zprávy

Reply via email to