]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
[ng] coverage: parallel-tests and dynamic $(TEST_EXTENSIONS) content
authorStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 22 May 2012 21:22:01 +0000 (23:22 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 23 May 2012 07:55:00 +0000 (09:55 +0200)
The recent changes to the parallel-tests implementation should allow us
to define or override TEST_EXTENSIONS with more dynamic contents; in
particular, something like:

    TEST_EXTENSIONS = $(suffix $(TESTS))

should now work smoothly.

* t/test-extensions-dynamic.sh: New test.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
t/test-extensions-dynamic.sh [new file with mode: 0755]

diff --git a/t/test-extensions-dynamic.sh b/t/test-extensions-dynamic.sh
new file mode 100755 (executable)
index 0000000..e2dbc7d
--- /dev/null
@@ -0,0 +1,94 @@
+#! /bin/sh
+# Copyright (C) 2012 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 2, 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/>.
+
+# TEST_EXTENSIONS with contents dynamically determined at make time
+
+. ./defs || Exit 1
+
+cat >> configure.ac << 'END'
+AC_SUBST([suf], [.tap])
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+END
+
+mkdir sub
+
+cat > Makefile.am << 'END'
+SUBDIRS = sub
+TESTS = foo.sh bar.test baz.t1 mu.t1.t2 zardoz.tap
+TEST_EXTENSIONS = .test @suf@ $(foreach i,1 2,.t$(i))
+TEST_EXTENSIONS += $(subst &,.,$(call am__tolower,&SH))
+END
+
+cat > sub/Makefile.am << 'END'
+TESTS = 1.sh 2.bar 3
+TEST_EXTENSIONS = $(suffix $(TESTS))
+END
+
+cat > foo.sh << 'END'
+#!/bin/sh
+exit 0
+END
+chmod a+x foo.sh
+
+cp foo.sh bar.test
+cp foo.sh baz.t1
+cp foo.sh mu.t1.t2
+cp foo.sh zardoz.tap
+cp foo.sh sub/1.sh
+cp foo.sh sub/2.bar
+cp foo.sh sub/3
+
+do_setup ()
+{
+  $MAKE check ${1+"$@"}
+  ls -l . sub
+}
+
+do_clean ()
+{
+  $MAKE clean
+  test "$(find . -name '*.log')" = ./config.log
+}
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+./configure
+
+do_setup
+test -f foo.log
+test -f bar.log
+test -f baz.log
+test -f mu.t1.log
+test -f zardoz.log
+test -f sub/1.log
+test -f sub/2.log
+test -f sub/3.log
+
+do_clean
+
+do_setup TEST_EXTENSIONS='.sh .t2 $(subst o,e,.tost) ${suf}'
+test -f foo.log
+test -f bar.log
+test -f baz.t1.log
+test -f mu.t1.log
+test -f zardoz.log
+test -f sub/1.log
+test -f sub/2.bar.log
+test -f sub/3.log
+
+: