Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Aug 2017 03:06:08 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r321901 - projects/make-check-sandbox/share/mk
Message-ID:  <201708020306.v72368xl085367@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Wed Aug  2 03:06:08 2017
New Revision: 321901
URL: https://svnweb.freebsd.org/changeset/base/321901

Log:
  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).

Modified:
  projects/make-check-sandbox/share/mk/suite.test.mk

Modified: projects/make-check-sandbox/share/mk/suite.test.mk
==============================================================================
--- projects/make-check-sandbox/share/mk/suite.test.mk	Wed Aug  2 02:56:48 2017	(r321900)
+++ projects/make-check-sandbox/share/mk/suite.test.mk	Wed Aug  2 03:06:08 2017	(r321901)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708020306.v72368xl085367>