Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Jan 2014 18:35:56 +0000 (UTC)
From:      Julio Merino <jmmv@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r260633 - head/share/mk
Message-ID:  <201401141835.s0EIZuRP092205@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jmmv
Date: Tue Jan 14 18:35:56 2014
New Revision: 260633
URL: http://svnweb.freebsd.org/changeset/base/260633

Log:
  Support perl-based TAP-compliant test programs.
  
  Introduce a TAP_TESTS_PERL primitive to list test programs written in perl.
  Only do this in tap.test.mk because I only expect perl-based test programs
  with this interface.
  
  This is very similar to TAP_TESTS_SH but the difference is that we record
  in the Kyuafile that the test program requires a perl interpreter.  This
  in turn makes Kyua mark the test as skipped if the perl package is not yet
  installed, instead of mysteriously failing to run the program.
  
  MFC after:	5 days

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

Modified: head/share/mk/tap.test.mk
==============================================================================
--- head/share/mk/tap.test.mk	Tue Jan 14 18:32:47 2014	(r260632)
+++ head/share/mk/tap.test.mk	Tue Jan 14 18:35:56 2014	(r260633)
@@ -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?201401141835.s0EIZuRP092205>