[Midnightbsd-cvs] src [7538] trunk/share/mk: add test harness
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Thu Apr 14 21:37:44 EDT 2016
Revision: 7538
http://svnweb.midnightbsd.org/src/?rev=7538
Author: laffer1
Date: 2016-04-14 21:37:43 -0400 (Thu, 14 Apr 2016)
Log Message:
-----------
add test harness
Modified Paths:
--------------
trunk/share/mk/Makefile
trunk/share/mk/bsd.own.mk
Added Paths:
-----------
trunk/share/mk/atf.test.mk
trunk/share/mk/bsd.progs.mk
trunk/share/mk/bsd.test.mk
trunk/share/mk/netbsd-tests.test.mk
trunk/share/mk/plain.test.mk
trunk/share/mk/suite.test.mk
trunk/share/mk/tap.test.mk
Modified: trunk/share/mk/Makefile
===================================================================
--- trunk/share/mk/Makefile 2016-04-15 01:21:52 UTC (rev 7537)
+++ trunk/share/mk/Makefile 2016-04-15 01:37:43 UTC (rev 7538)
@@ -2,20 +2,61 @@
# $MidnightBSD$
# @(#)Makefile 8.1 (Berkeley) 6/8/93
-FILES= bsd.README
-FILES+= bsd.arch.inc.mk
-FILES+= bsd.compat.mk bsd.compiler.mk bsd.cpu.mk
-FILES+= bsd.dep.mk bsd.doc.mk bsd.dtrace.mk
-FILES+= bsd.endian.mk
-FILES+= bsd.files.mk bsd.crunchgen.mk bsd.incs.mk bsd.info.mk bsd.init.mk
-FILES+= bsd.kmod.mk
-FILES+= bsd.lib.mk bsd.libnames.mk bsd.links.mk bsd.man.mk bsd.nls.mk
-FILES+= bsd.obj.mk bsd.own.mk
-FILES+= bsd.port.mk bsd.mport.options.mk bsd.port.post.mk
-FILES+= bsd.port.pre.mk bsd.port.subdir.mk bsd.prog.mk
-FILES+= bsd.snmpmod.mk bsd.subdir.mk bsd.sys.mk bsd.symver.mk
-FILES+= sys.mk version_gen.awk
+# Only parse this if executing make in this directory, not in other places
+# in src that lack a Makefile, such as sys/dev/*. Otherwise the MAKESYSPATH
+# will read this Makefile since it auto includes it into -I.
+# Note that this guard only works for bmake.
+.if !defined(.PARSEDIR) || ${.CURDIR} == ${.PARSEDIR}
+
+.include <bsd.own.mk>
+
+FILES= \
+ bsd.README \
+ bsd.arch.inc.mk \
+ bsd.compat.mk \
+ bsd.compiler.mk \
+ bsd.cpu.mk \
+ bsd.crunchgen.mk \
+ bsd.dep.mk \
+ bsd.doc.mk \
+ bsd.dtrace.mk \
+ bsd.endian.mk \
+ bsd.files.mk \
+ bsd.incs.mk \
+ bsd.info.mk \
+ bsd.init.mk \
+ bsd.kmod.mk \
+ bsd.lib.mk \
+ bsd.libnames.mk \
+ bsd.links.mk \
+ bsd.man.mk \
+ bsd.nls.mk \
+ bsd.obj.mk \
+ bsd.own.mk \
+ bsd.port.mk \
+ bsd.mport.options.mk \
+ bsd.port.post.mk \
+ bsd.port.pre.mk \
+ bsd.port.subdir.mk \
+ bsd.prog.mk \
+ bsd.progs.mk \
+ bsd.snmpmod.mk \
+ bsd.subdir.mk \
+ bsd.symver.mk \
+ bsd.sys.mk \
+ bsd.test.mk \
+ sys.mk \
+ version_gen.awk
+
NO_OBJ=
FILESDIR= ${BINDIR}/mk
+.if ${MK_TESTS} != "no"
+FILES+= atf.test.mk
+FILES+= plain.test.mk
+FILES+= suite.test.mk
+FILES+= tap.test.mk
+.endif
+
.include <bsd.prog.mk>
+.endif # CURDIR == PARSEDIR
Added: trunk/share/mk/atf.test.mk
===================================================================
--- trunk/share/mk/atf.test.mk (rev 0)
+++ trunk/share/mk/atf.test.mk 2016-04-15 01:37:43 UTC (rev 7538)
@@ -0,0 +1,100 @@
+# $MidnightBSD$
+# $FreeBSD: stable/10/share/mk/atf.test.mk 289953 2015-10-25 22:23:04Z ngie $
+#
+# You must include bsd.test.mk instead of this file from your Makefile.
+#
+# Logic to build and install ATF test programs; i.e. test programs linked
+# against the ATF libraries.
+
+.if !target(__<bsd.test.mk>__)
+.error atf.test.mk cannot be included directly.
+.endif
+
+# List of C, C++ and shell test programs to build.
+#
+# Programs listed here are built using PROGS, PROGS_CXX and SCRIPTS,
+# respectively, from bsd.prog.mk. However, the build rules are tweaked to
+# require the ATF libraries.
+#
+# Test programs registered in this manner are set to be installed into TESTSDIR
+# (which should be overriden by the Makefile) and are not required to provide a
+# manpage.
+ATF_TESTS_C?=
+ATF_TESTS_CXX?=
+ATF_TESTS_SH?=
+
+# Path to the prefix of the installed ATF tools, if any.
+#
+# If atf-run and atf-report are installed from ports, we automatically define a
+# realregress target below to run the tests using these tools. The tools are
+# searched for in the hierarchy specified by this variable.
+ATF_PREFIX?= /usr/local
+
+# C compiler passed to ATF tests that need to build code.
+ATF_BUILD_CC?= ${DESTDIR}/usr/bin/cc
+TESTS_ENV+= ATF_BUILD_CC=${ATF_BUILD_CC}
+
+# C preprocessor passed to ATF tests that need to build code.
+ATF_BUILD_CPP?= ${DESTDIR}/usr/bin/cpp
+TESTS_ENV+= ATF_BUILD_CPP=${ATF_BUILD_CPP}
+
+# C++ compiler passed to ATF tests that need to build code.
+ATF_BUILD_CXX?= ${DESTDIR}/usr/bin/c++
+TESTS_ENV+= ATF_BUILD_CXX=${ATF_BUILD_CXX}
+
+# Shell interpreter used to run atf-sh(1) based tests.
+ATF_SHELL?= ${DESTDIR}/bin/sh
+TESTS_ENV+= ATF_SHELL=${ATF_SHELL}
+
+.if !empty(ATF_TESTS_C)
+PROGS+= ${ATF_TESTS_C}
+_TESTS+= ${ATF_TESTS_C}
+.for _T in ${ATF_TESTS_C}
+BINDIR.${_T}= ${TESTSDIR}
+MAN.${_T}?= # empty
+SRCS.${_T}?= ${_T}.c
+DPADD.${_T}+= ${LIBATF_C}
+LDADD.${_T}+= -latf-c
+USEPRIVATELIB+= atf-c
+TEST_INTERFACE.${_T}= atf
+.endfor
+.endif
+
+.if !empty(ATF_TESTS_CXX)
+PROGS_CXX+= ${ATF_TESTS_CXX}
+_TESTS+= ${ATF_TESTS_CXX}
+.for _T in ${ATF_TESTS_CXX}
+BINDIR.${_T}= ${TESTSDIR}
+MAN.${_T}?= # empty
+SRCS.${_T}?= ${_T}${CXX_SUFFIX:U.cc}
+DPADD.${_T}+= ${LIBATF_CXX} ${LIBATF_C}
+LDADD.${_T}+= -latf-c++ -latf-c
+USEPRIVATELIB+= atf-c++
+TEST_INTERFACE.${_T}= atf
+.endfor
+.endif
+
+.if !empty(ATF_TESTS_SH)
+SCRIPTS+= ${ATF_TESTS_SH}
+_TESTS+= ${ATF_TESTS_SH}
+.for _T in ${ATF_TESTS_SH}
+SCRIPTSDIR_${_T}= ${TESTSDIR}
+TEST_INTERFACE.${_T}= atf
+CLEANFILES+= ${_T} ${_T}.tmp
+# TODO(jmmv): It seems to me that this SED and SRC functionality should
+# exist in bsd.prog.mk along the support for SCRIPTS. Move it there if
+# this proves to be useful within the tests.
+ATF_TESTS_SH_SED_${_T}?= # empty
+ATF_TESTS_SH_SRC_${_T}?= ${_T}.sh
+${_T}: ${ATF_TESTS_SH_SRC_${_T}}
+ echo '#! /usr/libexec/atf-sh' > ${.TARGET}.tmp
+.if empty(ATF_TESTS_SH_SED_${_T})
+ cat ${.ALLSRC:N*Makefile*} >>${.TARGET}.tmp
+.else
+ cat ${.ALLSRC:N*Makefile*} \
+ | sed ${ATF_TESTS_SH_SED_${_T}} >>${.TARGET}.tmp
+.endif
+ chmod +x ${.TARGET}.tmp
+ mv ${.TARGET}.tmp ${.TARGET}
+.endfor
+.endif
Property changes on: trunk/share/mk/atf.test.mk
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/share/mk/bsd.own.mk
===================================================================
--- trunk/share/mk/bsd.own.mk 2016-04-15 01:21:52 UTC (rev 7537)
+++ trunk/share/mk/bsd.own.mk 2016-04-15 01:37:43 UTC (rev 7538)
@@ -44,6 +44,11 @@
# LIBMODE Library mode. [${NOBINMODE}]
#
#
+# DEBUGDIR Base path for standalone debug files. [/usr/lib/debug]
+#
+# DEBUGMODE Mode for debug files. [${NOBINMODE}]
+#
+#
# KMODDIR Base path for loadable kernel modules
# (see kld(4)). [/boot/kernel]
#
@@ -148,7 +153,10 @@
LIBGRP?= ${BINGRP}
LIBMODE?= ${NOBINMODE}
+DEBUGDIR?= /usr/lib/debug
+DEBUGMODE?= ${NOBINMODE}
+
# Share files
SHAREDIR?= /usr/share
SHAREOWN?= root
@@ -182,6 +190,15 @@
INCLUDEDIR?= /usr/include
+#
+# install(1) parameters.
+#
+HRDLINK?= -l h
+SYMLINK?= -l s
+
+INSTALL_LINK?= ${INSTALL} ${HRDLINK}
+INSTALL_SYMLINK?= ${INSTALL} ${SYMLINK}
+
# Common variables
.if !defined(DEBUG_FLAGS)
STRIP?= -s
@@ -204,10 +221,19 @@
# regardless of user's setting).
#
.for var in \
+ CTF \
+ DEBUG_FILES \
INSTALLLIB \
MAN \
PROFILE
.if defined(NO_${var})
+.if defined(WITH_${var})
+.warning unsetting WITH_${var}
+.undef WITH_${var}
+.if defined(WITH_${var})
+.error wtf
+.endif
+.endif
WITHOUT_${var}=
.endif
.endfor
@@ -314,6 +340,7 @@
BIND_UTILS \
BINUTILS \
BLUETOOTH \
+ BMAKE \
BOOT \
BSD_CPIO \
BSNMP \
@@ -358,7 +385,6 @@
KVM \
LEGACY_CONSOLE \
LIB32 \
- LIBCPLUSPLUS \
LIBPTHREAD \
LIBTHR \
LOCALES \
@@ -410,7 +436,6 @@
ZONEINFO
__DEFAULT_NO_OPTIONS = \
- BMAKE \
BSD_GREP \
BIND_IDN \
BIND_LARGE_FILE \
@@ -418,11 +443,14 @@
BIND_SIGCHASE \
BIND_XML \
CLANG_EXTRAS \
+ CTF \
+ DEBUG_FILES \
HESIOD \
IDEA \
OFED \
SHARED_TOOLCHAIN \
- SVN
+ SVN \
+ TESTS
#
# Default behaviour of some options depends on the architecture. Unfortunately
@@ -622,6 +650,41 @@
.endif
.endfor
+#
+# MK_* options that default to "yes" if the compiler is a C++11 compiler.
+#
+.include <bsd.compiler.mk>
+.for var in \
+ LIBCPLUSPLUS
+.if defined(WITH_${var}) && defined(WITHOUT_${var})
+.error WITH_${var} and WITHOUT_${var} can't both be set.
+.endif
+.if defined(MK_${var})
+.error MK_${var} can't be set by a user.
+.endif
+.if ${COMPILER_FEATURES:Mc++11}
+.if defined(WITHOUT_${var})
+MK_${var}:= no
+.else
+MK_${var}:= yes
+.endif
+.else
+.if defined(WITH_${var})
+MK_${var}:= yes
+.else
+MK_${var}:= no
+.endif
+.endif
+.endfor
+
+.if ${MK_CTF} != "no"
+CTFCONVERT_CMD= ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.elif defined(.PARSEDIR) || ${MAKE_VERSION} >= 9201210220
+CTFCONVERT_CMD=
+.else
+CTFCONVERT_CMD= @:
+.endif
+
.endif # !_WITHOUT_SRCCONF
.endif # !target(__<bsd.own.mk>__)
Added: trunk/share/mk/bsd.progs.mk
===================================================================
--- trunk/share/mk/bsd.progs.mk (rev 0)
+++ trunk/share/mk/bsd.progs.mk 2016-04-15 01:37:43 UTC (rev 7538)
@@ -0,0 +1,150 @@
+# $MidnightBSD$
+# $FreeBSD: stable/10/share/mk/bsd.progs.mk 291791 2015-12-04 18:09:51Z bdrewery $
+# $Id: progs.mk,v 1.11 2012/11/06 17:18:54 sjg Exp $
+#
+# @(#) Copyright (c) 2006, Simon J. Gerraty
+#
+# This file is provided in the hope that it will
+# be of use. There is absolutely NO WARRANTY.
+# Permission to copy, redistribute or otherwise
+# use this file is hereby granted provided that
+# the above copyright notice and this notice are
+# left intact.
+#
+# Please send copies of changes and bug-fixes to:
+# sjg at crufty.net
+#
+
+.MAIN: all
+
+.if defined(PROGS) || defined(PROGS_CXX)
+# we really only use PROGS below...
+PROGS += ${PROGS_CXX}
+
+# In meta mode, we can capture dependenices for _one_ of the progs.
+# if makefile doesn't nominate one, we use the first.
+.if defined(.PARSEDIR)
+.ifndef UPDATE_DEPENDFILE_PROG
+UPDATE_DEPENDFILE_PROG = ${PROGS:[1]}
+.export UPDATE_DEPENDFILE_PROG
+.endif
+.else
+UPDATE_DEPENDFILE_PROG?= no
+.endif
+
+.ifndef PROG
+# They may have asked us to build just one
+.for t in ${PROGS}
+.if make($t)
+.if ${PROGS_CXX:U:M${t}}
+PROG_CXX ?= $t
+.endif
+PROG ?= $t
+.endif
+.endfor
+.endif
+
+.if defined(PROG)
+# just one of many
+PROG_OVERRIDE_VARS += BINDIR BINGRP BINOWN BINMODE DPSRCS MAN NO_WERROR \
+ PROGNAME SRCS WARNS
+PROG_VARS += CFLAGS CPPFLAGS CXXFLAGS DPADD DPLIBS LDADD LINKS \
+ LDFLAGS MLINKS ${PROG_OVERRIDE_VARS}
+.for v in ${PROG_VARS:O:u}
+.if empty(${PROG_OVERRIDE_VARS:M$v})
+.if defined(${v}.${PROG})
+$v += ${${v}.${PROG}}
+.elif defined(${v}_${PROG})
+$v += ${${v}_${PROG}}
+.endif
+.else
+$v ?=
+.endif
+.endfor
+
+# for meta mode, there can be only one!
+.if ${PROG} == ${UPDATE_DEPENDFILE_PROG}
+UPDATE_DEPENDFILE ?= yes
+.endif
+UPDATE_DEPENDFILE ?= NO
+
+# ensure that we don't clobber each other's dependencies
+DEPENDFILE?= .depend.${PROG}
+# prog.mk will do the rest
+.else # !defined(PROG)
+all: ${PROGS}
+
+# We cannot capture dependencies for meta mode here
+UPDATE_DEPENDFILE = NO
+# nor can we safely run in parallel.
+.NOTPARALLEL:
+.endif
+.endif # PROGS || PROGS_CXX
+
+# These are handled by the main make process.
+.ifdef _RECURSING_PROGS
+_PROGS_GLOBAL_VARS= CLEANFILES CLEANDIRS FILESGROUPS SCRIPTS
+.for v in ${_PROGS_GLOBAL_VARS}
+$v =
+.endfor
+.endif
+
+# handle being called [bsd.]progs.mk
+.include <bsd.prog.mk>
+
+.if !empty(PROGS) && !defined(_RECURSING_PROGS) && !defined(PROG)
+# tell progs.mk we might want to install things
+PROGS_TARGETS+= checkdpadd clean cleandepend cleandir depend install
+
+# Find common sources among the PROGS and depend on them before building
+# anything. This allows parallelization without them each fighting over
+# the same objects.
+_PROGS_COMMON_SRCS=
+_PROGS_ALL_SRCS=
+.for p in ${PROGS}
+.for s in ${SRCS.${p}}
+.if ${_PROGS_ALL_SRCS:M${s}} && !${_PROGS_COMMON_SRCS:M${s}}
+_PROGS_COMMON_SRCS+= ${s}
+.else
+_PROGS_ALL_SRCS+= ${s}
+.endif
+.endfor
+.endfor
+.if !empty(_PROGS_COMMON_SRCS)
+_PROGS_COMMON_OBJS= ${_PROGS_COMMON_SRCS:M*.[dhly]}
+.if !empty(_PROGS_COMMON_SRCS:N*.[dhly])
+_PROGS_COMMON_OBJS+= ${_PROGS_COMMON_SRCS:N*.[dhly]:R:S/$/.o/g}
+.endif
+${PROGS}: ${_PROGS_COMMON_OBJS}
+.endif
+
+.for p in ${PROGS}
+.if defined(PROGS_CXX) && !empty(PROGS_CXX:M$p)
+# bsd.prog.mk may need to know this
+x.$p= PROG_CXX=$p
+.endif
+
+# Main PROG target
+$p ${p}_p: .PHONY .MAKE
+ (cd ${.CURDIR} && \
+ NO_SUBDIR=1 ${MAKE} -f ${MAKEFILE} _RECURSING_PROGS= \
+ PROG=$p \
+ DEPENDFILE=.depend.$p .MAKE.DEPENDFILE=.depend.$p \
+ ${x.$p})
+
+# Pseudo targets for PROG, such as 'install'.
+.for t in ${PROGS_TARGETS:O:u}
+$p.$t: .PHONY .MAKE
+ (cd ${.CURDIR} && \
+ NO_SUBDIR=1 ${MAKE} -f ${MAKEFILE} _RECURSING_PROGS= \
+ PROG=$p \
+ DEPENDFILE=.depend.$p .MAKE.DEPENDFILE=.depend.$p \
+ ${x.$p} ${@:E})
+.endfor
+.endfor
+
+# Depend main pseudo targets on all PROG.pseudo targets too.
+.for t in ${PROGS_TARGETS:O:u}
+$t: ${PROGS:%=%.$t}
+.endfor
+.endif # !empty(PROGS) && !defined(_RECURSING_PROGS) && !defined(PROG)
Property changes on: trunk/share/mk/bsd.progs.mk
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/share/mk/bsd.test.mk
===================================================================
--- trunk/share/mk/bsd.test.mk (rev 0)
+++ trunk/share/mk/bsd.test.mk 2016-04-15 01:37:43 UTC (rev 7538)
@@ -0,0 +1,104 @@
+# $MidnightBSD$
+# $FreeBSD: stable/10/share/mk/bsd.test.mk 289054 2015-10-08 20:32:44Z bdrewery $
+#
+# Generic build infrastructure for test programs.
+#
+# This is the only public file that should be included by Makefiles when
+# tests are to be built. All other *.test.mk files are internal and not
+# to be included directly.
+
+.include <bsd.init.mk>
+
+__<bsd.test.mk>__:
+
+# 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
+# engines know to recurse into these directories.
+#
+# In other words: list here any directories that contain test programs but use
+# SUBDIR for directories that may contain helper binaries and/or data files.
+TESTS_SUBDIRS?=
+
+# If defined, indicates that the tests built by the Makefile are not part of
+# the FreeBSD Test Suite. The implication of this is that the tests won't be
+# installed under /usr/tests/ and that Kyua won't be able to run them.
+#NOT_FOR_TEST_SUITE=
+
+# List of variables to pass to the tests at run-time via the environment.
+TESTS_ENV?=
+
+# Force all tests in a separate distribution file.
+#
+# We want this to be the case even when the distribution name is already
+# overriden. For example: we want the tests for programs in the 'games'
+# distribution to end up in the 'tests' distribution; the test programs
+# themselves have all the necessary logic to detect that the games are not
+# installed and thus won't cause false negatives.
+DISTRIBUTION:= tests
+
+# Ordered list of directories to construct the PATH for the tests.
+TESTS_PATH+= ${DESTDIR}/bin ${DESTDIR}/sbin \
+ ${DESTDIR}/usr/bin ${DESTDIR}/usr/sbin
+.if defined(.PARSEDIR)
+TESTS_ENV+= PATH=${TESTS_PATH:tW:C/ +/:/g}
+.else
+TESTS_ENV+= PATH=${TESTS_PATH:N :Q:S,\\ ,:,g}
+.endif
+
+# Ordered list of directories to construct the LD_LIBRARY_PATH for the tests.
+TESTS_LD_LIBRARY_PATH+= ${DESTDIR}/lib ${DESTDIR}/usr/lib
+.if defined(.PARSEDIR)
+TESTS_ENV+= LD_LIBRARY_PATH=${TESTS_LD_LIBRARY_PATH:tW:C/ +/:/g}
+.else
+TESTS_ENV+= LD_LIBRARY_PATH=${TESTS_LD_LIBRARY_PATH:N :Q:S,\\ ,:,g}
+.endif
+
+# List of all tests being built. The various *.test.mk modules extend this
+# variable as needed.
+_TESTS=
+
+# Pull in the definitions of all supported test interfaces.
+.include <atf.test.mk>
+.include <plain.test.mk>
+.include <tap.test.mk>
+
+.for ts in ${TESTS_SUBDIRS}
+.if empty(SUBDIR:M${ts})
+SUBDIR+= ${ts}
+.endif
+.endfor
+
+# it is rare for test cases to have man pages
+.if !defined(MAN)
+MAN=
+.endif
+
+# tell progs.mk we might want to install things
+PROG_VARS+= BINDIR
+PROGS_TARGETS+= install
+
+.if !defined(NOT_FOR_TEST_SUITE)
+.include <suite.test.mk>
+.endif
+
+.if !target(realtest)
+realtest: .PHONY
+ @echo "$@ not defined; skipping"
+.endif
+
+test: .PHONY
+.ORDER: beforetest realtest
+test: beforetest realtest
+
+.if target(aftertest)
+.ORDER: realtest aftertest
+test: aftertest
+.endif
+
+.if !empty(PROGS) || !empty(PROGS_CXX) || !empty(SCRIPTS)
+.include <bsd.progs.mk>
+.endif
+.include <bsd.files.mk>
+
+.include <bsd.obj.mk>
Property changes on: trunk/share/mk/bsd.test.mk
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/share/mk/netbsd-tests.test.mk
===================================================================
--- trunk/share/mk/netbsd-tests.test.mk (rev 0)
+++ trunk/share/mk/netbsd-tests.test.mk 2016-04-15 01:37:43 UTC (rev 7538)
@@ -0,0 +1,47 @@
+# $MidnightBSD$
+# $FreeBSD: stable/10/share/mk/netbsd-tests.test.mk 276478 2014-12-31 20:13:31Z ngie $
+
+.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}
+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
Property changes on: trunk/share/mk/netbsd-tests.test.mk
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/share/mk/plain.test.mk
===================================================================
--- trunk/share/mk/plain.test.mk (rev 0)
+++ trunk/share/mk/plain.test.mk 2016-04-15 01:37:43 UTC (rev 7538)
@@ -0,0 +1,70 @@
+# $MidnightBSD$
+# $FreeBSD: stable/10/share/mk/plain.test.mk 276423 2014-12-30 20:46:01Z ngie $
+#
+# You must include bsd.test.mk instead of this file from your Makefile.
+#
+# Logic to build and install plain test programs. A plain test programs it not
+# supposed to use any specific testing framework: all it does is run some code
+# and report the test's pass or fail status via a 0 or 1 exit code.
+
+.if !target(__<bsd.test.mk>__)
+.error plain.test.mk cannot be included directly.
+.endif
+
+# List of C, C++ and shell test programs to build.
+#
+# Programs listed here are built according to the semantics of bsd.prog.mk for
+# PROGS, PROGS_CXX and SCRIPTS, respectively.
+#
+# Test programs registered in this manner are set to be installed into TESTSDIR
+# (which should be overriden by the Makefile) and are not required to provide a
+# manpage.
+PLAIN_TESTS_C?=
+PLAIN_TESTS_CXX?=
+PLAIN_TESTS_SH?=
+
+.if !empty(PLAIN_TESTS_C)
+PROGS+= ${PLAIN_TESTS_C}
+_TESTS+= ${PLAIN_TESTS_C}
+.for _T in ${PLAIN_TESTS_C}
+BINDIR.${_T}= ${TESTSDIR}
+MAN.${_T}?= # empty
+SRCS.${_T}?= ${_T}.c
+TEST_INTERFACE.${_T}= plain
+.endfor
+.endif
+
+.if !empty(PLAIN_TESTS_CXX)
+PROGS_CXX+= ${PLAIN_TESTS_CXX}
+_TESTS+= ${PLAIN_TESTS_CXX}
+.for _T in ${PLAIN_TESTS_CXX}
+BINDIR.${_T}= ${TESTSDIR}
+MAN.${_T}?= # empty
+SRCS.${_T}?= ${_T}.cc
+TEST_INTERFACE.${_T}= plain
+.endfor
+.endif
+
+.if !empty(PLAIN_TESTS_SH)
+SCRIPTS+= ${PLAIN_TESTS_SH}
+_TESTS+= ${PLAIN_TESTS_SH}
+.for _T in ${PLAIN_TESTS_SH}
+SCRIPTSDIR_${_T}= ${TESTSDIR}
+TEST_INTERFACE.${_T}= plain
+CLEANFILES+= ${_T} ${_T}.tmp
+# TODO(jmmv): It seems to me that this SED and SRC functionality should
+# exist in bsd.prog.mk along the support for SCRIPTS. Move it there if
+# this proves to be useful within the tests.
+PLAIN_TESTS_SH_SED_${_T}?= # empty
+PLAIN_TESTS_SH_SRC_${_T}?= ${_T}.sh
+${_T}: ${PLAIN_TESTS_SH_SRC_${_T}}
+.if empty(PLAIN_TESTS_SH_SED_${_T})
+ cat ${.ALLSRC:N*Makefile*} >${.TARGET}.tmp
+.else
+ cat ${.ALLSRC:N*Makefile*} \
+ | sed ${PLAIN_TESTS_SH_SED_${_T}} >${.TARGET}.tmp
+.endif
+ chmod +x ${.TARGET}.tmp
+ mv ${.TARGET}.tmp ${.TARGET}
+.endfor
+.endif
Property changes on: trunk/share/mk/plain.test.mk
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/share/mk/suite.test.mk
===================================================================
--- trunk/share/mk/suite.test.mk (rev 0)
+++ trunk/share/mk/suite.test.mk 2016-04-15 01:37:43 UTC (rev 7538)
@@ -0,0 +1,133 @@
+# $MidnightBSD$
+# $FreeBSD: stable/10/share/mk/suite.test.mk 289050 2015-10-08 19:10:51Z bdrewery $
+#
+# You must include bsd.test.mk instead of this file from your Makefile.
+#
+# Internal glue for the build of /usr/tests/.
+
+.if !target(__<bsd.test.mk>__)
+.error suite.test.mk cannot be included directly.
+.endif
+
+# Directory in which to install tests defined by the current Makefile.
+# 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 MidnightBSD src tree.
+TESTSUITE?= MidnightBSD
+
+# Knob to control the handling of the Kyuafile for this Makefile.
+#
+# If 'yes', a Kyuafile exists in the source tree and is installed into
+# TESTSDIR.
+#
+# If 'auto', a Kyuafile 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 Kyuafile is installed.
+KYUAFILE?= auto
+
+# Per-test program interface definition.
+#
+# The name provided here must match one of the interface names supported by
+# Kyua as this is later encoded in the Kyuafile test program definitions.
+#TEST_INTERFACE.<test-program>= interface-name
+
+# Per-test program metadata properties as a list of key/value pairs.
+#
+# All the variables for a particular program are appended to the program's
+# definition in the Kyuafile. This feature can be used to avoid having to
+# explicitly supply a Kyuafile in the source directory, allowing the caller
+# Makefile to rely on the KYUAFILE=auto behavior defined here.
+#TEST_METADATA.<test-program>+= key="value"
+
+# Path to the prefix of the installed Kyua CLI, if any.
+#
+# If kyua is installed from ports, we automatically define a realtest target
+# below to run the tests using this tool. The tools are searched for in the
+# hierarchy specified by this variable.
+KYUA_PREFIX?= /usr/local
+
+.if ${KYUAFILE:tl} == "yes"
+FILES+= Kyuafile
+FILESDIR_Kyuafile= ${TESTSDIR}
+
+CLEANFILES+= Kyuafile.auto Kyuafile.auto.tmp
+.elif ${KYUAFILE:tl} == "auto"
+FILES+= Kyuafile.auto
+FILESDIR_Kyuafile.auto= ${TESTSDIR}
+FILESNAME_Kyuafile.auto= Kyuafile
+
+CLEANFILES+= Kyuafile.auto Kyuafile.auto.tmp
+
+.NOPATH: Kyuafile.auto
+Kyuafile.auto: Makefile
+ @{ \
+ echo '-- Automatically generated by bsd.test.mk.'; \
+ echo; \
+ echo 'syntax(2)'; \
+ echo; \
+ echo 'test_suite("${TESTSUITE}")'; \
+ echo; \
+ } >Kyuafile.auto.tmp
+.for _T in ${_TESTS}
+.if defined(.PARSEDIR)
+ @echo '${TEST_INTERFACE.${_T}}_test_program{name="${_T}"${TEST_METADATA.${_T}:C/$/,/:tW:C/^/, /W:C/,$//W}}' \
+ >>Kyuafile.auto.tmp
+.else
+ @echo '${TEST_INTERFACE.${_T}}_test_program{name="${_T}"${TEST_METADATA.${_T}:C/^/, /:Q:S/\\ ,/,/g:S,\\,,g}}' \
+ >>Kyuafile.auto.tmp
+.endif
+.endfor
+.for _T in ${TESTS_SUBDIRS:N.WAIT}
+ @echo "include(\"${_T}/Kyuafile\")" >>Kyuafile.auto.tmp
+.endfor
+ @mv Kyuafile.auto.tmp Kyuafile.auto
+.endif
+
+KYUA?= ${KYUA_PREFIX}/bin/kyua
+.if exists(${KYUA})
+# Definition of the "make test" target and supporting variables.
+#
+# This target, by necessity, can only work for native builds (i.e. a MidnightBSD
+# host building a release for the same system). The target runs Kyua, which is
+# not in the toolchain, and the tests execute code built for the target host.
+#
+# Due to the dependencies of the binaries built by the source tree and how they
+# are used by tests, it is highly possible for a execution of "make test" to
+# report bogus results unless the new binaries are put in place.
+realtest: .PHONY
+ @echo "*** WARNING: make test is experimental"
+ @echo "***"
+ @echo "*** Using this test does not preclude you from running the tests"
+ @echo "*** installed in ${TESTSBASE}. This test run may raise false"
+ @echo "*** positives and/or false negatives."
+ @echo
+ @set -e; \
+ ${KYUA} test -k ${DESTDIR}${TESTSDIR}/Kyuafile; \
+ result=0; \
+ echo; \
+ echo "*** Once again, note that "make test" is unsupported."; \
+ test $${result} -eq 0
+.endif
+
+beforetest: .PHONY
+.if defined(TESTSDIR)
+.if ${TESTSDIR} == ${TESTSBASE}
+# Forbid running from ${TESTSBASE}. It can cause false positives/negatives and
+# it does not cover all the tests (e.g. it misses testing software in external).
+ @echo "*** Sorry, you cannot use make test from src/tests. Install the"
+ @echo "*** tests into their final location and run them from ${TESTSBASE}"
+ @false
+.else
+ @echo "*** Using this test does not preclude you from running the tests"
+ @echo "*** installed in ${TESTSBASE}. This test run may raise false"
+ @echo "*** positives and/or false negatives."
+.endif
+.else
+ @echo "*** No TESTSDIR defined; nothing to do."
+ @false
+.endif
+ @echo
Property changes on: trunk/share/mk/suite.test.mk
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/share/mk/tap.test.mk
===================================================================
--- trunk/share/mk/tap.test.mk (rev 0)
+++ trunk/share/mk/tap.test.mk 2016-04-15 01:37:43 UTC (rev 7538)
@@ -0,0 +1,98 @@
+# $MidnightBSD$
+# $FreeBSD: stable/10/share/mk/tap.test.mk 276423 2014-12-30 20:46:01Z ngie $
+#
+# You must include bsd.test.mk instead of this file from your Makefile.
+#
+# Logic to build and install TAP-compliant test programs.
+#
+# This is provided to support existing tests in the FreeBSD source tree
+# (particularly those coming from tools/regression/) that comply with the
+# Test Anything Protocol. It should not be used for new tests.
+
+.if !target(__<bsd.test.mk>__)
+.error tap.test.mk cannot be included directly.
+.endif
+
+# List of C, C++ and shell test programs to build.
+#
+# Programs listed here are built according to the semantics of bsd.prog.mk for
+# PROGS, PROGS_CXX and SCRIPTS, respectively.
+#
+# Test programs registered in this manner are set to be installed into TESTSDIR
+# (which should be overriden by the Makefile) and are not required to provide a
+# manpage.
+TAP_TESTS_C?=
+TAP_TESTS_CXX?=
+TAP_TESTS_PERL?=
+TAP_TESTS_SH?=
+
+# Perl interpreter to use for test programs written in this language.
+TAP_PERL_INTERPRETER?= /usr/bin/perl
+
+.if !empty(TAP_TESTS_C)
+PROGS+= ${TAP_TESTS_C}
+_TESTS+= ${TAP_TESTS_C}
+.for _T in ${TAP_TESTS_C}
+BINDIR.${_T}= ${TESTSDIR}
+MAN.${_T}?= # empty
+SRCS.${_T}?= ${_T}.c
+TEST_INTERFACE.${_T}= tap
+.endfor
+.endif
+
+.if !empty(TAP_TESTS_CXX)
+PROGS_CXX+= ${TAP_TESTS_CXX}
+_TESTS+= ${TAP_TESTS_CXX}
+.for _T in ${TAP_TESTS_CXX}
+BINDIR.${_T}= ${TESTSDIR}
+MAN.${_T}?= # empty
+SRCS.${_T}?= ${_T}.cc
+TEST_INTERFACE.${_T}= tap
+.endfor
+.endif
+
+.if !empty(TAP_TESTS_PERL)
+SCRIPTS+= ${TAP_TESTS_PERL}
+_TESTS+= ${TAP_TESTS_PERL}
+.for _T in ${TAP_TESTS_PERL}
+SCRIPTSDIR_${_T}= ${TESTSDIR}
+TEST_INTERFACE.${_T}= tap
+TEST_METADATA.${_T}+= required_programs="${TAP_PERL_INTERPRETER}"
+CLEANFILES+= ${_T} ${_T}.tmp
+# TODO(jmmv): It seems to me that this SED and SRC functionality should
+# exist in bsd.prog.mk along the support for SCRIPTS. Move it there if
+# this proves to be useful within the tests.
+TAP_TESTS_PERL_SED_${_T}?= # empty
+TAP_TESTS_PERL_SRC_${_T}?= ${_T}.pl
+${_T}: ${TAP_TESTS_PERL_SRC_${_T}}
+ { \
+ echo '#! ${TAP_PERL_INTERPRETER}'; \
+ cat ${.ALLSRC:N*Makefile*} | sed ${TAP_TESTS_PERL_SED_${_T}}; \
+ } >${.TARGET}.tmp
+ chmod +x ${.TARGET}.tmp
+ mv ${.TARGET}.tmp ${.TARGET}
+.endfor
+.endif
+
+.if !empty(TAP_TESTS_SH)
+SCRIPTS+= ${TAP_TESTS_SH}
+_TESTS+= ${TAP_TESTS_SH}
+.for _T in ${TAP_TESTS_SH}
+SCRIPTSDIR_${_T}= ${TESTSDIR}
+TEST_INTERFACE.${_T}= tap
+CLEANFILES+= ${_T} ${_T}.tmp
+# TODO(jmmv): It seems to me that this SED and SRC functionality should
+# exist in bsd.prog.mk along the support for SCRIPTS. Move it there if
+# this proves to be useful within the tests.
+TAP_TESTS_SH_SED_${_T}?= # empty
+TAP_TESTS_SH_SRC_${_T}?= ${_T}.sh
+${_T}: ${TAP_TESTS_SH_SRC_${_T}}
+.if empty(TAP_TESTS_SH_SED_${_T})
+ cat ${.ALLSRC} >${.TARGET}.tmp
+.else
+ cat ${.ALLSRC} | sed ${TAP_TESTS_SH_SED_${_T}} >${.TARGET}.tmp
+.endif
+ chmod +x ${.TARGET}.tmp
+ mv ${.TARGET}.tmp ${.TARGET}
+.endfor
+.endif
Property changes on: trunk/share/mk/tap.test.mk
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
More information about the Midnightbsd-cvs
mailing list