automake-patches
[Top][All Lists]
Advanced

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

[PATCH 10] Fix parallel-tests with empty $(TESTS) for BSD make.


From: Ralf Wildenhues
Subject: [PATCH 10] Fix parallel-tests with empty $(TESTS) for BSD make.
Date: Sat, 14 Mar 2009 11:59:56 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

  TESTS=
  TEST_LOGS=$(TESTS:=.log)

would otherwise barf with an error that the file `.log' could not be
remade.  Since this file name also looks like a single suffix rule,
there is no way to portably write a rule to ignore it.  So in this case
we have to overwrite TESTS.

Cheers,
Ralf

    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.

diff --git a/lib/am/check.am b/lib/am/check.am
index 9a3c256..5a2de7d 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 2504941..e0b7f23 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/parallel-tests6.test b/tests/parallel-tests6.test
new file mode 100755
index 0000000..59a0b0e
--- /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 <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




reply via email to

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