aboutsummaryrefslogtreecommitdiff
path: root/contrib/bmake/unit-tests/meta-output.mk
blob: 104091df5d0014a947282d5768d8b193442651cc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#

.MAIN: all

.if make(output)
.MAKE.MODE= meta curDirOk=true nofilemon
.else
.MAKE.MODE= compat
.endif

all: output.-B output.-j1

_mf := ${.PARSEDIR}/${.PARSEFILE}

# This output should be accurately reflected in the .meta file.
# We append an extra newline to ${.TARGET} (after it has been
# written to stdout) to match what meta_cmd_finish() will do.
output: .NOPATH
	@{ echo Test ${tag} output; \
	for i in 1 2 3; do \
	printf "test$$i:  "; sleep 0; echo " Done"; \
	done; echo; } | tee ${.TARGET}; echo >> ${.TARGET}

# The diff at the end should produce nothing.
output.-B output.-j1:
	@{ rm -f ${TMPDIR}/output; mkdir -p ${TMPDIR}/obj; \
	MAKEFLAGS= ${.MAKE} -r -C ${TMPDIR} ${.TARGET:E} tag=${.TARGET:E} -f ${_mf} output; \
	sed '1,/command output/d' ${TMPDIR}/obj/output.meta > ${TMPDIR}/obj/output-meta; \
	${DIFF:Udiff} ${TMPDIR}/obj/output ${TMPDIR}/obj/output-meta; }