Home | History | Annotate | Line # | Download | only in unit-tests
      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 
     11 all: 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.
     18 output: .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.
     25 output.-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 -u ${TMPDIR}/obj/output ${TMPDIR}/obj/output-meta; }
     30 
     31