Module Name:    src
Committed By:   jmmv
Date:           Tue Jul 13 21:11:41 UTC 2010

Modified Files:
        src/share/mk: bsd.test.mk

Log Message:
Implement Atffile automatic generation.

This change adds the ATFFILE variable, which can take the following values:
- yes: The source directory contains a static Atffile to be installed.
- auto: The Atffile is automatically generated.
- no: Do not install any Atffile (replaces the previous NOATFFILE variable).

The ugly bit of this is that I have to add a TESTS_SUBDIRS variable that
lists the subdirectories that contain test cases (so that they can be listed
in the Atffiles, without including auxiliary directories without tests).
This is a subset of SUBDIR.

Addresses a minor part of PR bin/43394.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/share/mk/bsd.test.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/mk/bsd.test.mk
diff -u src/share/mk/bsd.test.mk:1.10 src/share/mk/bsd.test.mk:1.11
--- src/share/mk/bsd.test.mk:1.10	Fri Jun 18 13:14:21 2010
+++ src/share/mk/bsd.test.mk	Tue Jul 13 21:11:41 2010
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.test.mk,v 1.10 2010/06/18 13:14:21 jmmv Exp $
+# $NetBSD: bsd.test.mk,v 1.11 2010/07/13 21:11:41 jmmv Exp $
 #
 
 .include <bsd.init.mk>
@@ -7,6 +7,18 @@
 
 _TESTS=		# empty
 
+.if defined(TESTS_SUBDIRS)
+SUBDIR+=	${TESTS_SUBDIRS}
+
+.  for dir in ${TESTS_SUBDIRS}
+.    if ${dir} != ".WAIT"
+_TESTS:=	${_TESTS} ${dir}
+.    endif
+.  endfor
+.endif
+
+.include <bsd.subdir.mk>
+
 .if defined(TESTS_C)
 PROGS+=		${TESTS_C}
 LDADD+=		-latf-c
@@ -46,9 +58,32 @@
 .  endfor
 .endif
 
-.if !defined(NOATFFILE)
+ATFFILE?=	auto
+
+.if empty(ATFFILE:M[Nn][Oo])
 FILES+=			Atffile
 FILESDIR_Atffile=	${TESTSDIR}
+
+.  if !empty(ATFFILE:M[Aa][Uu][Tt][Oo])
+realall: Atffile
+Atffile: Makefile
+	${_MKTARGET_CREATE}
+	@{ echo 'Content-Type: application/X-atf-atffile; version="1"'; \
+	echo; \
+	echo '# Automatically generated by bsd.test.mk.'; \
+	echo; \
+	echo 'prop: test-suite = "NetBSD"'; \
+	echo; \
+	for tp in ${_TESTS}; do \
+	    echo "tp: $${tp}"; \
+	done; } >Atffile.tmp
+	@mv Atffile.tmp Atffile
+
+clean: clean-atffile
+clean-atffile: .PHONY
+	rm -f Atffile Atffile.tmp
+.  endif
+
 .include <bsd.files.mk>
 .endif
 

Reply via email to