Tue Jul 28 18:39:56 2020 UTC ()
Use cat if no POSTPROC.${.TARGET:R}

On Linux sed with no flags throws an error.


(sjg)
diff -r1.73 -r1.74 src/usr.bin/make/unit-tests/Makefile

cvs diff -r1.73 -r1.74 src/usr.bin/make/unit-tests/Makefile (expand / switch to unified diff)

--- src/usr.bin/make/unit-tests/Makefile 2020/07/28 16:26:37 1.73
+++ src/usr.bin/make/unit-tests/Makefile 2020/07/28 18:39:56 1.74
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: Makefile,v 1.73 2020/07/28 16:26:37 sjg Exp $ 1# $NetBSD: Makefile,v 1.74 2020/07/28 18:39:56 sjg Exp $
2# 2#
3# Unit tests for make(1) 3# Unit tests for make(1)
4# 4#
5# The main targets are: 5# The main targets are:
6# 6#
7# all: 7# all:
8# run all the tests 8# run all the tests
9# test: 9# test:
10# run 'all', and compare to expected results 10# run 'all', and compare to expected results
11# accept: 11# accept:
12# move generated output to expected results 12# move generated output to expected results
13# 13#
14# Settable variables 14# Settable variables
@@ -148,27 +148,27 @@ LANG= C @@ -148,27 +148,27 @@ LANG= C
148# always pretend .MAKE was called 'make' 148# always pretend .MAKE was called 'make'
149_SED_CMDS+= -e 's,^${TEST_MAKE:T:S,.,\\.,g}[][0-9]*:,make:,' 149_SED_CMDS+= -e 's,^${TEST_MAKE:T:S,.,\\.,g}[][0-9]*:,make:,'
150_SED_CMDS+= -e 's,${TEST_MAKE:S,.,\\.,g},make,' 150_SED_CMDS+= -e 's,${TEST_MAKE:S,.,\\.,g},make,'
151# replace anything after 'stopped in' with unit-tests 151# replace anything after 'stopped in' with unit-tests
152_SED_CMDS+= -e '/stopped/s, /.*, unit-tests,' 152_SED_CMDS+= -e '/stopped/s, /.*, unit-tests,'
153# strip ${.CURDIR}/ from the output 153# strip ${.CURDIR}/ from the output
154_SED_CMDS+= -e 's,${.CURDIR:S,.,\\.,g}/,,g' 154_SED_CMDS+= -e 's,${.CURDIR:S,.,\\.,g}/,,g'
155_SED_CMDS+= -e 's,${UNIT_TESTS:S,.,\\.,g}/,,g' 155_SED_CMDS+= -e 's,${UNIT_TESTS:S,.,\\.,g}/,,g'
156 156
157.rawout.out: 157.rawout.out:
158 @echo postprocess ${.TARGET} 158 @echo postprocess ${.TARGET}
159 @${TOOL_SED} ${_SED_CMDS} ${SED_CMDS.${.TARGET:R}} \ 159 @${TOOL_SED} ${_SED_CMDS} ${SED_CMDS.${.TARGET:R}} \
160 < ${.IMPSRC} > ${.TARGET}.tmp1 160 < ${.IMPSRC} > ${.TARGET}.tmp1
161 @${POSTPROC.${.TARGET:R}:U${TOOL_SED}} < ${.TARGET}.tmp1 > ${.TARGET}.tmp2 161 @${POSTPROC.${.TARGET:R}:Ucat} < ${.TARGET}.tmp1 > ${.TARGET}.tmp2
162 @rm ${.TARGET}.tmp1 162 @rm ${.TARGET}.tmp1
163 @echo "exit status `cat ${.TARGET:R}.status`" >> ${.TARGET}.tmp2 163 @echo "exit status `cat ${.TARGET:R}.status`" >> ${.TARGET}.tmp2
164 @mv ${.TARGET}.tmp2 ${.TARGET} 164 @mv ${.TARGET}.tmp2 ${.TARGET}
165 165
166# Compare all output files 166# Compare all output files
167test: ${OUTFILES} .PHONY 167test: ${OUTFILES} .PHONY
168 @failed= ; \ 168 @failed= ; \
169 for test in ${TESTS}; do \ 169 for test in ${TESTS}; do \
170 diff -u ${UNIT_TESTS}/$${test}.exp $${test}.out \ 170 diff -u ${UNIT_TESTS}/$${test}.exp $${test}.out \
171 || failed="$${failed}$${failed:+ }$${test}" ; \ 171 || failed="$${failed}$${failed:+ }$${test}" ; \
172 done ; \ 172 done ; \
173 if [ -n "$${failed}" ]; then \ 173 if [ -n "$${failed}" ]; then \
174 echo "Failed tests: $${failed}" ; false ; \ 174 echo "Failed tests: $${failed}" ; false ; \