Module Name:    src
Committed By:   rillig
Date:           Mon Feb 13 21:01:46 UTC 2023

Modified Files:
        src/usr.bin/make/unit-tests: dep-var.exp dep-var.mk

Log Message:
tests/make: update test for evaluating undefined variables


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/dep-var.exp
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/dep-var.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/dep-var.exp
diff -u src/usr.bin/make/unit-tests/dep-var.exp:1.4 src/usr.bin/make/unit-tests/dep-var.exp:1.5
--- src/usr.bin/make/unit-tests/dep-var.exp:1.4	Tue Sep  8 05:26:22 2020
+++ src/usr.bin/make/unit-tests/dep-var.exp	Mon Feb 13 21:01:46 2023
@@ -1,3 +1,27 @@
+Var_Parse: ${UNDEF1} (eval-defined)
+Global: .ALLTARGETS =  all
+Global: .ALLTARGETS =  all ${DEF2}
+Global: .ALLTARGETS =  all ${DEF2} a-${DEF2}-b
+Global: .ALLTARGETS =  all ${DEF2} a-${DEF2}-b ${UNDEF3}
+Global: .ALLTARGETS =  all ${DEF2} a-${DEF2}-b ${UNDEF3} 1-${INDIRECT_1}-1
+Global: INDIRECT_1 = 2-$${INDIRECT_2}-2
+Global: INDIRECT_2 = 3-$${INDIRECT_3}-3
+Global: INDIRECT_3 = indirect
+Global: UNDEF1 = undef1
+Global: DEF2 = def2
+Global: .ALLTARGETS =  all ${DEF2} a-${DEF2}-b ${UNDEF3} 1-${INDIRECT_1}-1 $$)
+Var_Parse: ${:U\$)}: (eval-defined)
+Evaluating modifier ${:U...} on value "" (eval-defined, undefined)
+Result of ${:U\$)} is "$)" (eval-defined, defined)
+Global: .ALLTARGETS =  all ${DEF2} a-${DEF2}-b ${UNDEF3} 1-${INDIRECT_1}-1 $$) undef1
+Global: .ALLTARGETS =  all ${DEF2} a-${DEF2}-b ${UNDEF3} 1-${INDIRECT_1}-1 $$) undef1 def2
+Global: .ALLTARGETS =  all ${DEF2} a-${DEF2}-b ${UNDEF3} 1-${INDIRECT_1}-1 $$) undef1 def2 a-def2-b
+Var_Parse: $INDIRECT_2-2-1 $): (parse-only)
+Global: .ALLTARGETS =  all ${DEF2} a-${DEF2}-b ${UNDEF3} 1-${INDIRECT_1}-1 $$) undef1 def2 a-def2-b 1-2-$INDIRECT_2-2-1
+Var_Parse: $): (parse-only)
+Global: .ALLTARGETS =  all ${DEF2} a-${DEF2}-b ${UNDEF3} 1-${INDIRECT_1}-1 $$) undef1 def2 a-def2-b 1-2-$INDIRECT_2-2-1 $)
+Global: .MAKEFLAGS =  -r -k -d v -d
+Global: .MAKEFLAGS =  -r -k -d v -d 0
 make: Malformed variable expression at "$)"
 def2
 a-def2-b

Index: src/usr.bin/make/unit-tests/dep-var.mk
diff -u src/usr.bin/make/unit-tests/dep-var.mk:1.6 src/usr.bin/make/unit-tests/dep-var.mk:1.7
--- src/usr.bin/make/unit-tests/dep-var.mk:1.6	Sun Apr  4 10:13:09 2021
+++ src/usr.bin/make/unit-tests/dep-var.mk	Mon Feb 13 21:01:46 2023
@@ -1,14 +1,16 @@
-# $NetBSD: dep-var.mk,v 1.6 2021/04/04 10:13:09 rillig Exp $
+# $NetBSD: dep-var.mk,v 1.7 2023/02/13 21:01:46 rillig Exp $
 #
 # Tests for variable references in dependency declarations.
 #
 # Uh oh, this feels so strange that probably nobody uses it. But it seems to
 # be the only way to reach the lower half of SuffExpandChildren.
 
-# XXX: The -dv log says:
-#	Var_Parse: ${UNDEF1} with VARE_UNDEFERR|VARE_WANTRES
-# but no error message is generated for this line.
-# The variable expression ${UNDEF1} simply expands to an empty string.
+.MAKEFLAGS: -dv
+
+# expect: Var_Parse: ${UNDEF1} (eval-defined)
+# Even though undefined expressions should lead to errors, no error message is
+# generated for this line.  The variable expression ${UNDEF1} simply expands
+# to an empty string.
 all: ${UNDEF1}
 
 # Using a double dollar in order to circumvent immediate variable expansion
@@ -20,8 +22,8 @@ all: ${UNDEF1}
 all: $${DEF2} a-$${DEF2}-b
 
 # This variable is not defined at all.
-# XXX: The -dv log says:
-#	Var_Parse: ${UNDEF3} with VARE_UNDEFERR|VARE_WANTRES
+# XXX: The -dv log says later when expanding the sources of 'all':
+#	Var_Parse: ${UNDEF3} (eval-defined)
 # but no error message is generated for this line, just like for UNDEF1.
 # The variable expression ${UNDEF3} simply expands to an empty string.
 all: $${UNDEF3}
@@ -81,8 +83,13 @@ all: $$$$)
 # Since 2020-09-13, this generates a parse error in lint mode (-dL), but not
 # in normal mode since ParseDependency does not handle any errors after
 # calling Var_Parse.
+# expect: Var_Parse: ${:U\$)}: (eval-defined)
+# expect: Var_Parse: $INDIRECT_2-2-1 $): (parse-only)
+# expect: Var_Parse: $): (parse-only)
 undef1 def2 a-def2-b 1-2-$$INDIRECT_2-2-1 ${:U\$)}:
 	@echo ${.TARGET:Q}
 
+.MAKEFLAGS: -d0
+
 # XXX: Why is the exit status still 0, even though Parse_Error is called
 # with PARSE_FATAL in SuffExpandChildren?

Reply via email to