Module Name: src
Committed By: rillig
Date: Tue Aug 27 05:01:03 UTC 2024
Modified Files:
src/usr.bin/make/unit-tests: var-recursive.exp var-recursive.mk
Log Message:
tests/make: add stricter checks to test for recursive variables
To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/var-recursive.exp
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/var-recursive.mk
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/unit-tests/var-recursive.exp
diff -u src/usr.bin/make/unit-tests/var-recursive.exp:1.11 src/usr.bin/make/unit-tests/var-recursive.exp:1.12
--- src/usr.bin/make/unit-tests/var-recursive.exp:1.11 Tue Aug 27 04:52:14 2024
+++ src/usr.bin/make/unit-tests/var-recursive.exp Tue Aug 27 05:01:03 2024
@@ -14,7 +14,7 @@ make: "var-recursive.mk" line 43: <>
make: Fatal errors encountered -- cannot continue
make: stopped making "loadtime" in unit-tests
sub-exit status 1
-: OK
+: before-recursive
make: in target "runtime": while evaluating variable "VAR" with value "${VAR}": Variable VAR is recursive.
sub-exit status 2
exit status 0
Index: src/usr.bin/make/unit-tests/var-recursive.mk
diff -u src/usr.bin/make/unit-tests/var-recursive.mk:1.8 src/usr.bin/make/unit-tests/var-recursive.mk:1.9
--- src/usr.bin/make/unit-tests/var-recursive.mk:1.8 Tue Aug 27 04:52:14 2024
+++ src/usr.bin/make/unit-tests/var-recursive.mk Tue Aug 27 05:01:03 2024
@@ -1,4 +1,4 @@
-# $NetBSD: var-recursive.mk,v 1.8 2024/08/27 04:52:14 rillig Exp $
+# $NetBSD: var-recursive.mk,v 1.9 2024/08/27 05:01:03 rillig Exp $
#
# Tests for expressions that refer to themselves and thus cannot be
# evaluated, as that would lead to an endless loop.
@@ -44,16 +44,16 @@ V= $V
.elif make(runtime)
-# If a recursive variable is accessed in a command of a target, the makefiles
-# have already been fully parsed, so there is no location information from the
-# .include and .for directives. In such a case, use the location of the last
-# command of the target to provide at least a hint to the location.
VAR= ${VAR}
runtime:
- : OK
+# expect: : before-recursive
+ : before-recursive
# expect: make: in target "runtime": while evaluating variable "VAR" with value "${VAR}": Variable VAR is recursive.
- : <${VAR}>
- : OK
+# expect-not: recursive-line-before
+# expect-not: recursive-line-after
+ : recursive-line-before <${VAR}> recursive-line-after
+# expect-not: after-recursive
+ : after-recursive
.else