Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Nov 2014 00:19:11 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r274074 - head/share/mk
Message-ID:  <201411040019.sA40JBMg014847@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Tue Nov  4 00:19:10 2014
New Revision: 274074
URL: https://svnweb.freebsd.org/changeset/base/274074

Log:
  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".

Added:
  head/share/mk/netbsd-tests.test.mk   (contents, props changed)

Added: head/share/mk/netbsd-tests.test.mk
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/share/mk/netbsd-tests.test.mk	Tue Nov  4 00:19:10 2014	(r274074)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201411040019.sA40JBMg014847>