build: make check: use a PATH search instead for Kyua

which(1) accepts both relative/absolute paths as well as lone binary
names.  Set KYUA to kyua and use which(1) to confirm that it can find one;
if it cannot, just advise the user to set KYUA directly to the kyua binary
rather than assuming a relative location from LOCALBASE.

This allows `make check` to be operated with the version of kyua in base
without losing the flexibility of specifying another one.

ngie@ notes that the original intention was to avoid redundant $PATH lookups
and improve the determinism of the target. A future change will likely push
us back to this state, perhaps in the form of reverting this entirely and
just switching to using kyua in base. Accepting any in $PATH should be
considered a transitional move, at least until it's declared otherwise,
since kyua was only semi-recently added to base.

Reviewed-by:	brooks, emaste, lwhsu, ngie
Differential-Revision:	https://reviews.freebsd.org/D28045
This commit is contained in:
Kyle Evans 2021-01-14 00:34:29 -06:00
parent 9a01a25516
commit 986deea5b5

View File

@ -77,7 +77,7 @@ Kyuafile: Makefile
@mv ${.TARGET}.tmp ${.TARGET}
.endif
KYUA= ${LOCALBASE}/bin/kyua
KYUA?= kyua
# Definition of the "make check" target and supporting variables.
#
@ -90,13 +90,13 @@ KYUA= ${LOCALBASE}/bin/kyua
# report bogus results unless the new binaries are put in place.
realcheck: .PHONY
@if [ ! -x ${KYUA} ]; then \
if ! which -s "${KYUA}"; then \
echo; \
echo "kyua binary not installed at expected location (${.TARGET})"; \
echo; \
echo "Please install via pkg install, or specify the path to the kyua"; \
echo "package via the \$${LOCALBASE} variable, e.g. "; \
echo "LOCALBASE=\"${LOCALBASE}\""; \
echo "binary via the \$${KYUA} variable, e.g., "; \
echo "KYUA=\"${LOCALBASE}/bin/kyua\""; \
false; \
fi
@env ${TESTS_ENV:Q} ${KYUA} test -k ${DESTDIR}${TESTSDIR}/Kyuafile