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: update test for evaluati...



details:   https://anonhg.NetBSD.org/src/rev/e6162700a6d7
branches:  trunk
changeset: 373500:e6162700a6d7
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Feb 13 21:01:46 2023 +0000

description:
tests/make: update test for evaluating undefined variables

diffstat:

 usr.bin/make/unit-tests/dep-var.exp |  24 ++++++++++++++++++++++++
 usr.bin/make/unit-tests/dep-var.mk  |  21 ++++++++++++++-------
 2 files changed, 38 insertions(+), 7 deletions(-)

diffs (81 lines):

diff -r feebcb789ecb -r e6162700a6d7 usr.bin/make/unit-tests/dep-var.exp
--- a/usr.bin/make/unit-tests/dep-var.exp       Mon Feb 13 19:25:15 2023 +0000
+++ b/usr.bin/make/unit-tests/dep-var.exp       Mon Feb 13 21:01:46 2023 +0000
@@ -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
diff -r feebcb789ecb -r e6162700a6d7 usr.bin/make/unit-tests/dep-var.mk
--- a/usr.bin/make/unit-tests/dep-var.mk        Mon Feb 13 19:25:15 2023 +0000
+++ b/usr.bin/make/unit-tests/dep-var.mk        Mon Feb 13 21:01:46 2023 +0000
@@ -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: $${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 @@
 # 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?



Home | Main Index | Thread Index | Old Index