Fix parallel-tests with empty $(TESTS) for BSD make.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Tue, 10 Mar 2009 22:57:01 +0000 (23:57 +0100)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 14 Mar 2009 09:48:46 +0000 (10:48 +0100)
* lib/am/check.am [PARALLEL_TESTS] ($(TEST_SUITE_LOG)): Ignore
empty line stemming from empty $(TEST_LOGS), to avoid counting
zero tests as one.
(check-TESTS): If `$(TESTS)' is empty, override TEST_LOGS to be
empty, rather than `.log', for BSD make.
* tests/parallel-tests6.test: New test.
* tests/Makefile.am: Update.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
lib/am/check.am
tests/Makefile.am
tests/Makefile.in
tests/parallel-tests6.test [new file with mode: 0755]

index 395c668..38af3a8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2009-03-10  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       Fix parallel-tests with empty $(TESTS) for BSD make.
+       * lib/am/check.am [PARALLEL_TESTS] ($(TEST_SUITE_LOG)): Ignore
+       empty line stemming from empty $(TEST_LOGS), to avoid counting
+       zero tests as one.
+       (check-TESTS): If `$(TESTS)' is empty, override TEST_LOGS to be
+       empty, rather than `.log', for BSD make.
+       * tests/parallel-tests6.test: New test.
+       * tests/Makefile.am: Update.
+
        Mark check-html and check-TESTS as recursive for BSD make.
        * lib/am/check.am [PARALLEL_TESTS] (.MAKE): Add check-TESTS
        and check-html prerequisites.
index 9a3c256..5a2de7d 100644 (file)
@@ -145,7 +145,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
        results=`for f in $$list; do                                    \
                   read line < $$f && echo "$$line" || echo FAIL;       \
                 done`;                                                 \
-       all=`echo "$$results" | wc -l | sed -e 's/^[     ]*//'`;        \
+       all=`echo "$$results" | sed '/^$$/d' | wc -l | sed -e 's/^[      ]*//'`; \
        fail=`echo "$$results" | grep -c '^FAIL'`;                      \
        pass=`echo "$$results" | grep -c '^PASS'`;                      \
        skip=`echo "$$results" | grep -c '^SKIP'`;                      \
@@ -223,7 +223,10 @@ check-TESTS:
            && test -n "$(TEST_SUITE_LOG)$(TEST_LOGS)"; then            \
          rm -f $(TEST_SUITE_LOG) $(TEST_LOGS); \
        fi
-       @$(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG)
+       @set_logs=; if test "X$(TEST_LOGS)" = X.log; then               \
+         set_logs=TEST_LOGS=;                                          \
+       fi;                                                             \
+       $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) $$set_logs
 .MAKE: check-TESTS
 
 
index 2504941..e0b7f23 100644 (file)
@@ -485,6 +485,7 @@ parallel-tests2.test \
 parallel-tests3.test \
 parallel-tests4.test \
 parallel-tests5.test \
+parallel-tests6.test \
 parse.test \
 percent.test \
 percent2.test \
index 2578356..1c80daa 100644 (file)
@@ -711,6 +711,7 @@ parallel-tests2.test \
 parallel-tests3.test \
 parallel-tests4.test \
 parallel-tests5.test \
+parallel-tests6.test \
 parse.test \
 percent.test \
 percent2.test \
@@ -1013,7 +1014,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
        results=`for f in $$list; do                                    \
                   read line < $$f && echo "$$line" || echo FAIL;       \
                 done`;                                                 \
-       all=`echo "$$results" | wc -l | sed -e 's/^[     ]*//'`;        \
+       all=`echo "$$results" | sed '/^$$/d' | wc -l | sed -e 's/^[      ]*//'`; \
        fail=`echo "$$results" | grep -c '^FAIL'`;                      \
        pass=`echo "$$results" | grep -c '^PASS'`;                      \
        skip=`echo "$$results" | grep -c '^SKIP'`;                      \
@@ -1091,7 +1092,10 @@ check-TESTS:
            && test -n "$(TEST_SUITE_LOG)$(TEST_LOGS)"; then            \
          rm -f $(TEST_SUITE_LOG) $(TEST_LOGS); \
        fi
-       @$(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG)
+       @set_logs=; if test "X$(TEST_LOGS)" = X.log; then               \
+         set_logs=TEST_LOGS=;                                          \
+       fi;                                                             \
+       $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) $$set_logs
 
 .log.html:
        @list='$(RST2HTML) $$RST2HTML rst2html rst2html.py';            \
diff --git a/tests/parallel-tests6.test b/tests/parallel-tests6.test
new file mode 100755 (executable)
index 0000000..59a0b0e
--- /dev/null
@@ -0,0 +1,43 @@
+#! /bin/sh
+# Copyright (C) 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
+# the Free Software Foundation; either version 3, 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/>.
+
+# Check parallel-tests features:
+# - empty TESTS
+# BSD make will expand `$(TESTS:=.log)' to `.log' unless overridden.
+
+. ./defs-p || Exit 1
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TESTS =
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+unset TESTS || :
+
+./configure
+$MAKE check >stdout || { cat stdout; Exit 1; }
+cat stdout
+grep '0 tests' stdout
+
+Exit 0