]> Savannah Git Hosting - gnulib.git/commitdiff
verify tests: Fix spurious failure with parallel make.
authorBruno Haible <bruno@clisp.org>
Thu, 20 Apr 2017 19:27:40 +0000 (21:27 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 20 Apr 2017 19:29:01 +0000 (21:29 +0200)
* gnulib-tool (func_emit_tests_Makefile_am): Emit initialization of
EXTRA_PROGRAMS.
* tests/test-verify.sh: Build test-verify-try.o, not test-verify.o.
* tests/test-verify-try.c: New file.
* modules/verify-tests (Files): Add it.
(EXTRA_PROGRAMS): Add test-verify-try.
(MOSTLYCLEANFILES): Update accordingly.
Reported by Adam James Stewart <ajstewart@anl.gov>.

ChangeLog
gnulib-tool
modules/verify-tests
tests/test-verify-try.c [new file with mode: 0644]
tests/test-verify.sh

index 5b6283b2ed2c54daed8330c29354ca6055ee0b47..a1ec9ab310496fd528f25b2f53c588e74fbefdc9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2017-04-20  Bruno Haible  <bruno@clisp.org>
+
+       verify tests: Fix spurious failure with parallel make.
+       * gnulib-tool (func_emit_tests_Makefile_am): Emit initialization of
+       EXTRA_PROGRAMS.
+       * tests/test-verify.sh: Build test-verify-try.o, not test-verify.o.
+       * tests/test-verify-try.c: New file.
+       * modules/verify-tests (Files): Add it.
+       (EXTRA_PROGRAMS): Add test-verify-try.
+       (MOSTLYCLEANFILES): Update accordingly.
+       Reported by Adam James Stewart <ajstewart@anl.gov>.
+
 2017-04-18  Bruno Haible  <bruno@clisp.org>
 
        vma-iter: Fix compilation error on Solaris 7.
index b6726452cd0df7443a91fd4dd571a4ffe3c65cbf..d5c290267fb6e6a0e560fdd8c9550558e370dcdf 100755 (executable)
@@ -3883,6 +3883,7 @@ func_emit_tests_Makefile_am ()
   if ! $for_test; then
     echo "check_PROGRAMS ="
   fi
+  echo "EXTRA_PROGRAMS ="
   echo "noinst_HEADERS ="
   echo "noinst_LIBRARIES ="
   if $use_libtests; then
index 803903023ac6ee8f98a2378f6abb8ae781133159..67b0f4ce7b603c480dc102f1887a351f8b57e1e8 100644 (file)
@@ -1,5 +1,6 @@
 Files:
 tests/test-verify.c
+tests/test-verify-try.c
 tests/test-verify.sh
 
 Depends-on:
@@ -11,8 +12,11 @@ Makefile.am:
 TESTS_ENVIRONMENT += MAKE='$(MAKE)'
 TESTS += test-verify test-verify.sh
 check_PROGRAMS += test-verify
+# test-verify-try is never built, but test-verify.sh needs a rule to
+# build test-verify-try.o.
+EXTRA_PROGRAMS += test-verify-try
 
-# This test expects compilation of test-verify.c to fail, and
+# This test expects compilation of test-verify-try.c to fail, and
 # each time it fails, the makefile rule does not perform the usual
 #  "mv -f $name.Tpo $name.po, so tell make clean to remove that file.
-MOSTLYCLEANFILES += .deps/test-verify.Tpo
+MOSTLYCLEANFILES += .deps/test-verify-try.Tpo
diff --git a/tests/test-verify-try.c b/tests/test-verify-try.c
new file mode 100644 (file)
index 0000000..362fb01
--- /dev/null
@@ -0,0 +1,21 @@
+/* Test the "verify" module.
+
+   Copyright (C) 2017 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
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* This is a separate source file, so that the execution of test-verify.sh
+   does not interfere with the building of the 'test-verify' program.  */
+
+#include "test-verify.c"
index 3e7676148af564e6271a6dbb8cc4f75dd4e07a76..1e75d55a26e7824033554a6fcb14bfbb0683fa14 100755 (executable)
@@ -7,8 +7,9 @@ unset MALLOC_PERTURB_
 
 # Rather than figure out how to invoke the compiler with the right
 # include path ourselves, we let make do it:
-(cd "$initial_cwd_" && rm -f test-verify.o \
-    && $MAKE test-verify.o >/dev/null 2>&1) \
+(cd "$initial_cwd_" \
+ && rm -f test-verify-try.o \
+ && $MAKE test-verify-try.o >/dev/null 2>&1) \
   || skip_ "cannot compile error-free"
 
 # Now, prove that we encounter all expected compilation failures:
@@ -16,8 +17,8 @@ unset MALLOC_PERTURB_
 : >err
 for i in 1 2 3 4 5; do
   (cd "$initial_cwd_"
-   rm -f test-verify.o
-   $MAKE CFLAGS=-DEXP_FAIL=$i test-verify.o) >>out 2>>err \
+   rm -f test-verify-try.o
+   $MAKE CFLAGS=-DEXP_FAIL=$i test-verify-try.o) >>out 2>>err \
   && { warn_ "compiler didn't detect verification failure $i"; fail=1; }
 done