Module Name:    src
Committed By:   rillig
Date:           Sun Aug  9 12:59:16 UTC 2020

Modified Files:
        src/distrib/sets/lists/tests: mi
        src/usr.bin/make/unit-tests: Makefile
Added Files:
        src/usr.bin/make/unit-tests: make-exported.exp make-exported.mk

Log Message:
make(1): add test for non-obvious .MAKE.EXPORTED edge case


To generate a diff of this commit:
cvs rdiff -u -r1.886 -r1.887 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.89 -r1.90 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/make-exported.exp \
    src/usr.bin/make/unit-tests/make-exported.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.886 src/distrib/sets/lists/tests/mi:1.887
--- src/distrib/sets/lists/tests/mi:1.886	Fri Aug  7 19:24:27 2020
+++ src/distrib/sets/lists/tests/mi	Sun Aug  9 12:59:16 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.886 2020/08/07 19:24:27 rillig Exp $
+# $NetBSD: mi,v 1.887 2020/08/09 12:59:16 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4576,6 +4576,8 @@
 ./usr/tests/usr.bin/make/unit-tests/include-subsub.mk	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/lint.exp	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/lint.mk	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/make-exported.exp	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/make-exported.mk	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/misc.exp	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/misc.mk	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/moderrs.exp	tests-usr.bin-tests	compattestfile,atf

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.89 src/usr.bin/make/unit-tests/Makefile:1.90
--- src/usr.bin/make/unit-tests/Makefile:1.89	Fri Aug  7 19:24:27 2020
+++ src/usr.bin/make/unit-tests/Makefile	Sun Aug  9 12:59:16 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.89 2020/08/07 19:24:27 rillig Exp $
+# $NetBSD: Makefile,v 1.90 2020/08/09 12:59:16 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -59,6 +59,7 @@ TESTS+=		hash
 TESTS+=		impsrc
 TESTS+=		include-main
 TESTS+=		lint
+TESTS+=		make-exported
 TESTS+=		misc
 TESTS+=		moderrs
 TESTS+=		modmatch
@@ -93,6 +94,7 @@ ENV.envfirst=		FROM_ENV=value-from-env
 ENV.export=		-i PATH=${PATH:Q}
 ENV.export-variants=	-i PATH=${PATH:Q}
 ENV.lint=		-i
+ENV.make-exported=	-i PATH=${PATH:Q}
 ENV.recursive=		-i
 ENV.varmisc=		FROM_ENV=env
 ENV.varmisc+=		FROM_ENV_BEFORE=env

Added files:

Index: src/usr.bin/make/unit-tests/make-exported.exp
diff -u /dev/null src/usr.bin/make/unit-tests/make-exported.exp:1.1
--- /dev/null	Sun Aug  9 12:59:16 2020
+++ src/usr.bin/make/unit-tests/make-exported.exp	Sun Aug  9 12:59:16 2020
@@ -0,0 +1,3 @@
+-literal=make-exported-value
+UT_VAR=
+exit status 0
Index: src/usr.bin/make/unit-tests/make-exported.mk
diff -u /dev/null src/usr.bin/make/unit-tests/make-exported.mk:1.1
--- /dev/null	Sun Aug  9 12:59:16 2020
+++ src/usr.bin/make/unit-tests/make-exported.mk	Sun Aug  9 12:59:16 2020
@@ -0,0 +1,16 @@
+# $NetBSD: make-exported.mk,v 1.1 2020/08/09 12:59:16 rillig Exp $
+#
+# As of 2020-08-09, the code in Var_Export is shared between the .export
+# directive and the .MAKE.EXPORTED variable.  This leads to non-obvious
+# behavior for certain variable assignments.
+
+-env=		make-exported-value
+-literal=	make-exported-value
+UT_VAR=		${UNEXPANDED}
+
+# The following behavior is probably not intended.
+.MAKE.EXPORTED=		-env		# like .export-env
+.MAKE.EXPORTED=		-literal UT_VAR	# like .export-literal PATH
+
+all:
+	@env | sort | grep -E '^UT_|make-exported-value' || true

Reply via email to