[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Automake-NG] [PATCH 6/7] [ng] warns: also report typos for 'LOG_DEPENDE
From: |
Stefano Lattarini |
Subject: |
[Automake-NG] [PATCH 6/7] [ng] warns: also report typos for 'LOG_DEPENDENCIES' variables |
Date: |
Wed, 6 Jun 2012 00:21:06 +0200 |
* lib/am/parallel-tests.am (am__using_parallel_tests): New, set to
"yes" to inform the rest of the makefile that the parallel testsuite
harness is in use.
* lib/am/check-typos.am (.am/vartypos/whitelisted-vars): Whitelist
only 'LOG_DEPENDENCIES' variables that actually correspond to a
declared test extension.
* t/vartypos-deps.sh: New test.
Signed-off-by: Stefano Lattarini <address@hidden>
---
lib/am/check-typos.am | 16 +++++--
lib/am/parallel-tests.am | 3 ++
t/vartypos-deps.sh | 103 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 118 insertions(+), 4 deletions(-)
create mode 100755 t/vartypos-deps.sh
diff --git a/lib/am/check-typos.am b/lib/am/check-typos.am
index 625896e..82e19c9 100644
--- a/lib/am/check-typos.am
+++ b/lib/am/check-typos.am
@@ -35,10 +35,18 @@
TAGS_DEPENDENCIES \
CONFIG_STATUS_DEPENDENCIES \
CONFIGURE_DEPENDENCIES
-# FIXME: Maybe we should only ignore the '*LOG_DEPENDENCIES' variables
-# FIXME: for which an associated test extension is actually defined?
-# FIXME: Or would that be overkill?
-.am/vartypos/whitelisted-vars += LOG_DEPENDENCIES %_LOG_DEPENDENCIES
+
+# The '*LOG_DEPENDENCIES' variables are used to declare extra dependencies
+# for test cases, but only when the parallel testsuite harness is in use.
+ifeq "$(am__using_parallel_tests)" "yes"
+# Extension-less tests are always accepted.
+.am/vartypos/whitelisted-vars += LOG_DEPENDENCIES
+# We expect '.ext' to be a valid tests extension iff 'EXT_LOG_DRIVER' is
+# defined. Hence the following logic.
+.am/vartypos/whitelisted-vars += \
+ $(patsubst %_LOG_DRIVER,%_LOG_DEPENDENCIES, \
+ $(filter %_LOG_DRIVER,$(.VARIABLES)))
+endif
# Canonicalized names of programs and libraries (vanilla or libtool) that
# have been declared.
diff --git a/lib/am/parallel-tests.am b/lib/am/parallel-tests.am
index 819b4e2..b628853 100644
--- a/lib/am/parallel-tests.am
+++ b/lib/am/parallel-tests.am
@@ -25,6 +25,9 @@ include color-tests.am
## of more test metadata, and the use of custom test derivers and protocols
## (among them, TAP).
+## Used by (at least) 'check-typos.am'.
+am__using_parallel_tests := yes
+
am__maybe_invalid_test_extensions = \
$(if \
$(strip $1), \
diff --git a/t/vartypos-deps.sh b/t/vartypos-deps.sh
new file mode 100755
index 0000000..212b29a
--- /dev/null
+++ b/t/vartypos-deps.sh
@@ -0,0 +1,103 @@
+#! /bin/sh
+# Copyright (C) 2010-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/>.
+
+# Make sure we warn about possible variable typos for the
+# *_DEPENDENCIES when we should, and do not warn about them
+# when we should not.
+
+. ./defs || Exit 1
+
+subdirs='ok1 ok2 ko1 ko2'
+mkdir $subdirs
+
+errgrep ()
+{
+ grep "variable '${1}_DEPENDENCIES' is defined" stderr
+ grep "'$1' as canonical name" stderr
+}
+
+cat >> configure.ac <<END
+AC_CONFIG_FILES([$(for d in $subdirs; do echo $d/Makefile; done)])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+AM_LDFLAGS = unused
+ETAGS_ARGS = --unused
+TAGS_DEPENDENCIES = foo.c
+CONFIG_STATUS_DEPENDENCIES = cvs-version.sh
+CONFIGURE_DEPENDENCIES = cvs-version.sh
+foo.c:
+ echo 'int main (void) { return 0; }' > $@
+END
+
+: > cvs-version.sh
+
+cat > ok1/Makefile.am <<'END'
+TESTS = unused ignored.test
+LOG_DEPENDENCIES = unused
+TEST_LOG_DEPENDENCIES = unused
+END
+
+cat > ok2/Makefile.am <<'END'
+TESTS = ignored.sh notseen.tap
+TEST_EXTENSIONS = .sh .tap
+LOG_DEPENDENCIES = unused
+SH_LOG_DEPENDENCIES = unused
+TAP_LOG_DEPENDENCIES = unused
+END
+
+cat > ko1/Makefile.am <<'END'
+LOG_DEPENDENCIES =
+TEST_LOG_DEPENDENCIES =
+END
+
+cat > ko2/Makefile.am <<'END'
+TESTS = unused ignored.test
+TEST_LOG_DEPENDENCIES =
+LOG_DEPENDENCIES =
+SH_LOG_DEPENDENCIES =
+CONFIGSTATUS_DEPENDENCIES =
+CONFIG_DEPENDENCIES =
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+$MAKE
+(cd ok1 && $MAKE)
+(cd ok2 && $MAKE)
+
+cd ko1
+$MAKE 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+errgrep LOG
+errgrep TEST_LOG
+cd ..
+
+cd ko2
+$MAKE 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+errgrep SH_LOG
+errgrep CONFIG
+errgrep CONFIGSTATUS
+$EGREP "'(TEST_)?LOG" stderr && Exit 1
+cd ..
+
+:
--
1.7.9.5
- [Automake-NG] [PATCH 0/7] Move detection of possible typos in _SOURCES etc. at make runtime, Stefano Lattarini, 2012/06/05
- [Automake-NG] [PATCH 2/7] [ng] automake: new global variable '%known_ltlibraries', Stefano Lattarini, 2012/06/05
- [Automake-NG] [PATCH 1/7] [ng] coverage: conditional defn of lib_LIBRARIES and lib_LTLIBRARIES, Stefano Lattarini, 2012/06/05
- [Automake-NG] [PATCH 3/7] [ng] refactor: new make variables am__all_libs and am__all_ltlibs, Stefano Lattarini, 2012/06/05
- [Automake-NG] [PATCH 5/7] [ng] warns: typos in '_DEPENDENCIES' variables are now reported, Stefano Lattarini, 2012/06/05
- [Automake-NG] [PATCH 4/7] [ng] warns: typos in _SOURCES etc. reported at make runtime, Stefano Lattarini, 2012/06/05
- [Automake-NG] [PATCH 6/7] [ng] warns: also report typos for 'LOG_DEPENDENCIES' variables,
Stefano Lattarini <=
- [Automake-NG] [PATCH 7/7] [ng] cleanup: unused variable in the automake script removed, Stefano Lattarini, 2012/06/05
- Re: [Automake-NG] [PATCH 0/7] Move detection of possible typos in _SOURCES etc. at make runtime, Akim Demaille, 2012/06/06
- [Automake-NG] Issues with the testsuite idiom ". ./defs || Exit 1" (was: Re: [PATCH 0/7] Move detection of possible typos in _SOURCES etc. at make runtime), Stefano Lattarini, 2012/06/06
- Re: [Automake-NG] [PATCH 0/7] Move detection of possible typos in _SOURCES etc. at make runtime, Stefano Lattarini, 2012/06/06
- [Automake-NG] [PATCH 1/2] [ng] vartypos: allow user to whitelist false positives, Stefano Lattarini, 2012/06/06
- [Automake-NG] [PATCH 2/2] [ng] vartypos: update news file, Stefano Lattarini, 2012/06/06
- Re: [Automake-NG] [PATCH 2/2] [ng] vartypos: update news file, Akim Demaille, 2012/06/07
- Re: [Automake-NG] [PATCH 2/2] [ng] vartypos: update news file, Stefano Lattarini, 2012/06/07
- Re: [Automake-NG] [PATCH 2/2] [ng] vartypos: update news file, Akim Demaille, 2012/06/07
- [Automake-NG] Automake-NG APIs and backward-compatibility (was: Re: [PATCH 2/2] [ng] vartypos: update news file), Stefano Lattarini, 2012/06/07