Makefile revision 246223
1# This is a generated file, do NOT edit!
2# See contrib/bmake/bsd.after-import.mk
3#
4# $FreeBSD: head/usr.bin/bmake/unit-tests/Makefile 246223 2013-02-01 22:55:27Z sjg $
5
6SRCTOP?= ${.CURDIR:H:H:H}
7
8# $Id: Makefile.in,v 1.40 2012/12/28 21:28:19 sjg Exp $
9#
10# $NetBSD: Makefile,v 1.35 2012/11/09 19:08:28 sjg Exp $
11#
12# Unit tests for make(1)
13# The main targets are:
14# 
15# all:	run all the tests
16# test:	run 'all', capture output and compare to expected results
17# accept: move generated output to expected results
18#
19# Adding a test case.  
20# Each feature should get its own set of tests in its own suitably
21# named makefile which should be added to SUBFILES to hook it in.
22# 
23
24srcdir= ${SRCTOP}/contrib/bmake/unit-tests
25
26.MAIN: all
27
28UNIT_TESTS:= ${srcdir}
29
30# Simple sub-makefiles - we run them as a black box
31# keep the list sorted.
32SUBFILES= \
33	comment \
34	cond1 \
35	error \
36	export \
37	export-all \
38	doterror \
39	dotwait \
40	forloop \
41	forsubst \
42	hash \
43	misc \
44	moderrs \
45	modmatch \
46	modmisc \
47	modorder \
48	modts \
49	modword \
50	order \
51	phony-end \
52	posix \
53	qequals \
54	sysv \
55	ternary \
56	unexport \
57	unexport-env \
58	varcmd
59
60all: ${SUBFILES}
61
62flags.doterror=
63flags.order=-j1
64
65# the tests are actually done with sub-makes.
66.PHONY: ${SUBFILES}
67.PRECIOUS: ${SUBFILES}
68${SUBFILES}:
69	-@${.MAKE} ${flags.$@:U-k} -f ${UNIT_TESTS}/$@
70
71clean:
72	rm -f *.out *.fail *.core
73
74.sinclude <bsd.obj.mk>
75
76TEST_MAKE?= ${.MAKE}
77TOOL_SED?= sed
78TOOL_TR?= tr
79TOOL_DIFF?= diff
80DIFF_FLAGS?= -u
81
82# ensure consistent results from sort(1)
83LC_ALL= C
84LANG= C
85.export LANG LC_ALL
86
87# The driver.
88# We always pretend .MAKE was called 'make' 
89# and strip ${.CURDIR}/ from the output
90# and replace anything after 'stopped in' with unit-tests
91# so the results can be compared.
92test:
93	@echo "${TEST_MAKE} -f ${MAKEFILE} > ${.TARGET}.out 2>&1"
94	@cd ${.OBJDIR} && ${TEST_MAKE} -f ${MAKEFILE} 2>&1 | \
95	${TOOL_TR} -d '\015' | \
96	${TOOL_SED} -e 's,^${TEST_MAKE:T:C/\./\\\./g}:,make:,' \
97	-e '/stopped/s, /.*, unit-tests,' \
98	-e 's,${.CURDIR:C/\./\\\./g}/,,g' \
99	-e 's,${UNIT_TESTS:C/\./\\\./g}/,,g' > ${.TARGET}.out || { \
100	tail ${.TARGET}.out; mv ${.TARGET}.out ${.TARGET}.fail; exit 1; }
101	${TOOL_DIFF} ${DIFF_FLAGS} ${UNIT_TESTS}/${.TARGET}.exp ${.TARGET}.out
102
103accept:
104	mv test.out ${srcdir}/test.exp
105
106