Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make/unit-tests make(1): demonstrate how to append t...



details:   https://anonhg.NetBSD.org/src/rev/26522533c3c0
branches:  trunk
changeset: 977647:26522533c3c0
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Oct 30 15:09:13 2020 +0000

description:
make(1): demonstrate how to append to a read-only variable

diffstat:

 usr.bin/make/unit-tests/varname-dot-shell.exp |  21 ++++++++++++++-------
 usr.bin/make/unit-tests/varname-dot-shell.mk  |  11 +++++++++--
 2 files changed, 23 insertions(+), 9 deletions(-)

diffs (63 lines):

diff -r f06101f6f87b -r 26522533c3c0 usr.bin/make/unit-tests/varname-dot-shell.exp
--- a/usr.bin/make/unit-tests/varname-dot-shell.exp     Fri Oct 30 15:03:58 2020 +0000
+++ b/usr.bin/make/unit-tests/varname-dot-shell.exp     Fri Oct 30 15:09:13 2020 +0000
@@ -10,15 +10,22 @@
 Var_Parse: ${.SHELL} != ${ORIG_SHELL} with VARE_UNDEFERR|VARE_WANTRES
 Var_Parse: ${ORIG_SHELL} with VARE_UNDEFERR|VARE_WANTRES
 lhs = "(details omitted)", rhs = "(details omitted)", op = !=
-ParseReadLine (20): '.undef .SHELL'
+ParseReadLine (19): '.MAKEFLAGS: .SHELL+=appended'
+ParseDoDependency(.MAKEFLAGS: .SHELL+=appended)
+Command:.SHELL = (details omitted) appended
+CondParser_Eval: ${.SHELL} != "${ORIG_SHELL} appended"
+Var_Parse: ${.SHELL} != "${ORIG_SHELL} appended" with VARE_UNDEFERR|VARE_WANTRES
+Var_Parse: ${ORIG_SHELL} appended" with VARE_WANTRES
+lhs = "/bin/sh appended", rhs = "/bin/sh appended", op = !=
+ParseReadLine (27): '.undef .SHELL'
 Global:delete .SHELL
-ParseReadLine (21): '.SHELL=           newly overwritten'
+ParseReadLine (28): '.SHELL=           newly overwritten'
 Global:.SHELL = newly overwritten
-CondParser_Eval: ${.SHELL} != ${ORIG_SHELL}
-Var_Parse: ${.SHELL} != ${ORIG_SHELL} with VARE_UNDEFERR|VARE_WANTRES
-Var_Parse: ${ORIG_SHELL} with VARE_UNDEFERR|VARE_WANTRES
-lhs = "(details omitted)", rhs = "(details omitted)", op = !=
-ParseReadLine (26): '.MAKEFLAGS: -d0'
+CondParser_Eval: ${.SHELL} != "${ORIG_SHELL} appended"
+Var_Parse: ${.SHELL} != "${ORIG_SHELL} appended" with VARE_UNDEFERR|VARE_WANTRES
+Var_Parse: ${ORIG_SHELL} appended" with VARE_WANTRES
+lhs = "/bin/sh appended", rhs = "/bin/sh appended", op = !=
+ParseReadLine (33): '.MAKEFLAGS: -d0'
 ParseDoDependency(.MAKEFLAGS: -d0)
 Global:.MAKEFLAGS =  -r -k -d cpv -d
 Global:.MAKEFLAGS =  -r -k -d cpv -d 0
diff -r f06101f6f87b -r 26522533c3c0 usr.bin/make/unit-tests/varname-dot-shell.mk
--- a/usr.bin/make/unit-tests/varname-dot-shell.mk      Fri Oct 30 15:03:58 2020 +0000
+++ b/usr.bin/make/unit-tests/varname-dot-shell.mk      Fri Oct 30 15:09:13 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: varname-dot-shell.mk,v 1.4 2020/10/30 15:03:58 rillig Exp $
+# $NetBSD: varname-dot-shell.mk,v 1.5 2020/10/30 15:09:13 rillig Exp $
 #
 # Tests for the special .SHELL variable, which contains the shell used for
 # running the commands.
@@ -14,12 +14,19 @@
 .  error
 .endif
 
+# Trying to append to the variable.
+# Until 2020-10-30 this was possible.
+.MAKEFLAGS: .SHELL+=appended
+.if ${.SHELL} != "${ORIG_SHELL} appended"
+.  error
+.endif
+
 # Trying to delete the variable.
 # This has no effect since the variable is not defined in the global context,
 # but in the command-line context.
 .undef .SHELL
 .SHELL=                newly overwritten
-.if ${.SHELL} != ${ORIG_SHELL}
+.if ${.SHELL} != "${ORIG_SHELL} appended"
 .  error
 .endif
 



Home | Main Index | Thread Index | Old Index