bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] getopt: fix parallel test failure


From: Eric Blake
Subject: [PATCH] getopt: fix parallel test failure
Date: Thu, 29 Dec 2016 15:07:24 -0600

I hit a testsuite failure due to a failure removing test-getopt.tmp,
when running tests in parallel.

* tests/test-getopt-posix.c (TEST_GETOPT_TMP_NAME): Set name.
* tests/test-getopt-gnu.c (TEST_GETOPT_TMP_NAME): Likewise.
* tests/test-getopt-main.h (main): Use different file names
in case test-getopt-gnu and test-getopt-posix run in parallel.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog                 | 8 ++++++++
 tests/test-getopt-gnu.c   | 1 +
 tests/test-getopt-main.h  | 4 ++--
 tests/test-getopt-posix.c | 1 +
 4 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 92dda3a..193a962 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2016-12-29  Eric Blake  <address@hidden>
+
+       getopt: fix parallel test failure
+       * tests/test-getopt-posix.c (TEST_GETOPT_TMP_NAME): Set name.
+       * tests/test-getopt-gnu.c (TEST_GETOPT_TMP_NAME): Likewise.
+       * tests/test-getopt-main.h (main): Use different file names
+       in case test-getopt-gnu and test-getopt-posix run in parallel.
+
 2016-12-29  Paul Eggert  <address@hidden>

        xalloc: x2nrealloc check for ptrdiff_t overflow
diff --git a/tests/test-getopt-gnu.c b/tests/test-getopt-gnu.c
index eb0a166..2d9a4bd 100644
--- a/tests/test-getopt-gnu.c
+++ b/tests/test-getopt-gnu.c
@@ -41,4 +41,5 @@ SIGNATURE_CHECK (getopt_long_only, int, (int, char 
*__getopt_argv_const *,
                                          int *));

 #define TEST_GETOPT_GNU 1
+#define TEST_GETOPT_TMP_NAME "test-getopt-gnu.tmp"
 #include "test-getopt-main.h"
diff --git a/tests/test-getopt-main.h b/tests/test-getopt-main.h
index 2c9fa49..aef74f5 100644
--- a/tests/test-getopt-main.h
+++ b/tests/test-getopt-main.h
@@ -48,7 +48,7 @@ main (void)
       || (myerr = fdopen (BACKUP_STDERR_FILENO, "w")) == NULL)
     return 2;

-  ASSERT (freopen ("test-getopt.tmp", "w", stderr) == stderr);
+  ASSERT (freopen (TEST_GETOPT_TMP_NAME, "w", stderr) == stderr);

   /* These default values are required by POSIX.  */
   ASSERT (optind == 1);
@@ -70,7 +70,7 @@ main (void)
 #endif

   ASSERT (fclose (stderr) == 0);
-  ASSERT (remove ("test-getopt.tmp") == 0);
+  ASSERT (remove (TEST_GETOPT_TMP_NAME) == 0);

   return 0;
 }
diff --git a/tests/test-getopt-posix.c b/tests/test-getopt-posix.c
index c89981f..5532271 100644
--- a/tests/test-getopt-posix.c
+++ b/tests/test-getopt-posix.c
@@ -30,4 +30,5 @@
 #include <unistd.h>

 #define TEST_GETOPT_GNU 0
+#define TEST_GETOPT_TMP_NAME "test-getopt-posix.tmp"
 #include "test-getopt-main.h"
-- 
2.9.3




reply via email to

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