diff options
author | ngie <ngie@FreeBSD.org> | 2014-11-04 00:19:10 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2014-11-04 00:19:10 +0000 |
commit | 45ca3cac9513a8d0c987137956bdd965a077b441 (patch) | |
tree | 3711d9d8d613c3c6cd05d7d6f2891a1b691b6085 /share | |
parent | fa36aa77787fbeb88d7756e7150c590f8daee614 (diff) | |
download | FreeBSD-src-45ca3cac9513a8d0c987137956bdd965a077b441.zip FreeBSD-src-45ca3cac9513a8d0c987137956bdd965a077b441.tar.gz |
Add Makefile snippet to ease porting NetBSD testcases to FreeBSD from
contrib/netbsd-tests
This Makefile snippet handles polluting testcases with -lnetbsd, specific
headers for ATF version differences, and does necessary rewriting for the
testcases to match the format discussed on the TestSuite wiki page
(t_<foo> -> <foo>_test)
One must define SRCTOP (inspired by projects/bmake), OBJTOP, and TESTSRC
(e.g. contrib/netbsd-tests/lib/libc/gen) to use the Makefile snippet
Test programs are specific either via NETBSD_ATF_TESTS_C or NETBSD_ATF_TESTS_SH
C++ analogs aren't currently implemented.
The imported testcases will be cleaned up to use this Makefile snippet pseudo
"API".
Diffstat (limited to 'share')
-rw-r--r-- | share/mk/netbsd-tests.test.mk | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/share/mk/netbsd-tests.test.mk b/share/mk/netbsd-tests.test.mk new file mode 100644 index 0000000..150f663 --- /dev/null +++ b/share/mk/netbsd-tests.test.mk @@ -0,0 +1,49 @@ +# $FreeBSD$ + +.if !target(__netbsd_tests.test.mk__) +__netbsd_tests.test.mk__: + +.if !defined(OBJTOP) +.error "Please define OBJTOP to the absolute path of the top of the object tree" +.endif + +.if !defined(SRCTOP) +.error "Please define SRCTOP to the absolute path of the top of the source tree" +.endif + +.if !defined(TESTSRC) +.error "Please define TESTSRC to the absolute path of the test sources, e.g. contrib/netbsd-tests/lib/libc/stdio" +.endif + +.PATH: ${TESTSRC} + +LIBNETBSD_SRCDIR= ${SRCTOP}/lib/libnetbsd +LIBNETBSD_OBJDIR= ${OBJTOP}/lib/libnetbsd + +.for t in ${NETBSD_ATF_TESTS_C} +# XXX: needed for atf-c/config.h after v0.2.1 upgrade. See NetBSD PR # +# misc/49356 for more details +CFLAGS.$t+= -I${SRCTOP}/contrib/atf +CFLAGS.$t+= -I${LIBNETBSD_SRCDIR} -I${SRCTOP}/contrib/netbsd-tests +LDFLAGS.$t+= -L${LIBNETBSD_OBJDIR} + +DPADD.$t+= ${LIBNETBSD} +LDADD.$t+= -lnetbsd + +SRCS.$t?= ${t:C/^/t_/:C/_test$//g}.c +.endfor + +ATF_TESTS_C+= ${NETBSD_ATF_TESTS_C} + +# A C++ analog isn't provided because there aren't any C++ testcases in +# contrib/netbsd-tests + +.for t in ${NETBSD_ATF_TESTS_SH} +ATF_TESTS_SH_SRC_$t?= ${t:C/^/t_/:C/_test$//g}.sh +.endfor + +ATF_TESTS_SH+= ${NETBSD_ATF_TESTS_SH} + +.endif + +# vim: syntax=make |