From: Ralf Wildenhues Date: Tue, 10 Mar 2009 22:57:01 +0000 (+0100) Subject: Fix parallel-tests with empty $(TESTS) for BSD make. X-Git-Tag: v1.10b~6^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=67f40eda2c2b460ad42e64f01166f74e015ab604;p=thirdparty%2Fautomake.git 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. Signed-off-by: Ralf Wildenhues --- diff --git a/ChangeLog b/ChangeLog index 395c668a5..38af3a8df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2009-03-10 Ralf Wildenhues + 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. diff --git a/lib/am/check.am b/lib/am/check.am index 9a3c256a2..5a2de7d1a 100644 --- a/lib/am/check.am +++ b/lib/am/check.am @@ -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 diff --git a/tests/Makefile.am b/tests/Makefile.am index 2504941f2..e0b7f235d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 25783568d..1c80daa6d 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -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 index 000000000..59a0b0e80 --- /dev/null +++ b/tests/parallel-tests6.test @@ -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 . + +# 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