svn commit: r256765 - head/share/mk

Rui Paulo rpaulo at FreeBSD.org
Sat Oct 19 06:52:06 UTC 2013


Author: rpaulo
Date: Sat Oct 19 06:52:06 2013
New Revision: 256765
URL: http://svnweb.freebsd.org/changeset/base/256765

Log:
  Plug kyua into the 'test' target.
  
  If kyua exists in KYUA_PREFIX, the test target is automatically
  defined to use it for the execution of test programs.
  
  Submitted by:	Julio Merino jmmv google.com
  MFC after:	2 weeks

Modified:
  head/share/mk/bsd.test.mk

Modified: head/share/mk/bsd.test.mk
==============================================================================
--- head/share/mk/bsd.test.mk	Sat Oct 19 06:51:34 2013	(r256764)
+++ head/share/mk/bsd.test.mk	Sat Oct 19 06:52:06 2013	(r256765)
@@ -62,6 +62,13 @@ TESTS_ENV+= LD_LIBRARY_PATH=${TESTS_LD_L
 # as needed.
 _TESTS?=
 
+# Path to the prefix of the installed Kyua CLI, if any.
+#
+# If kyua is installed from ports, we automatically define a realtest target
+# below to run the tests using this tool.  The tools are searched for in the
+# hierarchy specified by this variable.
+KYUA_PREFIX?= /usr/local
+
 .if !empty(TESTS_SUBDIRS)
 SUBDIR+= ${TESTS_SUBDIRS}
 .endif
@@ -103,6 +110,32 @@ Kyuafile: Makefile
 .endif
 .endif
 
+KYUA?= ${KYUA_PREFIX}/bin/kyua
+.if exists(${KYUA})
+# Definition of the "make test" target and supporting variables.
+#
+# This target, by necessity, can only work for native builds (i.e. a FreeBSD
+# host building a release for the same system).  The target runs Kyua, which is
+# not in the toolchain, and the tests execute code built for the target host.
+#
+# Due to the dependencies of the binaries built by the source tree and how they
+# are used by tests, it is highly possible for a execution of "make test" to
+# report bogus results unless the new binaries are put in place.
+realtest: .PHONY
+	@echo "*** WARNING: make test is experimental"
+	@echo "***"
+	@echo "*** Using this test does not preclude you from running the tests"
+	@echo "*** installed in ${TESTSBASE}.  This test run may raise false"
+	@echo "*** positives and/or false negatives."
+	@echo
+	@set -e; \
+	${KYUA} test -k ${DESTDIR}${TESTSDIR}/Kyuafile; \
+	result=0; \
+	echo; \
+	echo "*** Once again, note that "make test" is unsupported."; \
+	test $${result} -eq 0
+.endif
+
 beforetest: .PHONY
 .if defined(TESTSDIR)
 .if ${TESTSDIR} == ${TESTSBASE}


More information about the svn-src-head mailing list