summaryrefslogtreecommitdiff
path: root/usr.bin/make
diff options
context:
space:
mode:
authorrillig <rillig@NetBSD.org>2021-02-16 18:02:19 +0000
committerrillig <rillig@NetBSD.org>2021-02-16 18:02:19 +0000
commit69a90e2cc06e88f38ed842168670515b1663c55b (patch)
treee266f2a8022197d140b2fb409c6f01a16968a525 /usr.bin/make
parent1ddb17004c6024f737a0bf83d2411116e54e99ef (diff)
make: demonstrate inconsistency in .undef of an exported variable
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/unit-tests/directive-undef.exp1
-rw-r--r--usr.bin/make/unit-tests/directive-undef.mk21
2 files changed, 20 insertions, 2 deletions
diff --git a/usr.bin/make/unit-tests/directive-undef.exp b/usr.bin/make/unit-tests/directive-undef.exp
index d64cb8b5afe..bb3c7e5b47c 100644
--- a/usr.bin/make/unit-tests/directive-undef.exp
+++ b/usr.bin/make/unit-tests/directive-undef.exp
@@ -1,5 +1,6 @@
make: "directive-undef.mk" line 29: The .undef directive requires an argument
make: "directive-undef.mk" line 86: Unknown modifier 'Z'
+make: "directive-undef.mk" line 103: warning: UT_EXPORTED is still listed in .MAKE.EXPORTED even though spaceit is not exported anymore.
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
diff --git a/usr.bin/make/unit-tests/directive-undef.mk b/usr.bin/make/unit-tests/directive-undef.mk
index b9a69f73351..41ea6b5bf8f 100644
--- a/usr.bin/make/unit-tests/directive-undef.mk
+++ b/usr.bin/make/unit-tests/directive-undef.mk
@@ -1,4 +1,4 @@
-# $NetBSD: directive-undef.mk,v 1.9 2020/12/22 20:10:21 rillig Exp $
+# $NetBSD: directive-undef.mk,v 1.10 2021/02/16 18:02:19 rillig Exp $
#
# Tests for the .undef directive.
#
@@ -86,5 +86,22 @@ ${DOLLAR}= dollar
.undef ${VARNAMES:L:Z}
+UT_EXPORTED= exported-value
+.export UT_EXPORTED
+.if ${:!echo "\${UT_EXPORTED:-not-exported}"!} != "exported-value"
+. error
+.endif
+.if !${.MAKE.EXPORTED:MUT_EXPORTED}
+. error
+.endif
+.undef UT_EXPORTED # XXX: does not update .MAKE.EXPORTED
+.if ${:!echo "\${UT_EXPORTED:-not-exported}"!} != "not-exported"
+. error
+.endif
+.if ${.MAKE.EXPORTED:MUT_EXPORTED}
+. warning UT_EXPORTED is still listed in .MAKE.EXPORTED even though $\
+ it is not exported anymore.
+.endif
+
+
all:
- @:;