[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/3] Maint-check: check consistency of list of test scripts.
From: |
Stefano Lattarini |
Subject: |
[PATCH 1/3] Maint-check: check consistency of list of test scripts. |
Date: |
Sat, 30 Jan 2010 03:46:28 +0100 |
User-agent: |
KMail/1.12.1 (Linux/2.6.30-2-686; KDE/4.3.2; i686; ; ) |
This patch add a 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 the "generated" (e.g. `check-p.test') scripts.
From fc94f686ad128c468430675314a5af29df8baf8d Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Sat, 30 Jan 2010 01:23:44 +0100
Subject: [PATCH 1/3] Maint-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'.
* lib/Automake/tests/Makefile.am: Likewise.
---
ChangeLog | 13 +++++++++++
Makefile.am | 19 ++++++++++++++++-
Makefile.in | 17 ++++++++++++++-
lib/Automake/tests/Makefile.am | 45 +++++++++++++++++++++++++++++++++++++++-
lib/Automake/tests/Makefile.in | 39 +++++++++++++++++++++++++++++++++-
tests/Makefile.am | 42 +++++++++++++++++++++++++++++++++++++
tests/Makefile.in | 36 ++++++++++++++++++++++++++++++++
7 files changed, 207 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index da01f8f..292aff2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2009-01-30 Stefano Lattarini <address@hidden>
+
+ Maint-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'.
+ * lib/Automake/tests/Makefile.am: Likewise.
+
2010-01-24 Ralf Wildenhues <address@hidden>
Fix silent-rules output for disabled dependency tracking.
diff --git a/Makefile.am b/Makefile.am
index 08047d2..8801239 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -198,7 +198,24 @@ 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:
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ for subdir in $(TEST_SUBDIRS); do \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@) || eval $$failcom; \
+ done; \
+ test -z "$$fail"
+
+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 e8fb282..ad1114d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -957,7 +957,22 @@ 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:
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ for subdir in $(TEST_SUBDIRS); do \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@) || eval $$failcom; \
+ done; \
+ test -z "$$fail"
+
+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/lib/Automake/tests/Makefile.am b/lib/Automake/tests/Makefile.am
index b4f09f1..4597b48 100644
--- a/lib/Automake/tests/Makefile.am
+++ b/lib/Automake/tests/Makefile.am
@@ -1,6 +1,7 @@
## Process this file with automake to create Makefile.in
-# Copyright (C) 2002, 2003, 2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2008, 2009, 2010 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
@@ -42,3 +43,45 @@ Version2.pl \
Version3.pl
EXTRA_DIST = $(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:
+ @:; \
+ ## 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)/*.pl"; \
+ if test x"$(srcdir)" != x"$(builddir)"; then \
+ glob="$$glob $(builddir)/*.pl"; \
+ 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
diff --git a/lib/Automake/tests/Makefile.in b/lib/Automake/tests/Makefile.in
index a71bcf1..b1c837f 100644
--- a/lib/Automake/tests/Makefile.in
+++ b/lib/Automake/tests/Makefile.in
@@ -15,7 +15,8 @@
@SET_MAKE@
-# Copyright (C) 2002, 2003, 2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2008, 2009, 2010 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
@@ -270,6 +271,10 @@ Version2.pl \
Version3.pl
EXTRA_DIST = $(TESTS)
+tmk = tests-in-makefile-list.tmp
+tfs = tests-on-filesystem-list.tmp
+tdf = diff-in-tests-lists.tmp
+MOSTLYCLEANFILES = $(tmk) $(tfs) $(tdf)
all: all-am
.SUFFIXES:
@@ -518,6 +523,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)
@@ -613,6 +619,37 @@ uninstall-am:
pdf-am ps ps-am recheck recheck-html uninstall uninstall-am
+# 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:
+ @:; \
+ 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)/*.pl"; \
+ if test x"$(srcdir)" != x"$(builddir)"; then \
+ glob="$$glob $(builddir)/*.pl"; \
+ 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
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ec28566..30bbe20 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -772,6 +772,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 3393f06..301d735 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -1012,6 +1012,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)
@@ -1270,6 +1274,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)
@@ -1377,6 +1382,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