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

Log:
  Add the automatic generation of Atffile files.
  
  These are only used by the deprecated atf-run and atf-report tools.
  Generating them is easy and provides a mechanism for people to
  experiment with these tools if they wish.
  
  But, because these tools and files are deprecated, doing this only
  happens if the user has explicitly set ALLOW_DEPRECATED_ATF_TOOLS
  to yes.
  
  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:48:49 2013        (r256761)
+++ head/share/mk/atf.test.mk   Sat Oct 19 06:50:17 2013        (r256762)
@@ -18,6 +18,24 @@ ATF_TESTS_C?=
 ATF_TESTS_CXX?=
 ATF_TESTS_SH?=
 
+# Whether to allow using the deprecated ATF tools or not.
+#
+# If 'yes', this file will generate Atffiles when requested and will also
+# support using the deprecated atf-run tool to execute the tests.
+ALLOW_DEPRECATED_ATF_TOOLS?= no
+
+# Knob to control the handling of the Atffile for this Makefile.
+#
+# If 'yes', an Atffile exists in the source tree and is installed into
+# TESTSDIR.
+#
+# If 'auto', an Atffile 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 Atffile is installed.
+ATFFILE?= auto
+
 .if !empty(ATF_TESTS_C)
 PROGS+= ${ATF_TESTS_C}
 .for _T in ${ATF_TESTS_C}
@@ -55,4 +73,31 @@ ${_T}: ${ATF_TESTS_SH_SRC_${_T}}
 .endfor
 .endif
 
+.if ${ALLOW_DEPRECATED_ATF_TOOLS} != "no"
+
+.if ${ATFFILE:tl} != "no"
+FILES+=        Atffile
+FILESDIR_Atffile= ${TESTSDIR}
+
+.if ${ATFFILE:tl} == "auto"
+CLEANFILES+= Atffile Atffile.tmp
+
+Atffile: Makefile
+       @{ echo 'Content-Type: application/X-atf-atffile; version="1"'; \
+       echo; \
+       echo '# Automatically generated by atf-test.mk.'; \
+       echo; \
+       echo 'prop: test-suite = "'${TESTSUITE}'"'; \
+       echo; \
+       for tp in ${ATF_TESTS_C} ${ATF_TESTS_CXX} ${ATF_TESTS_SH} \
+           ${TESTS_SUBDIRS}; \
+       do \
+           echo "tp: $${tp}"; \
+       done; } >Atffile.tmp
+       @mv Atffile.tmp Atffile
+.endif
+.endif
+
+.endif
+
 .include <bsd.test.mk>

Modified: head/share/mk/bsd.test.mk
==============================================================================
--- head/share/mk/bsd.test.mk   Sat Oct 19 06:48:49 2013        (r256761)
+++ head/share/mk/bsd.test.mk   Sat Oct 19 06:50:17 2013        (r256762)
@@ -20,6 +20,10 @@ TESTSBASE?= /usr/tests
 # Makefiles have to override this to point to a subdirectory of TESTSBASE.
 TESTSDIR?= .
 
+# Name of the test suite these tests belong to.  Should rarely be changed for
+# Makefiles built into the FreeBSD src tree.
+TESTSUITE?= FreeBSD
+
 # List of subdirectories containing tests into which to recurse.  This has the
 # same semantics as SUBDIR at build-time.  However, the directories listed here
 # get registered into the run-time test suite definitions so that the test
@@ -82,6 +86,8 @@ test: aftertest
 
 .if !empty(PROGS) || !empty(PROGS_CXX) || !empty(SCRIPTS)
 .include <bsd.progs.mk>
+.elif !empty(FILES)
+.include <bsd.files.mk>
 .endif
 
 .include <bsd.obj.mk>
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to