1 # This is a generated file, do NOT edit!
2 # See contrib/bmake/bsd.after-import.mk
6 SRCTOP?= ${.CURDIR:H:H:H}
8 # $Id: Makefile.in,v 1.46 2014/11/06 01:47:57 sjg Exp $
10 # $NetBSD: Makefile,v 1.51 2014/10/20 23:21:11 sjg Exp $
12 # Unit tests for make(1)
13 # The main targets are:
15 # all: run all the tests
16 # test: run 'all', and compare to expected results
17 # accept: move generated output to expected results
20 # Each feature should get its own set of tests in its own suitably
21 # named makefile (*.mk), with its own set of expected results (*.exp),
22 # and it should be added to the TESTNAMES list.
25 srcdir= ${SRCTOP}/contrib/bmake/unit-tests
29 UNIT_TESTS:= ${srcdir}
32 # Each test is in a sub-makefile.
33 # Keep the list sorted.
65 # these tests were broken by referting POSIX chanegs
66 STRICT_POSIX_TESTS = \
73 # Override make flags for certain tests
77 OUTFILES= ${TESTNAMES:S/$/.out/}
81 CLEANFILES += *.rawout *.out *.status *.tmp *.core *.tmp
82 CLEANFILES += obj*.[och] lib*.a # posix1.mk
83 CLEANFILES += issue* .[ab]* # suffixes.mk
84 CLEANRECURSIVE += dir dummy # posix1.mk
88 .if !empty(CLEANRECURSIVE)
89 rm -rf ${CLEANRECURSIVE}
98 .if defined(.PARSEDIR)
99 # ensure consistent results from sort(1)
105 # some tests need extra post-processing
106 SED_CMDS.varshell = -e 's,^[a-z]*sh: ,,' \
107 -e '/command/s,No such.*,not found,'
109 # the tests are actually done with sub-makes.
110 .SUFFIXES: .mk .rawout .out
112 @echo ${TEST_MAKE} ${flags.${.TARGET:R}:U-k} -f ${.IMPSRC}
114 { ${TEST_MAKE} ${flags.${.TARGET:R}:U-k} -f ${.IMPSRC} \
115 2>&1 ; echo $$? >${.TARGET:R}.status ; } > ${.TARGET}.tmp
116 @mv ${.TARGET}.tmp ${.TARGET}
118 # We always pretend .MAKE was called 'make'
119 # and strip ${.CURDIR}/ from the output
120 # and replace anything after 'stopped in' with unit-tests
121 # so the results can be compared.
123 @echo postprocess ${.TARGET}
124 @${TOOL_SED} -e 's,^${TEST_MAKE:T:C/\./\\\./g}[][0-9]*:,make:,' \
125 -e 's,${TEST_MAKE:C/\./\\\./g},make,' \
126 -e '/stopped/s, /.*, unit-tests,' \
127 -e 's,${.CURDIR:C/\./\\\./g}/,,g' \
128 -e 's,${UNIT_TESTS:C/\./\\\./g}/,,g' ${SED_CMDS.${.TARGET:T:R}} \
129 < ${.IMPSRC} > ${.TARGET}.tmp
130 @echo "exit status `cat ${.TARGET:R}.status`" >> ${.TARGET}.tmp
131 @mv ${.TARGET}.tmp ${.TARGET}
133 # Compare all output files
134 test: ${OUTFILES} .PHONY
136 for test in ${TESTNAMES}; do \
137 ${TOOL_DIFF} -u ${UNIT_TESTS}/$${test}.exp $${test}.out \
138 || failed="$${failed}$${failed:+ }$${test}" ; \
140 if [ -n "$${failed}" ]; then \
141 echo "Failed tests: $${failed}" ; false ; \
143 echo "All tests passed" ; \
147 @for test in ${TESTNAMES}; do \
148 cmp -s ${UNIT_TESTS}/$${test}.exp $${test}.out \
149 || { echo "Replacing $${test}.exp" ; \
150 cp $${test}.out ${UNIT_TESTS}/$${test}.exp ; } \
153 .if exists(${TEST_MAKE})
154 ${TESTNAMES:S/$/.rawout/}: ${TEST_MAKE}
157 .sinclude <bsd.obj.mk>