summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2002-06-19 18:57:04 +0000
committerjmallett <jmallett@FreeBSD.org>2002-06-19 18:57:04 +0000
commit0aad4a7f96851b06b7407e975d2cd23190e57ab9 (patch)
tree5297262e6d190edd8151bbe7c40dd566e9dce872 /tools
parentf27248e5ba91fe3e6b2dbd676475ecb826ee7b24 (diff)
downloadFreeBSD-src-0aad4a7f96851b06b7407e975d2cd23190e57ab9.zip
FreeBSD-src-0aad4a7f96851b06b7407e975d2cd23190e57ab9.tar.gz
Add a test for what was fixed in revision 1.27 and 1.28 of make(1)'s var.c,
expansion of embedded variables in the left-hand-side of an assignment expression, using the simplest case - hiding recursion using nil-expanded variables.
Diffstat (limited to 'tools')
-rw-r--r--tools/build/make_check/Makefile17
-rw-r--r--tools/regression/usr.bin/make/Makefile17
2 files changed, 34 insertions, 0 deletions
diff --git a/tools/build/make_check/Makefile b/tools/build/make_check/Makefile
index 14708b3..f92febc 100644
--- a/tools/build/make_check/Makefile
+++ b/tools/build/make_check/Makefile
@@ -1,5 +1,13 @@
# $FreeBSD$
+# Test for broken LHS expansion.
+# This *must* case make(1) to detect a recursive variable, and fail as such.
+.if make(lhs_expn)
+FOO= ${BAR}
+BAR${NIL}= ${FOO}
+FOO${BAR}= ${FOO}
+.endif
+
DATA1= helllo
DATA2:= ${DATA1}
DATA3= ${DATA2:S/ll/rr/g}
@@ -21,6 +29,9 @@ all:
@echo "Running test sysvmatch"
@${MAKE} sysvmatch || ${MAKE} failure
@echo "PASS: Test sysvmatch detected no regression."
+ @echo "Running test lhs_expn"
+ @${MAKE} lhs_expn || ${MAKE} failure
+ @echo "PASS: Test lhs_expn detected no regression."
# Doubly-defined targets. NetBSD make(1) will warn, ours will silently use the
# ``right'' one.
@@ -35,6 +46,12 @@ sysvmatch:
@echo EMPTY ${NIL:=foo} LHS | \
diff -u ${.CURDIR}/regress.sysvmatch.out - || false
+# A bogus target for the lhs_expn test; If this is reached, then the make(1)
+# program has not errored out because of the recursion caused by not expanding
+# the left-hand-side's embedded variables above.
+lhs_expn:
+ @false
+
failure:
@echo "FAIL: Test failed: regression detected. See above."
@false
diff --git a/tools/regression/usr.bin/make/Makefile b/tools/regression/usr.bin/make/Makefile
index 14708b3..f92febc 100644
--- a/tools/regression/usr.bin/make/Makefile
+++ b/tools/regression/usr.bin/make/Makefile
@@ -1,5 +1,13 @@
# $FreeBSD$
+# Test for broken LHS expansion.
+# This *must* case make(1) to detect a recursive variable, and fail as such.
+.if make(lhs_expn)
+FOO= ${BAR}
+BAR${NIL}= ${FOO}
+FOO${BAR}= ${FOO}
+.endif
+
DATA1= helllo
DATA2:= ${DATA1}
DATA3= ${DATA2:S/ll/rr/g}
@@ -21,6 +29,9 @@ all:
@echo "Running test sysvmatch"
@${MAKE} sysvmatch || ${MAKE} failure
@echo "PASS: Test sysvmatch detected no regression."
+ @echo "Running test lhs_expn"
+ @${MAKE} lhs_expn || ${MAKE} failure
+ @echo "PASS: Test lhs_expn detected no regression."
# Doubly-defined targets. NetBSD make(1) will warn, ours will silently use the
# ``right'' one.
@@ -35,6 +46,12 @@ sysvmatch:
@echo EMPTY ${NIL:=foo} LHS | \
diff -u ${.CURDIR}/regress.sysvmatch.out - || false
+# A bogus target for the lhs_expn test; If this is reached, then the make(1)
+# program has not errored out because of the recursion caused by not expanding
+# the left-hand-side's embedded variables above.
+lhs_expn:
+ @false
+
failure:
@echo "FAIL: Test failed: regression detected. See above."
@false
OpenPOWER on IntegriCloud