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