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): add test for recursion dete...
details: https://anonhg.NetBSD.org/src/rev/55082e3eedaf
branches: trunk
changeset: 945498:55082e3eedaf
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Oct 31 13:45:00 2020 +0000
description:
make(1): add test for recursion detection with short variable names
diffstat:
usr.bin/make/unit-tests/var-recursive.exp | 3 +++
usr.bin/make/unit-tests/var-recursive.mk | 12 ++++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diffs (41 lines):
diff -r 4dcd66874c00 -r 55082e3eedaf usr.bin/make/unit-tests/var-recursive.exp
--- a/usr.bin/make/unit-tests/var-recursive.exp Sat Oct 31 13:28:22 2020 +0000
+++ b/usr.bin/make/unit-tests/var-recursive.exp Sat Oct 31 13:45:00 2020 +0000
@@ -6,4 +6,7 @@
make: stopped in unit-tests
make: "var-recursive.mk" line 35: ok
+Variable V is recursive.
+
+make: stopped in unit-tests
exit status 0
diff -r 4dcd66874c00 -r 55082e3eedaf usr.bin/make/unit-tests/var-recursive.mk
--- a/usr.bin/make/unit-tests/var-recursive.mk Sat Oct 31 13:28:22 2020 +0000
+++ b/usr.bin/make/unit-tests/var-recursive.mk Sat Oct 31 13:45:00 2020 +0000
@@ -1,9 +1,9 @@
-# $NetBSD: var-recursive.mk,v 1.1 2020/10/31 11:30:57 rillig Exp $
+# $NetBSD: var-recursive.mk,v 1.2 2020/10/31 13:45:00 rillig Exp $
#
# Tests for variable expressions that refer to themselves and thus
# cannot be evaluated.
-TESTS= direct indirect conditional
+TESTS= direct indirect conditional short
# Since make exits immediately when it detects a recursive expression,
# the actual tests are run in sub-makes.
@@ -34,6 +34,14 @@
CONDITIONAL= ${1:?ok:${CONDITIONAL}}
. info ${CONDITIONAL}
+.elif ${TEST} == short
+
+# Short variable names can be expanded using the short-hand $V notation,
+# which takes a different code path in Var_Parse for parsing the variable
+# name. Ensure that these are checked as well.
+V= $V
+. info $V
+
.else
. error Unknown test "${TEST}"
.endif
Home |
Main Index |
Thread Index |
Old Index