+2009-03-11 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ Fix LAZY_TEST_SUITE handling and $(TEST_SUITE_LOG) recreation.
+ * lib/am/check.am (check-TESTS): Expand `$(TEST_LOGS)' only once
+ in the rule command, for systems with low command line limits.
+ Remove $(TEST_SUITE_LOG) even in LAZY_TEST_SUITE mode.
+ ($(TEST_SUITE_LOG)): Always recreate $(TEST_SUITE_LOG). Mention
+ lazy mode in the summary output.
+ * tests/parallel-tests.test: Test LAZY_TEST_SUITE semantics.
+
2009-03-10 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Fix parallel-tests with empty $(TESTS) for BSD make.
msg="$$msg($$skip tests were not run). "; \
fi; \
fi; \
+ { \
+ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \
+ $(am__rst_title); \
+ echo "$$msg"; \
+ echo; \
+ echo ".. contents:: :depth: 2"; \
+ echo; \
+ for f in $$list; do \
+ read line < $$f; \
+ case $$line in \
+ SKIP:*|PASS:*|XFAIL:*);; \
+ *) echo; cat $$f;; \
+ esac; \
+ done; \
+ } >$(TEST_SUITE_LOG).tmp; \
+ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \
+ if test -n '$(LAZY_TEST_SUITE)'; then \
+ msg="$${msg}(tests were rerun lazily). "; \
+ fi; \
if test "$$failures" -ne 0; then \
- { \
- echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \
- $(am__rst_title); \
- echo "$$msg"; \
- echo; \
- echo ".. contents:: :depth: 2"; \
- echo; \
- for f in $$list; do \
- read line < $$f; \
- case $$line in \
- SKIP:*|PASS:*|XFAIL:*);; \
- *) echo; cat $$f;; \
- esac; \
- done; \
- } >$(TEST_SUITE_LOG).tmp; \
- mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \
msg="$${msg}See $(subdir)/$(TEST_SUITE_LOG). "; \
if test -n "$(PACKAGE_BUGREPORT)"; then \
msg="$${msg}Please report to $(PACKAGE_BUGREPORT). "; \
# Run all the tests.
check-TESTS:
- @if test -z '$(LAZY_TEST_SUITE)' \
- && test -n "$(TEST_SUITE_LOG)$(TEST_LOGS)"; then \
- rm -f $(TEST_SUITE_LOG) $(TEST_LOGS); \
+## Expand $(TEST_LOGS) only once, to avoid exceeding line length limits.
+ @list='$(TEST_LOGS)'; if test -z '$(LAZY_TEST_SUITE)' \
+ && test -n "$$list"; then \
+ rm -f $$list; \
fi
+## We always have to remove TEST_SUITE_LOG, to ensure its rule is run
+## in any case even in lazy mode: otherwise, if no test needs rerunning,
+## or a prior run plus reruns all happen within the same timestamp
+## (can happen with a prior `make TESTS=<subset>'),
+## then we get no log output.
+## OTOH, this means that, in the rule for `$(TEST_SUITE_LOG)', we
+## cannot use `$?' to compute the set of lazily rerun tests, lest
+## we rely on .PHONY to work portably.
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
@set_logs=; if test "X$(TEST_LOGS)" = X.log; then \
set_logs=TEST_LOGS=; \
fi; \
msg="$$msg($$skip tests were not run). "; \
fi; \
fi; \
+ { \
+ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \
+ $(am__rst_title); \
+ echo "$$msg"; \
+ echo; \
+ echo ".. contents:: :depth: 2"; \
+ echo; \
+ for f in $$list; do \
+ read line < $$f; \
+ case $$line in \
+ SKIP:*|PASS:*|XFAIL:*);; \
+ *) echo; cat $$f;; \
+ esac; \
+ done; \
+ } >$(TEST_SUITE_LOG).tmp; \
+ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \
+ if test -n '$(LAZY_TEST_SUITE)'; then \
+ msg="$${msg}(tests were rerun lazily). "; \
+ fi; \
if test "$$failures" -ne 0; then \
- { \
- echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \
- $(am__rst_title); \
- echo "$$msg"; \
- echo; \
- echo ".. contents:: :depth: 2"; \
- echo; \
- for f in $$list; do \
- read line < $$f; \
- case $$line in \
- SKIP:*|PASS:*|XFAIL:*);; \
- *) echo; cat $$f;; \
- esac; \
- done; \
- } >$(TEST_SUITE_LOG).tmp; \
- mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \
msg="$${msg}See $(subdir)/$(TEST_SUITE_LOG). "; \
if test -n "$(PACKAGE_BUGREPORT)"; then \
msg="$${msg}Please report to $(PACKAGE_BUGREPORT). "; \
# Run all the tests.
check-TESTS:
- @if test -z '$(LAZY_TEST_SUITE)' \
- && test -n "$(TEST_SUITE_LOG)$(TEST_LOGS)"; then \
- rm -f $(TEST_SUITE_LOG) $(TEST_LOGS); \
+ @list='$(TEST_LOGS)'; if test -z '$(LAZY_TEST_SUITE)' \
+ && test -n "$$list"; then \
+ rm -f $$list; \
fi
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
@set_logs=; if test "X$(TEST_LOGS)" = X.log; then \
set_logs=TEST_LOGS=; \
fi; \
# - TEST_SUITE_LOG
# - dependencies between tests
# - DISABLE_HARD_ERRORS
+# - LAZY_TEST_SUITE
. ./defs-p || Exit 1
test ! -f foo.log
test -f mylog.log
+# Upon a lazy rerun, foo.test should be run, but the others shouldn't.
+# Note that the lazy rerun still exits with a failure, due to the previous
+# test failures.
+# Note that the previous test and this one taken together expose the timing
+# issue that requires the check-TESTS rule to always remove TEST_SUITE_LOG
+# before running the tests lazily.
+env LAZY_TEST_SUITE=yes $MAKE -e check > stdout && { cat stdout; Exit 1; }
+cat stdout
+test -f foo.log
+grep foo.test stdout
+grep bar.test stdout && Exit 1
+grep baz.test stdout && Exit 1
+grep '2.*tests.*failed' stdout
+grep 'lazily' stdout
+
+# Now, explicitly retry with all test logs already updated, and ensure
+# that the summary is still displayed.
+env LAZY_TEST_SUITE=yes $MAKE -e check > stdout && { cat stdout; Exit 1; }
+cat stdout
+grep foo.test stdout && Exit 1
+grep bar.test stdout && Exit 1
+grep baz.test stdout && Exit 1
+grep '2.*tests.*failed' stdout
+
# Test VERBOSE.
env VERBOSE=yes $MAKE -e check > stdout && { cat stdout; Exit 1; }
cat stdout