diff options
authorEnji Cooper <ngie@FreeBSD.org>2017-08-02 03:06:08 +0000
committerEnji Cooper <ngie@FreeBSD.org>2017-08-02 03:06:08 +0000
commit63c10f414b524687286026e0162c168d4d6f5ffb (patch)
parentea75327a3c561042b30c5fb79537614d1b6f0089 (diff)
Make "make check" smarter when run from a root directory
If the user decides to specify HAS_TESTS in the upper directory, "make check" will now iterate down the "test" directory, running the tests with an assumably sane default value for $LD_LIBRARY_PATH, $PATH, etc. The purpose of this work is to simplify "make check" -- in particular, to increase dev-test velocity and get me (and others who pay attention, like me) out of the business of paying attention to Jenkins runs and get other developers to (hopefully) test their code more often prior to commit. Huge caveat: Obviously, this will fail miserably when the host can't run the target architecture/code. Necessary compat layer or qemu usermode will be required to make this possible, which is outside the scope of this work (batteries not included).
Notes: svn path=/projects/make-check-sandbox/; revision=321901
1 files changed, 27 insertions, 1 deletions
diff --git a/share/mk/suite.test.mk b/share/mk/suite.test.mk
index 9e7dc9e99ae7..f8ad44a84087 100644
--- a/share/mk/suite.test.mk
+++ b/share/mk/suite.test.mk
@@ -99,4 +99,30 @@ realcheck: .PHONY
echo "LOCALBASE=\"${LOCALBASE}\""; \
false; \
- @${KYUA} test -k ${CHECKDIR}/Kyuafile
+ @env ${TESTS_ENV:Q} ${KYUA} test -k ${CHECKDIR}/Kyuafile
+DESTDIR= ${.OBJDIR}/checkdir
+# XXX (ngie): use daemon(1) and a pidfile to lock the directory?
+ @if [ -d "${DESTDIR}" ]; then \
+ echo "${DESTDIR} already exists"; \
+ echo "Aborting to avoid false positives with potentially" \
+ "parallel instances of '${MAKE} check'"; \
+ false; \
+ fi
+.for t in clean all
+ @cd ${.CURDIR} && ${MAKE} $t
+ @cd ${.CURDIR} && ${MAKE} install \
+# NOTE: this is intentional to ensure that "make check" can be run multiple
+# times. It won't be run if "make check" fails or is interrupted
+ @cd ${.CURDIR} && ${MAKE} clean