automake-patches
[Top][All Lists]
Advanced

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

[PATCH 1/4] maintainer-check: check consistency of list of test scripts.


From: Stefano Lattarini
Subject: [PATCH 1/4] maintainer-check: check consistency of list of test scripts.
Date: Fri, 11 Dec 2009 14:59:40 +0100
User-agent: KMail/1.12.1 (Linux/2.6.30-2-686; KDE/4.3.2; i686; ; )

This patch add an new maintainer-specific check:
  `maintainer-check-list-of-tests'.

This check verifies that the tests listed in $(TESTS) correspond to the 
test scripts on the filesystem, counting both the "committed" (e.g. 
`aclibobj.test')  and "generated" (e.g. `check-p.test') test scripts.
Note that maintainer-check fails after applying this patch, as some 
test scripts are missing from $(TESTS).  This will be fixed by the next 
patch.
From 0a80b604e09f033d5f7e84d7fbebf9bfb683935c Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Fri, 11 Dec 2009 00:26:32 +0100
Subject: [PATCH 1/4] maintainer-check: check consistency of list of test 
scripts.

* Makefile.am (maintainer-check-list-of-tests): New target.
(maintainer-check): Added dependency from new target
`maintainer-check-list-of-tests'.
* tests/Makefile.am (maintainer-check-list-of-tests): New target,
check for consistency between list of tests defined in the Makefile
and list of tests on the filesystem.
(MOSTLYCLEANFILES): Extended to get rid of temporary files created
by `maintainer-check-list-of-tests'.
---
 ChangeLog         |   12 ++++++++++++
 Makefile.am       |    9 ++++++++-
 Makefile.in       |    7 ++++++-
 tests/Makefile.am |   42 ++++++++++++++++++++++++++++++++++++++++++
 tests/Makefile.in |   36 ++++++++++++++++++++++++++++++++++++
 5 files changed, 104 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3e0f5b4..6b3df00 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2009-12-11  Stefano Lattarini  <address@hidden>
+
+       maintainer-check: check consistency of list of test scripts.
+       * Makefile.am (maintainer-check-list-of-tests): New target.
+       (maintainer-check): Added dependency from new target
+       `maintainer-check-list-of-tests'.
+       * tests/Makefile.am (maintainer-check-list-of-tests): New target,
+       check for consistency between list of tests defined in the Makefile
+       and list of tests on the filesystem.
+       (MOSTLYCLEANFILES): Extended to get rid of temporary files created
+       by `maintainer-check-list-of-tests'.
+
 2009-12-05  Antonio Diaz Diaz  <address@hidden>
 
        Replace unlzma, gunzip, bunzip2 with pack tool -d invocation.
diff --git a/Makefile.am b/Makefile.am
index 0c3f438..545eb4b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -197,7 +197,14 @@ sc_at_in_texi
 
 .PHONY: $(syntax_check_rules)
 $(syntax_check_rules): automake aclocal
-maintainer-check: $(syntax_check_rules)
+
+## Check that the list of tests given in the Makefile is equal to the
+## list of all test scripts in the Automake testsuite.
+.PHONY: maintainer-check-list-of-tests
+maintainer-check-list-of-tests:
+       cd tests && $(MAKE) $@
+
+maintainer-check: $(syntax_check_rules) maintainer-check-list-of-tests
 
 ## This check avoids accidental configure substitutions in the source.
 ## There are exactly 6 lines that should be modified.  This works out
diff --git a/Makefile.in b/Makefile.in
index d038a5c..bba24a6 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -940,7 +940,12 @@ clean-local: clean-coverage
 
 .PHONY: $(syntax_check_rules)
 $(syntax_check_rules): automake aclocal
-maintainer-check: $(syntax_check_rules)
+
+.PHONY: maintainer-check-list-of-tests
+maintainer-check-list-of-tests:
+       cd tests && $(MAKE) $@
+
+maintainer-check: $(syntax_check_rules) maintainer-check-list-of-tests
 
 sc_diff_automake_in_automake:
        @if test `diff $(srcdir)/automake.in automake | wc -l` -ne 22; then \
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8936ff1..fcf5f0e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -752,6 +752,48 @@ $(parallel_tests)
 
 EXTRA_DIST = ChangeLog-old gen-parallel-tests $(TESTS)
 
