summaryrefslogtreecommitdiffstats
path: root/usr.bin/bmake/unit-tests
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2012-10-06 19:19:21 +0000
committermarcel <marcel@FreeBSD.org>2012-10-06 19:19:21 +0000
commitbd137de2db94b8668cf1fd550552bb4b41facb0e (patch)
treeda2d0bce63a7f39427e44b7f31cea3bbb63cc9c4 /usr.bin/bmake/unit-tests
parent78ade40ed1d3591a0bf9f5a1bb057c1f4084135d (diff)
downloadFreeBSD-src-bd137de2db94b8668cf1fd550552bb4b41facb0e.zip
FreeBSD-src-bd137de2db94b8668cf1fd550552bb4b41facb0e.tar.gz
Add bmake to the build and allow it to be installed as make(1) instead
of FreeBSD's make by setting WITH_BMAKE. The WITH_BMAKE build makes it easy for people to switch while working out the kinks -- think ports tree here. The option will be removed in due time. Submitted by: Simon Gerraty (sjg@juniper.net)
Diffstat (limited to 'usr.bin/bmake/unit-tests')
-rw-r--r--usr.bin/bmake/unit-tests/Makefile103
1 files changed, 103 insertions, 0 deletions
diff --git a/usr.bin/bmake/unit-tests/Makefile b/usr.bin/bmake/unit-tests/Makefile
new file mode 100644
index 0000000..c22dbc5
--- /dev/null
+++ b/usr.bin/bmake/unit-tests/Makefile
@@ -0,0 +1,103 @@
+# This is a generated file, do NOT edit!
+# See contrib/bmake/bsd.after-import.mk
+#
+# $FreeBSD$
+
+SRCTOP?= ${.CURDIR:H:H:H}
+
+# $Id: Makefile.in,v 1.38 2012/06/19 23:38:48 sjg Exp $
+#
+# $NetBSD: Makefile,v 1.34 2012/06/19 23:25:53 sjg Exp $
+#
+# Unit tests for make(1)
+# The main targets are:
+#
+# all: run all the tests
+# test: run 'all', capture output and compare to expected results
+# accept: move generated output to expected results
+#
+# Adding a test case.
+# Each feature should get its own set of tests in its own suitably
+# named makefile which should be added to SUBFILES to hook it in.
+#
+
+srcdir= ${SRCTOP}/contrib/bmake/unit-tests
+
+.MAIN: all
+
+UNIT_TESTS:= ${srcdir}
+
+# Simple sub-makefiles - we run them as a black box
+# keep the list sorted.
+SUBFILES= \
+ comment \
+ cond1 \
+ error \
+ export \
+ export-all \
+ doterror \
+ dotwait \
+ forloop \
+ forsubst \
+ hash \
+ misc \
+ moderrs \
+ modmatch \
+ modmisc \
+ modorder \
+ modts \
+ modword \
+ phony-end \
+ posix \
+ qequals \
+ sysv \
+ ternary \
+ unexport \
+ unexport-env \
+ varcmd
+
+all: ${SUBFILES}
+
+flags.doterror=
+
+# the tests are actually done with sub-makes.
+.PHONY: ${SUBFILES}
+.PRECIOUS: ${SUBFILES}
+${SUBFILES}:
+ -@${.MAKE} ${flags.$@:U-k} -f ${UNIT_TESTS}/$@
+
+clean:
+ rm -f *.out *.fail *.core
+
+.sinclude <bsd.obj.mk>
+
+TEST_MAKE?= ${.MAKE}
+TOOL_SED?= sed
+TOOL_TR?= tr
+TOOL_DIFF?= diff
+DIFF_FLAGS?= -u
+
+# ensure consistent results from sort(1)
+LC_ALL= C
+LANG= C
+.export LANG LC_ALL
+
+# The driver.
+# We always pretend .MAKE was called 'make'
+# and strip ${.CURDIR}/ from the output
+# and replace anything after 'stopped in' with unit-tests
+# so the results can be compared.
+test:
+ @echo "${TEST_MAKE} -f ${MAKEFILE} > ${.TARGET}.out 2>&1"
+ @cd ${.OBJDIR} && ${TEST_MAKE} -f ${MAKEFILE} 2>&1 | \
+ ${TOOL_TR} -d '\015' | \
+ ${TOOL_SED} -e 's,^${TEST_MAKE:T:C/\./\\\./g}:,make:,' \
+ -e '/stopped/s, /.*, unit-tests,' \
+ -e 's,${.CURDIR:C/\./\\\./g}/,,g' \
+ -e 's,${UNIT_TESTS:C/\./\\\./g}/,,g' > ${.TARGET}.out || { \
+ tail ${.TARGET}.out; mv ${.TARGET}.out ${.TARGET}.fail; exit 1; }
+ ${TOOL_DIFF} ${DIFF_FLAGS} ${UNIT_TESTS}/${.TARGET}.exp ${.TARGET}.out
+
+accept:
+ mv test.out ${srcdir}/test.exp
+
OpenPOWER on IntegriCloud