aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
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)
tree5924e2bc67effa7e7d8b6cb0c6a86ec3d94b6dcb
parentea75327a3c561042b30c5fb79537614d1b6f0089 (diff)
downloadsrc-63c10f414b524687286026e0162c168d4d6f5ffb.tar.gz
src-63c10f414b524687286026e0162c168d4d6f5ffb.zip
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
Notes: svn path=/projects/make-check-sandbox/; revision=321901
-rw-r--r--share/mk/suite.test.mk28
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; \
fi
- @${KYUA} test -k ${CHECKDIR}/Kyuafile
+ @env ${TESTS_ENV:Q} ${KYUA} test -k ${CHECKDIR}/Kyuafile
+
+.ifdef _TESTS_USE_OBJDIR
+DESTDIR= ${.OBJDIR}/checkdir
+CLEANDIRS+= ${CHECKDIR}
+
+# XXX (ngie): use daemon(1) and a pidfile to lock the directory?
+beforecheck:
+ @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
+.endfor
+ @cd ${.CURDIR} && ${MAKE} install \
+ -D_FILESMKDIR \
+ DESTDIR=${DESTDIR}
+
+# 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
+aftercheck:
+ @cd ${.CURDIR} && ${MAKE} clean
+
+.endif