Date: Thu, 6 Mar 2014 13:30:36 +0000 (UTC) From: Julio Merino <jmmv@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r262852 - stable/10/share/mk Message-ID: <201403061330.s26DUaO3007879@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jmmv Date: Thu Mar 6 13:30:36 2014 New Revision: 262852 URL: http://svnweb.freebsd.org/changeset/base/262852 Log: MFC a couple of improvements to the test suite mk files. - r260632 Support defining test program metadata from the Makefiles. - r260633 Support perl-based TAP-compliant test programs. Modified: stable/10/share/mk/bsd.test.mk stable/10/share/mk/tap.test.mk Directory Properties: stable/10/ (props changed) Modified: stable/10/share/mk/bsd.test.mk ============================================================================== --- stable/10/share/mk/bsd.test.mk Thu Mar 6 13:25:21 2014 (r262851) +++ stable/10/share/mk/bsd.test.mk Thu Mar 6 13:30:36 2014 (r262852) @@ -41,6 +41,20 @@ TESTS_SUBDIRS?= # If 'no', no Kyuafile is installed. KYUAFILE?= auto +# Per-test program interface definition. +# +# The name provided here must match one of the interface names supported by +# Kyua as this is later encoded in the Kyuafile test program definitions. +#TEST_INTERFACE.<test-program>= interface-name + +# Per-test program metadata properties as a list of key/value pairs. +# +# All the variables for a particular program are appended to the program's +# definition in the Kyuafile. This feature can be used to avoid having to +# explicitly supply a Kyuafile in the source directory, allowing the caller +# Makefile to rely on the KYUAFILE=auto behavior defined here. +#TEST_METADATA.<test-program>+= key="value" + # List of variables to pass to the tests at run-time via the environment. TESTS_ENV?= @@ -102,7 +116,7 @@ Kyuafile.auto: Makefile echo; \ } >Kyuafile.auto.tmp .for _T in ${_TESTS} - @echo "${TEST_INTERFACE.${_T}}_test_program{name=\"${_T}\"}" \ + @echo '${TEST_INTERFACE.${_T}}_test_program{name="${_T}"${TEST_METADATA.${_T}:C/$/,/:tW:C/^/, /W:C/,$//W}}' \ >>Kyuafile.auto.tmp .endfor .for _T in ${TESTS_SUBDIRS:N.WAIT} Modified: stable/10/share/mk/tap.test.mk ============================================================================== --- stable/10/share/mk/tap.test.mk Thu Mar 6 13:25:21 2014 (r262851) +++ stable/10/share/mk/tap.test.mk Thu Mar 6 13:30:36 2014 (r262852) @@ -18,8 +18,12 @@ # manpage. TAP_TESTS_C?= TAP_TESTS_CXX?= +TAP_TESTS_PERL?= TAP_TESTS_SH?= +# Perl interpreter to use for test programs written in this language. +TAP_PERL_INTERPRETER?= /usr/local/bin/perl + .if !empty(TAP_TESTS_C) PROGS+= ${TAP_TESTS_C} _TESTS+= ${TAP_TESTS_C} @@ -42,6 +46,29 @@ TEST_INTERFACE.${_T}= tap .endfor .endif +.if !empty(TAP_TESTS_PERL) +SCRIPTS+= ${TAP_TESTS_PERL} +_TESTS+= ${TAP_TESTS_PERL} +.for _T in ${TAP_TESTS_PERL} +SCRIPTSDIR_${_T}= ${TESTSDIR} +TEST_INTERFACE.${_T}= tap +TEST_METADATA.${_T}+= required_programs="${TAP_PERL_INTERPRETER}" +CLEANFILES+= ${_T} ${_T}.tmp +# TODO(jmmv): It seems to me that this SED and SRC functionality should +# exist in bsd.prog.mk along the support for SCRIPTS. Move it there if +# this proves to be useful within the tests. +TAP_TESTS_PERL_SED_${_T}?= # empty +TAP_TESTS_PERL_SRC_${_T}?= ${_T}.pl +${_T}: ${TAP_TESTS_PERL_SRC_${_T}} + { \ + echo '#! ${TAP_PERL_INTERPRETER}'; \ + cat ${.ALLSRC} | sed ${TAP_TESTS_PERL_SED_${_T}}; \ + } >${.TARGET}.tmp + chmod +x ${.TARGET}.tmp + mv ${.TARGET}.tmp ${.TARGET} +.endfor +.endif + .if !empty(TAP_TESTS_SH) SCRIPTS+= ${TAP_TESTS_SH} _TESTS+= ${TAP_TESTS_SH}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201403061330.s26DUaO3007879>