Discussion:
[PATCH] getopt: fix parallel test failure
(too old to reply)
Eric Blake
2016-12-29 21:07:24 UTC
Permalink
Raw Message
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 <***@redhat.com>
---
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 <***@redhat.com>
+
+ 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 <***@cs.ucla.edu>

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
Jim Meyering
2016-12-30 08:20:30 UTC
Permalink
Raw Message
Post by Eric Blake
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.
Good catch.

Loading...