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.48 2015/12/07 04:06:29 sjg Exp $
10 # $NetBSD: Makefile,v 1.52 2015/05/05 21:51:09 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.
66 # these tests were broken by referting POSIX chanegs
67 STRICT_POSIX_TESTS = \
74 # Override make flags for certain tests
78 OUTFILES= ${TESTNAMES:S/$/.out/}
82 CLEANFILES += *.rawout *.out *.status *.tmp *.core *.tmp
83 CLEANFILES += obj*.[och] lib*.a # posix1.mk
84 CLEANFILES += issue* .[ab]* # suffixes.mk
85 CLEANRECURSIVE += dir dummy # posix1.mk
89 .if !empty(CLEANRECURSIVE)
90 rm -rf ${CLEANRECURSIVE}
99 .if defined(.PARSEDIR)
100 # ensure consistent results from sort(1)
106 # some tests need extra post-processing
107 SED_CMDS.varshell = -e 's,^[a-z]*sh: ,,' \
108 -e '/command/s,No such.*,not found,'
110 # the tests are actually done with sub-makes.
111 .SUFFIXES: .mk .rawout .out
113 @echo ${TEST_MAKE} ${flags.${.TARGET:R}:U-k} -f ${.IMPSRC}
115 { ${TEST_MAKE} ${flags.${.TARGET:R}:U-k} -f ${.IMPSRC} \
116 2>&1 ; echo $$? >${.TARGET:R}.status ; } > ${.TARGET}.tmp
117 @mv ${.TARGET}.tmp ${.TARGET}
119 # We always pretend .MAKE was called 'make'
120 # and strip ${.CURDIR}/ from the output
121 # and replace anything after 'stopped in' with unit-tests
122 # so the results can be compared.
124 @echo postprocess ${.TARGET}
125 @${TOOL_SED} -e 's,^${TEST_MAKE:T:C/\./\\\./g}[][0-9]*:,make:,' \
126 -e 's,${TEST_MAKE:C/\./\\\./g},make,' \
127 -e '/stopped/s, /.*, unit-tests,' \
128 -e 's,${.CURDIR:C/\./\\\./g}/,,g' \
129 -e 's,${UNIT_TESTS:C/\./\\\./g}/,,g' ${SED_CMDS.${.TARGET:T:R}} \
130 < ${.IMPSRC} > ${.TARGET}.tmp
131 @echo "exit status `cat ${.TARGET:R}.status`" >> ${.TARGET}.tmp
132 @mv ${.TARGET}.tmp ${.TARGET}
134 # Compare all output files
135 test: ${OUTFILES} .PHONY
137 for test in ${TESTNAMES}; do \
138 ${TOOL_DIFF} ${DIFF_FLAGS} ${UNIT_TESTS}/$${test}.exp $${test}.out \
139 || failed="$${failed}$${failed:+ }$${test}" ; \
141 if [ -n "$${failed}" ]; then \
142 echo "Failed tests: $${failed}" ; false ; \
144 echo "All tests passed" ; \
148 @for test in ${TESTNAMES}; do \
149 cmp -s ${UNIT_TESTS}/$${test}.exp $${test}.out \
150 || { echo "Replacing $${test}.exp" ; \
151 cp $${test}.out ${UNIT_TESTS}/$${test}.exp ; } \
154 .if exists(${TEST_MAKE})
155 ${TESTNAMES:S/$/.rawout/}: ${TEST_MAKE}
158 .sinclude <bsd.obj.mk>