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: extend test for target-l...



details:   https://anonhg.NetBSD.org/src/rev/ca9c45fc48de
branches:  trunk
changeset: 374515:ca9c45fc48de
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Apr 29 10:16:24 2023 +0000

description:
tests/make: extend test for target-local variables

diffstat:

 usr.bin/make/unit-tests/var-scope-local.exp |  14 ++++++++++++--
 usr.bin/make/unit-tests/var-scope-local.mk  |  24 +++++++++++++++++++++++-
 2 files changed, 35 insertions(+), 3 deletions(-)

diffs (80 lines):

diff -r b12a96528e3f -r ca9c45fc48de usr.bin/make/unit-tests/var-scope-local.exp
--- a/usr.bin/make/unit-tests/var-scope-local.exp       Sat Apr 29 10:07:30 2023 +0000
+++ b/usr.bin/make/unit-tests/var-scope-local.exp       Sat Apr 29 10:16:24 2023 +0000
@@ -1,5 +1,5 @@
-Global: .ALLTARGETS =  all target-rule.ext dir/subdir/target-rule.ext inference-rule.ir-to dir/subdir/inference-rule.ir-to inference-rule.ir-from dir/subdir/inference-rule.ir-from 
inference-rule-chain.ir-to dir/subdir/inference-rule-chain.ir-to inference-rule-chain.ir-gen-from dir/subdir/inference-rule-chain.ir-gen-from one
-Global: .ALLTARGETS =  all target-rule.ext dir/subdir/target-rule.ext inference-rule.ir-to dir/subdir/inference-rule.ir-to inference-rule.ir-from dir/subdir/inference-rule.ir-from 
inference-rule-chain.ir-to dir/subdir/inference-rule-chain.ir-to inference-rule-chain.ir-gen-from dir/subdir/inference-rule-chain.ir-gen-from one two
+Global: .ALLTARGETS =  all target-rule.ext dir/subdir/target-rule.ext target-rule.ir-gen-from dir/subdir/target-rule-dir.ir-gen-from inference-rule.ir-to dir/subdir/inference-rule.ir-to 
inference-rule.ir-from dir/subdir/inference-rule.ir-from inference-rule-chain.ir-to dir/subdir/inference-rule-chain.ir-to inference-rule-chain.ir-gen-from dir/subdir/inference-rule-chain.ir-gen-from 
one
+Global: .ALLTARGETS =  all target-rule.ext dir/subdir/target-rule.ext target-rule.ir-gen-from dir/subdir/target-rule-dir.ir-gen-from inference-rule.ir-to dir/subdir/inference-rule.ir-to 
inference-rule.ir-from dir/subdir/inference-rule.ir-from inference-rule-chain.ir-to dir/subdir/inference-rule-chain.ir-to inference-rule-chain.ir-gen-from dir/subdir/inference-rule-chain.ir-gen-from 
one two
 Var_Parse: ${.MAKE.TARGET_LOCAL_VARIABLES} (eval)
 Var_SetExpand: variable name "" expands to empty string, with value "three" - ignored
 Var_SetExpand: variable name "" expands to empty string, with value "three" - ignored
@@ -17,6 +17,16 @@ dir/subdir/target-rule.ext: % = <undefin
 dir/subdir/target-rule.ext: ? = <>
 dir/subdir/target-rule.ext: < = <undefined>
 dir/subdir/target-rule.ext: * = <dir/subdir/target-rule.ext>
+target-rule.ir-gen-from: @ = <target-rule.ir-gen-from>
+target-rule.ir-gen-from: % = <undefined>
+target-rule.ir-gen-from: ? = <>
+target-rule.ir-gen-from: < = <undefined>
+target-rule.ir-gen-from: * = <target-rule>
+dir/subdir/target-rule-dir.ir-gen-from: @ = <dir/subdir/target-rule-dir.ir-gen-from>
+dir/subdir/target-rule-dir.ir-gen-from: % = <undefined>
+dir/subdir/target-rule-dir.ir-gen-from: ? = <>
+dir/subdir/target-rule-dir.ir-gen-from: < = <undefined>
+dir/subdir/target-rule-dir.ir-gen-from: * = <dir/subdir/target-rule-dir>
 inference-rule.ir-to: @ = <inference-rule.ir-to>
 inference-rule.ir-to: % = <undefined>
 inference-rule.ir-to: ? = <inference-rule.ir-from>
diff -r b12a96528e3f -r ca9c45fc48de usr.bin/make/unit-tests/var-scope-local.mk
--- a/usr.bin/make/unit-tests/var-scope-local.mk        Sat Apr 29 10:07:30 2023 +0000
+++ b/usr.bin/make/unit-tests/var-scope-local.mk        Sat Apr 29 10:16:24 2023 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: var-scope-local.mk,v 1.6 2023/04/28 13:09:48 rillig Exp $
+# $NetBSD: var-scope-local.mk,v 1.7 2023/04/29 10:16:24 rillig Exp $
 #
 # Tests for target-local variables, such as ${.TARGET} or $@.  These variables
 # are relatively short-lived as they are created just before making the
@@ -13,6 +13,11 @@
 .MAIN: all
 
 # Target-local variables in a target rule
+#
+# In target rules, '$*' only strips the extension off the pathname if the
+# extension is listed in '.SUFFIXES'.
+#
+# expect: target-rule.ext: * = <target-rule.ext>
 all: target-rule.ext dir/subdir/target-rule.ext
 target-rule.ext dir/subdir/target-rule.ext: .PHONY
        @echo '$@: @ = <${@:Uundefined}>'
@@ -22,6 +27,19 @@ target-rule.ext dir/subdir/target-rule.e
        @echo '$@: * = <${*:Uundefined}>'
 
 .SUFFIXES: .ir-gen-from .ir-from .ir-to
+
+# In target rules, '$*' strips the extension off the pathname of the target
+# if the extension is listed in '.SUFFIXES'.
+#
+# expect: target-rule.ir-gen-from: * = <target-rule>
+all: target-rule.ir-gen-from dir/subdir/target-rule-dir.ir-gen-from
+target-rule.ir-gen-from dir/subdir/target-rule-dir.ir-gen-from:
+       @echo '$@: @ = <${@:Uundefined}>'
+       @echo '$@: % = <${%:Uundefined}>'
+       @echo '$@: ? = <${?:Uundefined}>'
+       @echo '$@: < = <${<:Uundefined}>'
+       @echo '$@: * = <${*:Uundefined}>'
+
 .ir-from.ir-to:
        @echo '$@: @ = <${@:Uundefined}>'
        @echo '$@: % = <${%:Uundefined}>'
@@ -45,6 +63,10 @@ all: inference-rule-chain.ir-to dir/subd
 inference-rule-chain.ir-gen-from: .PHONY
 dir/subdir/inference-rule-chain.ir-gen-from: .PHONY
 
+# The run-time 'check' directives from above happen after the parse-time
+# 'check' directives from below.
+#
+# expect-reset
 
 # Deferred evaluation during parsing
 #



Home | Main Index | Thread Index | Old Index