Tue Jul 28 16:26:37 2020 UTC ()
Ensure .CURDIR is correct for tests that run sub-makes


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

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

--- src/usr.bin/make/unit-tests/Makefile 2020/07/28 16:11:55 1.72
+++ src/usr.bin/make/unit-tests/Makefile 2020/07/28 16:26:37 1.73
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: Makefile,v 1.72 2020/07/28 16:11:55 rillig Exp $ 1# $NetBSD: Makefile,v 1.73 2020/07/28 16:26:37 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
@@ -126,27 +126,27 @@ TEST_MAKE?= ${.MAKE} @@ -126,27 +126,27 @@ TEST_MAKE?= ${.MAKE}
126TOOL_SED?= sed 126TOOL_SED?= sed
127 127
128# ensure consistent results from sort(1) 128# ensure consistent results from sort(1)
129LC_ALL= C 129LC_ALL= C
130LANG= C 130LANG= C
131.export LANG LC_ALL 131.export LANG LC_ALL
132 132
133# the tests are actually done with sub-makes. 133# the tests are actually done with sub-makes.
134.SUFFIXES: .mk .rawout .out 134.SUFFIXES: .mk .rawout .out
135.mk.rawout: 135.mk.rawout:
136 @echo testing ${.IMPSRC} 136 @echo testing ${.IMPSRC}
137 @set -eu; \ 137 @set -eu; \
138 cd ${.OBJDIR}; \ 138 cd ${.OBJDIR}; \
139 env ${ENV.${.TARGET:R}} ${TEST_MAKE} \ 139 env ${ENV.${.TARGET:R}} ${TEST_MAKE} -C ${.CURDIR} \
140 ${FLAGS.${.TARGET:R}:U-k} -f ${.IMPSRC} \ 140 ${FLAGS.${.TARGET:R}:U-k} -f ${.IMPSRC} \
141 > ${.TARGET}.tmp 2>&1 \ 141 > ${.TARGET}.tmp 2>&1 \
142 && status=$$? || status=$$?; \ 142 && status=$$? || status=$$?; \
143 echo $$status > ${.TARGET:R}.status 143 echo $$status > ${.TARGET:R}.status
144 @mv ${.TARGET}.tmp ${.TARGET} 144 @mv ${.TARGET}.tmp ${.TARGET}
145 145
146# Post-process the test output so that the results can be compared. 146# Post-process the test output so that the results can be compared.
147# 147#
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,'