svn commit: r256763 - head/share/mk

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


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

Log:
  Add the automatic generation of Kyuafile files.
  
  These files are generated from bsd.test.mk because kyua is able to run
  test programs implemented using different libraries/frameworks.  In
  order to make this possible, this change also extends the various
  *.test.mk file to explicitly indicate the interface of every test
  program.
  
  Submitted by:	Julio Merino jmmv google.com
  MFC after:	2 weeks

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

Modified: head/share/mk/atf.test.mk
==============================================================================
--- head/share/mk/atf.test.mk	Sat Oct 19 06:50:17 2013	(r256762)
+++ head/share/mk/atf.test.mk	Sat Oct 19 06:50:56 2013	(r256763)
@@ -38,31 +38,37 @@ ATFFILE?= auto
 
 .if !empty(ATF_TESTS_C)
 PROGS+= ${ATF_TESTS_C}
+_TESTS+= ${ATF_TESTS_C}
 .for _T in ${ATF_TESTS_C}
 BINDIR.${_T}= ${TESTSDIR}
 MAN.${_T}?= # empty
 SRCS.${_T}?= ${_T}.c
 DPADD.${_T}+= ${LIBATF_C}
 LDADD.${_T}+= -latf-c
+TEST_INTERFACE.${_T}= atf
 .endfor
 .endif
 
 .if !empty(ATF_TESTS_CXX)
 PROGS_CXX+= ${ATF_TESTS_CXX}
 PROGS+= ${ATF_TESTS_CXX}
+_TESTS+= ${ATF_TESTS_CXX}
 .for _T in ${ATF_TESTS_CXX}
 BINDIR.${_T}= ${TESTSDIR}
 MAN.${_T}?= # empty
 SRCS.${_T}?= ${_T}${CXX_SUFFIX:U.cc}
 DPADD.${_T}+= ${LIBATF_CXX} ${LIBATF_C}
 LDADD.${_T}+= -latf-c++ -latf-c
+TEST_INTERFACE.${_T}= atf
 .endfor
 .endif
 
 .if !empty(ATF_TESTS_SH)
 SCRIPTS+= ${ATF_TESTS_SH}
+_TESTS+= ${ATF_TESTS_SH}
 .for _T in ${ATF_TESTS_SH}
 SCRIPTSDIR_${_T}= ${TESTSDIR}
+TEST_INTERFACE.${_T}= atf
 CLEANFILES+= ${_T} ${_T}.tmp
 ATF_TESTS_SH_SRC_${_T}?= ${_T}.sh
 ${_T}: ${ATF_TESTS_SH_SRC_${_T}}

Modified: head/share/mk/bsd.test.mk
==============================================================================
--- head/share/mk/bsd.test.mk	Sat Oct 19 06:50:17 2013	(r256762)
+++ head/share/mk/bsd.test.mk	Sat Oct 19 06:50:56 2013	(r256763)
@@ -33,6 +33,23 @@ TESTSUITE?= FreeBSD
 # SUBDIR for directories that may contain helper binaries and/or data files.
 TESTS_SUBDIRS?=
 
+# Knob to control the handling of the Kyuafile for this Makefile.
+#
+# If 'yes', a Kyuafile exists in the source tree and is installed into
+# TESTSDIR.
+#
+# If 'auto', a Kyuafile is automatically generated based on the list of test
+# programs built by the Makefile and is installed into TESTSDIR.  This is the
+# default and is sufficient in the majority of the cases.
+#
+# If 'no', no Kyuafile is installed.
+KYUAFILE?= auto
+
+# List of all tests being built.  This variable is internal should not be
+# defined by the Makefile.  The various *.test.mk modules extend this variable
+# as needed.
+_TESTS?=
+
 .if !empty(TESTS_SUBDIRS)
 SUBDIR+= ${TESTS_SUBDIRS}
 .endif
@@ -47,6 +64,33 @@ WITHOUT_MAN=yes
 PROG_VARS+= BINDIR
 PROGS_TARGETS+= install
 
+.if ${KYUAFILE:tl} != "no"
+FILES+=	Kyuafile
+FILESDIR_Kyuafile= ${TESTSDIR}
+
+.if ${KYUAFILE:tl} == "auto"
+CLEANFILES+= Kyuafile Kyuafile.tmp
+
+Kyuafile: Makefile
+	@{ \
+	    echo '-- Automatically generated by bsd.test.mk.'; \
+	    echo; \
+	    echo 'syntax(2)'; \
+	    echo; \
+	    echo 'test_suite("${TESTSUITE}")'; \
+            echo; \
+	} >Kyuafile.tmp
+.for _T in ${_TESTS}
+	@echo "${TEST_INTERFACE.${_T}}_test_program{name=\"${_T}\"}" \
+	    >>Kyuafile.tmp
+.endfor
+.for _T in ${TESTS_SUBDIRS:N.WAIT}
+	@echo "include(\"${_T}/Kyuafile\")" >>Kyuafile.tmp
+.endfor
+	@mv Kyuafile.tmp Kyuafile
+.endif
+.endif
+
 beforetest: .PHONY
 .if defined(TESTSDIR)
 .if ${TESTSDIR} == ${TESTSBASE}


More information about the svn-src-all mailing list