xref: /freebsd/contrib/bmake/unit-tests/meta-output.mk (revision b4894eca1ade4e9cec9afbe76021305d23bf914a)
1#
2
3.MAIN: all
4
5.if make(output)
6.MAKE.MODE= meta curDirOk=true nofilemon
7.else
8.MAKE.MODE= compat
9.endif
10
11all: output.-B output.-j1
12
13_mf := ${.PARSEDIR}/${.PARSEFILE}
14
15# This output should be accurately reflected in the .meta file.
16# We append an extra newline to ${.TARGET} (after it has been
17# written to stdout) to match what meta_cmd_finish() will do.
18output: .NOPATH
19	@{ echo Test ${tag} output; \
20	for i in 1 2 3; do \
21	printf "test$$i:  "; sleep 0; echo " Done"; \
22	done; echo; } | tee ${.TARGET}; echo >> ${.TARGET}
23
24# The diff at the end should produce nothing.
25output.-B output.-j1:
26	@{ rm -f ${TMPDIR}/output; mkdir -p ${TMPDIR}/obj; \
27	MAKEFLAGS= ${.MAKE} -r -C ${TMPDIR} ${.TARGET:E} tag=${.TARGET:E} -f ${_mf} output; \
28	sed '1,/command output/d' ${TMPDIR}/obj/output.meta > ${TMPDIR}/obj/output-meta; \
29	${DIFF:Udiff} ${TMPDIR}/obj/output ${TMPDIR}/obj/output-meta; }
30
31