From bbd77d9b59350b3f9eba285de034e8018ac88a63 Mon Sep 17 00:00:00 2001 From: sjg Date: Fri, 1 Mar 2024 20:15:59 +0000 Subject: [PATCH] make: update var-scope-local test Show what VAR value is in environment of target script. --- usr.bin/make/unit-tests/var-scope-local.exp | 7 +++++++ usr.bin/make/unit-tests/var-scope-local.mk | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/usr.bin/make/unit-tests/var-scope-local.exp b/usr.bin/make/unit-tests/var-scope-local.exp index c2e345d8fed8..c4a65d684176 100644 --- a/usr.bin/make/unit-tests/var-scope-local.exp +++ b/usr.bin/make/unit-tests/var-scope-local.exp @@ -61,11 +61,18 @@ dir/subdir/inference-rule-chain.ir-to: * = : Making var-scope-local.o from var-scope-local.c. : Making basename "var-scope-local.o" in "." from "var-scope-local.c" in ".". : Making var-scope-local-assign.o with VAR="local". +var-scope-local-assign.o env has VAR='local' : Making var-scope-local-append.o with VAR="local to var-scope-local-append.o". +var-scope-local-append.o env has VAR='local to var-scope-local-append.o' : Making var-scope-local-append-global.o with VAR="global+local". +var-scope-local-append-global.o env has VAR='global+local' : Making var-scope-local-default.o with VAR="global". +var-scope-local-default.o env has VAR='global' : Making var-scope-local-subst.o with VAR="global+local". +var-scope-local-subst.o env has VAR='global+local' : Making var-scope-local-shell.o with VAR="output". +var-scope-local-shell.o env has VAR='output' : var-scope-local-use.o uses .USE VAR="global" +var-scope-local-use.o env has VAR='global' : all overwritten exit status 0 diff --git a/usr.bin/make/unit-tests/var-scope-local.mk b/usr.bin/make/unit-tests/var-scope-local.mk index 5c4f5634b230..17dcb5344dcf 100644 --- a/usr.bin/make/unit-tests/var-scope-local.mk +++ b/usr.bin/make/unit-tests/var-scope-local.mk @@ -1,4 +1,4 @@ -# $NetBSD: var-scope-local.mk,v 1.9 2023/12/20 09:03:09 rillig Exp $ +# $NetBSD: var-scope-local.mk,v 1.10 2024/03/01 20:15:59 sjg Exp $ # # Tests for target-local variables, such as ${.TARGET} or $@. These variables # are relatively short-lived as they are created just before making the @@ -200,12 +200,14 @@ var-scope-local-default.o \ var-scope-local-subst.o \ var-scope-local-shell.o: : Making ${.TARGET} with VAR="${VAR}". + @echo "${.TARGET} env has VAR='$$VAR'" # Target-local variables are enabled by default. Force them to be enabled # just in case a test above has disabled them. .MAKE.TARGET_LOCAL_VARIABLES= yes VAR= global +.export VAR # If the sources of a dependency line look like a variable assignment, make # treats them as such. There is only a single variable assignment per @@ -264,6 +266,7 @@ var-scope-local-shell.o: VAR != echo output # expect: : var-scope-local-use.o uses .USE VAR="global" a_use: .USE VAR=use : ${.TARGET} uses .USE VAR="${VAR}" + @echo "${.TARGET} env has VAR='$$VAR'" all: var-scope-local-use.o var-scope-local-use.o: a_use