+## temporary files used in the `check-list-of-tests' target
+tmk = tests-in-makefile-list.tmp
+tfs = tests-on-filesystem-list.tmp
+tdf = diff-in-tests-lists.tmp
+
+MOSTLYCLEANFILES = $(tmk) $(tfs) $(tdf)
+
+# Check that the list of tests given in the Makefile is equal to the
+# list of all test scripts in the Automake testsuite.
+maintainer-check-list-of-tests: $(parallel_tests)
+       @:; \
+        ## prefer unified diffs over plain diffs, for readability
+        if diff -u /dev/null /dev/null >/dev/null 2>&1; then \
+          diff='diff -u'; \
+        else \
+          diff='diff'; \
+        fi; \
+        ## list of tests in Makefile
+        for t in $(TESTS); do \
+          echo "$$t"; \
+        done | sort >$(tmk); \
+        ## list of tests on filesystem
+        glob="$(srcdir)/*.test"; \
+        if test x"$(srcdir)" != x"$(builddir)"; then \
+          glob="$$glob $(builddir)/*.test"; \
+        fi; \
+        for t in $$glob; do \
+          echo "$$t"; \
+        done | sed 's,^.*/,,' | sort >$(tfs); \
+        ## compare the two lists
+        if $$diff $(tmk) $(tfs) >$(tdf); then \
+           e=0; \
+        else \
+           echo '$@: list of tests in Makefile an on filesystem differ' >&2; \
+           echo "+ $$diff in-makefile on-filesystem" >&2; \
+           cat $(tdf) >&2; \
+           e=1; \
+        fi; \
+        rm -f $(tmk) $(tfs) $(tdf); \
+        exit $$e;
+.PHONY: maintainer-check-list-of-tests
+
 # Each test case depends on defs, aclocal, and automake.
 check_SCRIPTS = defs defs-p aclocal-$(APIVERSION) automake-$(APIVERSION)
 
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 248493b..12c39a3 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -992,6 +992,10 @@ yaccvpath.test \
 $(parallel_tests)
 
 EXTRA_DIST = ChangeLog-old gen-parallel-tests $(TESTS)
+tmk = tests-in-makefile-list.tmp
+tfs = tests-on-filesystem-list.tmp
+tdf = diff-in-tests-lists.tmp
+MOSTLYCLEANFILES = $(tmk) $(tfs) $(tdf)
 
 # Each test case depends on defs, aclocal, and automake.
 check_SCRIPTS = defs defs-p aclocal-$(APIVERSION) automake-$(APIVERSION)
@@ -1250,6 +1254,7 @@ install-strip:
          `test -z '$(STRIP)' || \
            echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
+       -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
        -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS)
        -test -z "$(TEST_LOGS_TMP)" || rm -f $(TEST_LOGS_TMP)
        -test -z "$(TEST_SUITE_HTML)" || rm -f $(TEST_SUITE_HTML)
@@ -1357,6 +1362,37 @@ $(parallel_tests): $(parallel_tests:-p.test=.test) 
Makefile.am
 defs-p: defs Makefile.am
        $(AM_V_GEN)sed 's,^AM_INIT_AUTOMAKE$$,&([parallel-tests]),' < defs >$@
 
+# Check that the list of tests given in the Makefile is equal to the
+# list of all test scripts in the Automake testsuite.
+maintainer-check-list-of-tests: $(parallel_tests)
+       @:; \
+        if diff -u /dev/null /dev/null >/dev/null 2>&1; then \
+          diff='diff -u'; \
+        else \
+          diff='diff'; \
+        fi; \
+        for t in $(TESTS); do \
+          echo "$$t"; \
+        done | sort >$(tmk); \
+        glob="$(srcdir)/*.test"; \
+        if test x"$(srcdir)" != x"$(builddir)"; then \
+          glob="$$glob $(builddir)/*.test"; \
+        fi; \
+        for t in $$glob; do \
+          echo "$$t"; \
+        done | sed 's,^.*/,,' | sort >$(tfs); \
+        if $$diff $(tmk) $(tfs) >$(tdf); then \
+           e=0; \
+        else \
+           echo '$@: list of tests in Makefile an on filesystem differ' >&2; \
+           echo "+ $$diff in-makefile on-filesystem" >&2; \
+           cat $(tdf) >&2; \
+           e=1; \
+        fi; \
+        rm -f $(tmk) $(tfs) $(tdf); \
+        exit $$e;
+.PHONY: maintainer-check-list-of-tests
+
 clean-local: clean-local-check
 .PHONY: clean-local-check
 clean-local-check:
-- 
1.6.5


reply via email to

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