xref: /freebsd/share/mk/netbsd-tests.test.mk (revision 39ee7a7a6bdd1557b1c3532abf60d139798ac88b)
1# $FreeBSD$
2
3.if !target(__netbsd_tests.test.mk__)
4__netbsd_tests.test.mk__:
5
6OBJTOP?=	${.OBJDIR:S/${RELDIR}//}
7
8TESTSRC?=	${SRCTOP}/contrib/netbsd-tests/${RELDIR:H}
9
10.if !exists(${TESTSRC}/)
11.error "Please define TESTSRC to the absolute path of the test sources, e.g. $${SRCTOP}/contrib/netbsd-tests/lib/libc/stdio"
12.endif
13
14.PATH: ${TESTSRC}
15
16LIBNETBSD_SRCDIR=	${SRCTOP}/lib/libnetbsd
17LIBNETBSD_OBJDIR=	${OBJTOP}/lib/libnetbsd
18
19.for t in ${NETBSD_ATF_TESTS_C}
20CFLAGS.$t+=	-I${LIBNETBSD_SRCDIR} -I${SRCTOP}/contrib/netbsd-tests
21LDFLAGS.$t+=	-L${LIBNETBSD_OBJDIR}
22
23DPADD.$t+=	${LIBNETBSD}
24LDADD.$t+=	-lnetbsd
25
26SRCS.$t?=	${t:C/^/t_/:C/_test$//g}.c
27.endfor
28
29ATF_TESTS_C+=	${NETBSD_ATF_TESTS_C}
30
31# A C++ analog isn't provided because there aren't any C++ testcases in
32# contrib/netbsd-tests
33
34.for t in ${NETBSD_ATF_TESTS_SH}
35ATF_TESTS_SH_SRC_$t?=	${t:C/^/t_/:C/_test$//g}.sh
36.endfor
37
38ATF_TESTS_SH+=	${NETBSD_ATF_TESTS_SH}
39
40.endif
41
42# vim: syntax=make
43