[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[FYI] {testsuite-work} testsuite: different test scripts cannot share th
From: |
Stefano Lattarini |
Subject: |
[FYI] {testsuite-work} testsuite: different test scripts cannot share the same basename |
Date: |
Sun, 28 Aug 2011 11:50:40 +0200 |
If two test scripts have the same basename, they will end up
sharing the same log file, leading to all sort of undefined and
undesired behaviours. Add a Makefile check verifying that this
is not the case.
* tests/test-logs-repeated.test: New test, verifying previously
unspecified semantics (in the definition of $(TEST_LOGS) from
$(TESTS)) that we use in our new check.
* tests/Makefile.am (TESTS): Update.
(check-no-repeated-test-name): New .PHONY check.
(check-local): Depend on it.
---
ChangeLog | 14 ++++++++++++
tests/Makefile.am | 16 ++++++++++++++
tests/Makefile.in | 24 ++++++++++++++++++---
tests/test-logs-repeated.test | 45 +++++++++++++++++++++++++++++++++++++++++
4 files changed, 95 insertions(+), 4 deletions(-)
create mode 100644 tests/test-logs-repeated.test
diff --git a/ChangeLog b/ChangeLog
index af6d0d4..8e4e6d7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2011-08-28 Stefano Lattarini <address@hidden>
+
+ testsuite: different test scripts cannot share the same basename
+ If two test scripts have the same basename, they will end up
+ sharing the same log file, leading to all sort of undefined and
+ undesired behaviours. Add a Makefile check verifying that this
+ is not the case.
+ * tests/test-logs-repeated.test: New test, verifying previously
+ unspecified semantics (in the definition of $(TEST_LOGS) from
+ $(TESTS)) that we use in our new check.
+ * tests/Makefile.am (TESTS): Update.
+ (check-no-repeated-test-name): New .PHONY check.
+ (check-local): Depend on it.
+
2011-08-26 Stefano Lattarini <address@hidden>
tests: fix spurious failure for awk implementation of TAP driver
diff --git a/tests/Makefile.am b/tests/Makefile.am
index aee5978..95d9efa 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -770,6 +770,7 @@ test-driver-trs-suffix-registered.test \
test-driver-fail.test \
test-harness-vpath-rewrite.test \
test-log.test \
+test-logs-repeated.test \
test-metadata-global-log.test \
test-metadata-global-result.test \
test-metadata-recheck.test \
@@ -1247,6 +1248,21 @@ tap-summary-color.test
tap-summary.log tap-summary-color.log: tap-summary-aux.sh
EXTRA_DIST += tap-summary-aux.sh
+# If two test scripts have the same basename, they will end up sharing
+# the same log file, leading to all sort of undefined and undesired
+# behaviours.
+check-no-repeated-test-name:
+ @LC_ALL=C; export LC_ALL; \
+ lst='$(TEST_LOGS)'; for log in $$lst; do echo $$log; done \
+ | sort | uniq -c | awk '($$1 > 1) { print }' \
+ | sed 's/\.log$$//' | grep . >&2 \
+ && { \
+ echo $@: test names listed above are duplicated >&2; \
+ exit 1; \
+ }; :
+check-local: check-no-repeated-test-name
+.PHONY: check-no-repeated-test-name
+
## Checking the list of tests.
checked_test_extensions = .test .tap
expected_list_of_tests = $(handwritten_tests)
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 8cf3bc4..0a63b7b 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -1013,6 +1013,7 @@ test-driver-trs-suffix-registered.test \
test-driver-fail.test \
test-harness-vpath-rewrite.test \
test-log.test \
+test-logs-repeated.test \
test-metadata-global-log.test \
test-metadata-global-result.test \
test-metadata-recheck.test \
@@ -1754,7 +1755,7 @@ distdir: $(DISTFILES)
fi; \
done
check-am: all-am
- $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS check-local
check: check-am
all-am: Makefile
installdirs:
@@ -1863,9 +1864,9 @@ uninstall-am:
recheck-html
.PHONY: all all-am am--redo-logs check check-TESTS check-am check-html \
- clean clean-generic clean-local distclean distclean-generic \
- distdir dvi dvi-am html html-am info info-am install \
- install-am install-data install-data-am install-dvi \
+ check-local clean clean-generic clean-local distclean \
+ distclean-generic distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
@@ -1951,6 +1952,21 @@ $(tap_with_common_setup_logs): tap-common-setup.log
tap-setup.sh
tap-summary.log tap-summary-color.log: tap-summary-aux.sh
+# If two test scripts have the same basename, they will end up sharing
+# the same log file, leading to all sort of undefined and undesired
+# behaviours.
+check-no-repeated-test-name:
+ @LC_ALL=C; export LC_ALL; \
+ lst='$(TEST_LOGS)'; for log in $$lst; do echo $$log; done \
+ | sort | uniq -c | awk '($$1 > 1) { print }' \
+ | sed 's/\.log$$//' | grep . >&2 \
+ && { \
+ echo $@: test names listed above are duplicated >&2; \
+ exit 1; \
+ }; :
+check-local: check-no-repeated-test-name
+.PHONY: check-no-repeated-test-name
+
.PHONY: maintainer-check-list-of-tests
maintainer-check-list-of-tests:
@if diff -u /dev/null /dev/null >/dev/null 2>&1; then \
diff --git a/tests/test-logs-repeated.test b/tests/test-logs-repeated.test
new file mode 100644
index 0000000..94dd7c8
--- /dev/null
+++ b/tests/test-logs-repeated.test
@@ -0,0 +1,45 @@
+#! /bin/sh
+# Copyright (C) 2011 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/>.
+
+# Check parallel-tests features:
+# - $(TESTS_LOGS) can end up holding duplicated entries
+# Such behaviour can be useful for projects that want to verify that
+# different test scripts don't end up sharing the same log file.
+# (Automake itself is such a project, BTW ;-)
+
+parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in <<END
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TEST_EXTENSIONS = .sh .test .bar
+TESTS = foo.sh mu.test foo.test foo.bar
+.PHONY: verify
+verify:
+ test "`echo $(TEST_LOGS)`" = 'foo.log mu.log foo.log foo.log'
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+$MAKE verify
+
+:
--
1.7.2.3
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [FYI] {testsuite-work} testsuite: different test scripts cannot share the same basename,
Stefano Lattarini <=