Sun Jul 26 21:46:10 2020 UTC ()
make(1): add coverage test for dynamic = TRUE in Var_Parse


(rillig)
diff -r1.12 -r1.13 src/usr.bin/make/unit-tests/varmisc.exp
diff -r1.16 -r1.17 src/usr.bin/make/unit-tests/varmisc.mk

cvs diff -r1.12 -r1.13 src/usr.bin/make/unit-tests/varmisc.exp (expand / switch to unified diff)

--- src/usr.bin/make/unit-tests/varmisc.exp 2020/07/26 21:09:49 1.12
+++ src/usr.bin/make/unit-tests/varmisc.exp 2020/07/26 21:46:10 1.13
@@ -34,20 +34,22 @@ save-dollars: Yes = $$ @@ -34,20 +34,22 @@ save-dollars: Yes = $$
34save-dollars: No = $ 34save-dollars: No = $
35save-dollars: yes = $$ 35save-dollars: yes = $$
36save-dollars: no = $ 36save-dollars: no = $
37save-dollars: On = $$ 37save-dollars: On = $$
38save-dollars: Off = $ 38save-dollars: Off = $
39save-dollars: ON = $$ 39save-dollars: ON = $$
40save-dollars: OFF = $ 40save-dollars: OFF = $
41save-dollars: on = $$ 41save-dollars: on = $$
42save-dollars: off = $ 42save-dollars: off = $
43export-appended: env 43export-appended: env
44export-appended: env 44export-appended: env
45export-appended: env mk 45export-appended: env mk
46parse-dynamic: parse-dynamic parse-dynamic before 46parse-dynamic: parse-dynamic parse-dynamic before
 47parse-dynamic: parse-dynamic parse-dynamic after
 48parse-dynamic: parse-dynamic parse-dynamic after
47varerror-unclosed:begin 49varerror-unclosed:begin
48 50
49make: Unclosed variable specification (expecting '}') for "UNCLOSED" (value "") modifier M 51make: Unclosed variable specification (expecting '}') for "UNCLOSED" (value "") modifier M
50 52
51 53
52varerror-unclosed:end 54varerror-unclosed:end
53exit status 0 55exit status 0

cvs diff -r1.16 -r1.17 src/usr.bin/make/unit-tests/varmisc.mk (expand / switch to unified diff)

--- src/usr.bin/make/unit-tests/varmisc.mk 2020/07/26 21:09:49 1.16
+++ src/usr.bin/make/unit-tests/varmisc.mk 2020/07/26 21:46:10 1.17
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $Id: varmisc.mk,v 1.16 2020/07/26 21:09:49 rillig Exp $ 1# $Id: varmisc.mk,v 1.17 2020/07/26 21:46:10 rillig Exp $
2# 2#
3# Miscellaneous variable tests. 3# Miscellaneous variable tests.
4 4
5all: unmatched_var_paren D_true U_true D_false U_false Q_lhs Q_rhs NQ_none \ 5all: unmatched_var_paren D_true U_true D_false U_false Q_lhs Q_rhs NQ_none \
6 strftime cmpv manok 6 strftime cmpv manok
7all: save-dollars 7all: save-dollars
8all: export-appended 8all: export-appended
9all: parse-dynamic 9all: parse-dynamic
10all: varerror-unclosed 10all: varerror-unclosed
11 11
12unmatched_var_paren: 12unmatched_var_paren:
13 @echo ${foo::=foo-text} 13 @echo ${foo::=foo-text}
14 14
@@ -155,32 +155,47 @@ FROM_ENV_AFTER+= mk @@ -155,32 +155,47 @@ FROM_ENV_AFTER+= mk
155.export FROM_ENV_AFTER 155.export FROM_ENV_AFTER
156 156
157export-appended: 157export-appended:
158 @echo $@: "$$FROM_ENV" 158 @echo $@: "$$FROM_ENV"
159 @echo $@: "$$FROM_ENV_BEFORE" 159 @echo $@: "$$FROM_ENV_BEFORE"
160 @echo $@: "$$FROM_ENV_AFTER" 160 @echo $@: "$$FROM_ENV_AFTER"
161 161
162# begin parse-dynamic 162# begin parse-dynamic
163# 163#
164# Demonstrate that the target-specific variables are not evaluated in 164# Demonstrate that the target-specific variables are not evaluated in
165# the global context. They are preserved until there is a local context 165# the global context. They are preserved until there is a local context
166# in which resolving them makes sense. 166# in which resolving them makes sense.
167 167
 168# There are different code paths for short names ...
168${:U>}= before 169${:U>}= before
169G_TARGET:= $@ 170GS_TARGET:= $@
170G_MEMBER:= $% 171GS_MEMBER:= $%
171G_PREFIX:= $* 172GS_PREFIX:= $*
172G_ARCHIVE:= $! 173GS_ARCHIVE:= $!
173G_ALLSRC:= $> 174GS_ALLSRC:= $>
174${:U>}= after 175${:U>}= after
 176# ... and for braced short names ...
 177GB_TARGET:= ${@}
 178GB_MEMBER:= ${%}
 179GB_PREFIX:= ${*}
 180GB_ARCHIVE:= ${!}
 181GB_ALLSRC:= ${>}
 182# ... and for long names.
 183GL_TARGET:= ${.TARGET}
 184GL_MEMBER:= ${.MEMBER}
 185GL_PREFIX:= ${.PREFIX}
 186GL_ARCHIVE:= ${.ARCHIVE}
 187GL_ALLSRC:= ${.ALLSRC}
175 188
176parse-dynamic: 189parse-dynamic:
177 @echo $@: ${G_TARGET} ${G_MEMBER} ${G_PREFIX} ${G_ARCHIVE} ${G_ALLSRC} 190 @echo $@: ${GS_TARGET} ${GS_MEMBER} ${GS_PREFIX} ${GS_ARCHIVE} ${GS_ALLSRC}
 191 @echo $@: ${GB_TARGET} ${GB_MEMBER} ${GB_PREFIX} ${GB_ARCHIVE} ${GB_ALLSRC}
 192 @echo $@: ${GL_TARGET} ${GL_MEMBER} ${GL_PREFIX} ${GL_ARCHIVE} ${GL_ALLSRC}
178 193
179# As of 2020-07-26, make does not complain about unclosed variables. 194# As of 2020-07-26, make does not complain about unclosed variables.
180# It does complain about unclosed variables when parsing modifiers though. 195# It does complain about unclosed variables when parsing modifiers though.
181varerror-unclosed: 196varerror-unclosed:
182 @echo $@:begin 197 @echo $@:begin
183 @echo ${UNCLOSED 198 @echo ${UNCLOSED
184 @echo ${UNCLOSED:M${PATTERN 199 @echo ${UNCLOSED:M${PATTERN
185 @echo ${UNCLOSED.${param 200 @echo ${UNCLOSED.${param
186 @echo $@:end 201 @echo $@:end