Module Name: src
Committed By: rillig
Date: Sun Aug 23 08:10:49 UTC 2020
Modified Files:
src/usr.bin/make/unit-tests: varmod-path.exp varmod-path.mk
Log Message:
make(1): add test for the :P variable modifier
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/varmod-path.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-path.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/varmod-path.exp
diff -u src/usr.bin/make/unit-tests/varmod-path.exp:1.1 src/usr.bin/make/unit-tests/varmod-path.exp:1.2
--- src/usr.bin/make/unit-tests/varmod-path.exp:1.1 Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/varmod-path.exp Sun Aug 23 08:10:49 2020
@@ -1 +1,4 @@
+varmod-path.subdir/varmod-path.phony
+varmod-path.subdir/varmod-path.real
+varmod-path.enoent
exit status 0
Index: src/usr.bin/make/unit-tests/varmod-path.mk
diff -u src/usr.bin/make/unit-tests/varmod-path.mk:1.2 src/usr.bin/make/unit-tests/varmod-path.mk:1.3
--- src/usr.bin/make/unit-tests/varmod-path.mk:1.2 Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/varmod-path.mk Sun Aug 23 08:10:49 2020
@@ -1,9 +1,35 @@
-# $NetBSD: varmod-path.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: varmod-path.mk,v 1.3 2020/08/23 08:10:49 rillig Exp $
#
# Tests for the :P variable modifier, which looks up the path for a given
# target.
+#
+# The phony target does not have a corresponding path, therefore ... oops,
+# as of 2020-08-23 it is nevertheless resolved to a path. This is probably
+# unintended.
+#
+# The real target is located in a subdirectory, and its full path is returned.
+# If it had been in the current directory, the difference between its path and
+# its name would not be visible.
+#
+# The enoent target does not exist, therefore the target name is returned.
+
+.MAIN: all
+
+_!= rm -rf varmod-path.subdir
+_!= mkdir varmod-path.subdir
+_!= > varmod-path.subdir/varmod-path.phony
+_!= > varmod-path.subdir/varmod-path.real
+
+# To have an effect, this .PATH declaration must be after the directory is created.
+.PATH: varmod-path.subdir
+
+varmod-path.phony: .PHONY
+varmod-path.real:
-# TODO: Implementation
+all: varmod-path.phony varmod-path.real
+ @echo ${varmod-path.phony:P}
+ @echo ${varmod-path.real:P}
+ @echo ${varmod-path.enoent:P}
-all:
- @:;
+.END:
+ @rm -rf varmod-path.subdir