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).
This commit is contained in:
Enji Cooper 2017-08-02 03:06:08 +00:00
parent ea75327a3c
commit 63c10f414b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/make-check-sandbox/; revision=321901

View File

@ -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