summaryrefslogtreecommitdiff
path: root/build-aux
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2007-08-16 16:28:11 +0200
committerJim Meyering <jim@meyering.net>2007-09-15 08:40:38 +0200
commitc840cd4334c086f5ce4d9144d9fac75643824a38 (patch)
treed189abc0f2395a2b799ed47ebabf0ef54b06b4df /build-aux
parent7a6a30b8a2dea2a1b49d43ee9ab70880a0aa435a (diff)
downloadcoreutils-c840cd4334c086f5ce4d9144d9fac75643824a38.tar.xz
Parallel "make check" support.
* build-aux/check.mk: New file, from The Vaucanson Group. * .x-sc_GPL_version: New file, to allow "version 2 or later" in build-aux/check.mk. * Makefile.am (EXTRA_DIST): Add .x-sc_GPL_version. * tests/check.mk: New file. * tests/Makefile.am (EXTRA_DIST): Add check.mk, mkdtemp and test-lib.sh. Begin factoring "sample-test" out of test scripts. * tests/test-lib.sh: New file, to be sourced by all tests that were previously derived from the "sample-test" template. * tests/mkdtemp: New file. * tests/touch/dir-1: Use test-lib.sh. * tests/touch/empty-file: Likewise. * tests/touch/fail-diag: Likewise. * tests/touch/fifo: Likewise. * tests/touch/no-create-missing: Likewise. * tests/touch/no-rights: Likewise. Also, don't sleep. * tests/touch/not-owner: Likewise. * tests/touch/obsolescent: Likewise. * tests/touch/read-only: Likewise. * tests/touch/relative: Likewise. * tests/touch/Makefile.am: Include $(top_srcdir)/tests/check.mk, to get the parallel-"make check" bits. Move a slow test into tests/misc. * tests/check.mk: Wrapper. * tests/ls/time-1: Move this file to tests/misc/ls-time. * tests/misc/ls-time: New file. From tests/ls/time-1. * tests/ls/Makefile.am (TESTS): Remove time-1. * tests/misc/Makefile.am (TESTS): Add ls-time.
Diffstat (limited to 'build-aux')
-rw-r--r--build-aux/check.mk48
1 files changed, 27 insertions, 21 deletions
diff --git a/build-aux/check.mk b/build-aux/check.mk
index 0674f2376..aee037053 100644
--- a/build-aux/check.mk
+++ b/build-aux/check.mk
@@ -42,7 +42,7 @@ max < length($$0) { \
final= final (final ? "\n" : "") " " $$0; \
max = length($$0); \
} \
-END { \
+END { \
for (i = 0; i < max + 2 ; ++i) \
line = line "="; \
print line; \
@@ -53,10 +53,11 @@ END { \
# If stdout is a tty, use colors. If test -t is not supported, then
# this fails; a conservative approach. Of course do not redirect
# stdout here, just stderr...
-am__tty_colors = \
+am__tty_colors = \
if test -t 1 2>/dev/null; then \
red=''; \
grn=''; \
+ lgn=''; \
blu=''; \
std=''; \
fi
@@ -79,7 +80,7 @@ case $$estatus:" $(XFAIL_TESTS) " in \
0:*" $$(basename $<) "*) col=$$red; res=XPASS;; \
0:*) col=$$grn; res=PASS ;; \
77:*) col=$$blu; res=SKIP ;; \
- *:*" $$(basename $<) "*) col=$$grn; res=XFAIL;; \
+ *:*" $$(basename $<) "*) col=$$lgn; res=XFAIL;; \
*:*) col=$$red; res=FAIL ;; \
esac; \
echo "$${col}$$res$${std}: $$(basename $<)"; \
@@ -109,24 +110,29 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
skip=$$(echo "$$results" | grep -c '^SKIP'); \
xfail=$$(echo "$$results" | grep -c '^XFAIL'); \
xpass=$$(echo "$$results" | grep -c '^XPASS'); \
- case fail=$$fail:xfail=$$xfail:xpass=$$xpass in \
- fail=0:xfail=0:xpass=*) \
- msg="All $$all tests passed. ";; \
- fail=0:xfail=*:xpass=*) \
+ failures=$$(expr $$fail + $$xpass); \
+ case fail=$$fail:xpass=$$xpass:xfail=$$xfail in \
+ fail=0:xpass=0:xfail=0) \
+ msg="All $$all tests passed. "; \
+ exit=true;; \
+ fail=0:xpass=0:xfail=*) \
msg="All $$all tests behaved as expected"; \
- msg="$$msg ($$xfail expected failures). ";; \
- fail=*:xfail=*:xpass=0) \
- msg="$$fail of $$all tests failed. ";; \
- fail=*:xfail=*:xpass=*) \
- msg="$$fail of $$all tests did not behave as expected"; \
- msg="$$msg ($$xpass unexpected passes). ";; \
+ msg="$$msg ($$xfail expected failures). "; \
+ exit=true;; \
+ fail=*:xpass=0:xfail=*) \
+ msg="$$fail of $$all tests failed. "; \
+ exit=false;; \
+ fail=*:xpass=*:xfail=*) \
+ msg="$$failures of $$all tests did not behave as expected"; \
+ msg="$$msg ($$xpass unexpected passes). "; \
+ exit=false;; \
*) \
echo >&2 "incorrect case"; exit 4;; \
esac; \
if test "$$skip" -ne 0; then \
msg="$$msg($$skip tests were not run). "; \
fi; \
- if test "$$fail" -ne 0; then \
+ if test "$$failures" -ne 0; then \
{ \
echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \
$(am__rst_title); \
@@ -149,13 +155,13 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
fi; \
fi; \
$(am__tty_colors); \
- if test "$$fail" -eq 0; then echo $$grn; else echo $$red; fi; \
+ if $$exit; then echo $$grn; else echo $$red; fi; \
echo "$$msg" | $(am__text_box); \
echo $$std; \
- if test x"$$VERBOSE" != x && test "$$fail" -ne 0; then \
- cat $(TEST_SUITE_LOG); \
- fi; \
- test "$$fail" -eq 0
+ test x"$$VERBOSE" = x || $$exit || cat $(TEST_SUITE_LOG); \
+ $$exit
+
+# if test x"$$VERBOSE" != x && ! $exit; then
# Run all the tests.
check-TESTS:
@@ -183,13 +189,13 @@ TEST_SUITE_HTML = $(TEST_SUITE_LOG:.log=.html)
exit 2; \
fi; \
$$R2H $< >$@.tmp
- mv $@.tmp $@
+ @mv $@.tmp $@
# Be sure to run check-TESTS first, and then to convert the result.
# Beware of concurrent executions. And expect check-TESTS to fail.
check-html:
@if $(MAKE) $(AM_MAKEFLAGS) check-TESTS; then :; else \
- rv=$?; \
+ rv=$$?; \
$(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_HTML); \
exit $$rv; \
fi