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 tests/make: add test for the ':?' mo...
details: https://anonhg.NetBSD.org/src/rev/39ac81e57694
branches: trunk
changeset: 1019585:39ac81e57694
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Mar 14 19:16:41 2021 +0000
description:
tests/make: add test for the ':?' modifier in parse-only mode
The debug output for this scenario will change a bit in an upcoming
commit, but that will not affect anything outside the debug log.
diffstat:
usr.bin/make/unit-tests/var-eval-short.exp | 20 ++++++++++++++++++++
usr.bin/make/unit-tests/var-eval-short.mk | 20 +++++++++++++++++++-
2 files changed, 39 insertions(+), 1 deletions(-)
diffs (62 lines):
diff -r 7b53053b23f8 -r 39ac81e57694 usr.bin/make/unit-tests/var-eval-short.exp
--- a/usr.bin/make/unit-tests/var-eval-short.exp Sun Mar 14 18:30:24 2021 +0000
+++ b/usr.bin/make/unit-tests/var-eval-short.exp Sun Mar 14 19:16:41 2021 +0000
@@ -4,6 +4,26 @@
make: "var-eval-short.mk" line 63: Malformed conditional (0 && ${:Uword:gmtime=${FAIL}})
make: "var-eval-short.mk" line 77: Invalid time value: ${FAIL}}
make: "var-eval-short.mk" line 77: Malformed conditional (0 && ${:Uword:localtime=${FAIL}})
+CondParser_Eval: 0 && ${0:?${FAIL}then:${FAIL}else}
+Var_Parse: ${0:?${FAIL}then:${FAIL}else} with none
+Applying ${0:?...} to "" (none, none, undefined)
+Modifier part: "${FAIL}then"
+Modifier part: "${FAIL}else"
+Result of ${0:?${FAIL}then:${FAIL}else} is "${FAIL}else" (none, none, defined)
+ParseReadLine (141): 'DEFINED= defined'
+Global:DEFINED = defined
+CondParser_Eval: 0 && ${DEFINED:L:?${FAIL}then:${FAIL}else}
+Var_Parse: ${DEFINED:L:?${FAIL}then:${FAIL}else} with none
+Applying ${DEFINED:L} to "defined" (none, none, regular)
+Result of ${DEFINED:L} is "defined" (none, none, regular)
+Applying ${DEFINED:?...} to "defined" (none, none, regular)
+Modifier part: "${FAIL}then"
+Modifier part: "${FAIL}else"
+Result of ${DEFINED:?${FAIL}then:${FAIL}else} is "${FAIL}else" (none, none, regular)
+ParseReadLine (144): '.MAKEFLAGS: -d0'
+ParseDoDependency(.MAKEFLAGS: -d0)
+Global:.MAKEFLAGS = -r -k -d cpv -d
+Global:.MAKEFLAGS = -r -k -d cpv -d 0
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
diff -r 7b53053b23f8 -r 39ac81e57694 usr.bin/make/unit-tests/var-eval-short.mk
--- a/usr.bin/make/unit-tests/var-eval-short.mk Sun Mar 14 18:30:24 2021 +0000
+++ b/usr.bin/make/unit-tests/var-eval-short.mk Sun Mar 14 19:16:41 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: var-eval-short.mk,v 1.1 2021/03/14 11:49:37 rillig Exp $
+# $NetBSD: var-eval-short.mk,v 1.2 2021/03/14 19:16:41 rillig Exp $
#
# Tests for each variable modifier to ensure that they only do the minimum
# necessary computations. If the result of the expression is not needed, they
@@ -125,4 +125,22 @@
.if 0 && ${:Uword:word=replacement}
.endif
+# Before var.c 1.XXX from 2021-03-14, Var_Parse returned "${FAIL}else" for the
+# irrelevant right-hand side of the condition, even though this was not
+# necessary. Since the return value from Var_Parse is supposed to be ignored
+# anyway, and since it is actually ignored in an overly complicated way,
+# an empty string suffices.
+.MAKEFLAGS: -dcpv
+.if 0 && ${0:?${FAIL}then:${FAIL}else}
+.endif
+
+# The ':L' is applied before the ':?' modifier, giving the expression a name
+# and a value, just to see whether this value gets passed through or whether
+# the parse-only mode results in an empty string (only visible in the debug
+# log).
+DEFINED= defined
+.if 0 && ${DEFINED:L:?${FAIL}then:${FAIL}else}
+.endif
+.MAKEFLAGS: -d0
+
all:
Home |
Main Index |
Thread Index |
Old Index