Module Name: src
Committed By: rillig
Date: Sun Oct 25 22:04:24 UTC 2020
Modified Files:
src/usr.bin/make/unit-tests: sh-dots.exp sh-dots.mk
Log Message:
make(1): add tests for generating the ... command indirectly
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/sh-dots.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/sh-dots.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/sh-dots.exp
diff -u src/usr.bin/make/unit-tests/sh-dots.exp:1.3 src/usr.bin/make/unit-tests/sh-dots.exp:1.4
--- src/usr.bin/make/unit-tests/sh-dots.exp:1.3 Sun Oct 18 18:12:42 2020
+++ src/usr.bin/make/unit-tests/sh-dots.exp Sun Oct 25 22:04:24 2020
@@ -9,7 +9,14 @@ commented commented
<normalized: ...: not found>
*** Error code 127 (ignored)
commented delayed commented
+indirect regular
+indirect-space regular
+...
+make: exec(...) failed (No such file or directory)
+*** Error code 1 (ignored)
+indirect-space deferred
first delayed first
repeated delayed repeated
repeated delayed twice repeated
+indirect deferred
exit status 0
Index: src/usr.bin/make/unit-tests/sh-dots.mk
diff -u src/usr.bin/make/unit-tests/sh-dots.mk:1.2 src/usr.bin/make/unit-tests/sh-dots.mk:1.3
--- src/usr.bin/make/unit-tests/sh-dots.mk:1.2 Sun Oct 18 18:12:42 2020
+++ src/usr.bin/make/unit-tests/sh-dots.mk Sun Oct 25 22:04:24 2020
@@ -1,4 +1,4 @@
-# $NetBSD: sh-dots.mk,v 1.2 2020/10/18 18:12:42 rillig Exp $
+# $NetBSD: sh-dots.mk,v 1.3 2020/10/25 22:04:24 rillig Exp $
#
# Tests for the special shell command line "...", which does not run the
# commands below it but appends them to the list of commands that are run
@@ -6,7 +6,7 @@
.MAKEFLAGS: -d0 # switch stdout to being line-buffered
-all: first hidden repeated commented
+all: first hidden repeated commented indirect indirect-space
# The ${.TARGET} correctly expands to the target name, even though the
# commands are run separately from the main commands.
@@ -29,6 +29,21 @@ commented: .IGNORE
... # Run the below commands later
@echo commented delayed ${.TARGET}
+# The dots don't have to be written literally, they can also come from a
+# variable expression.
+indirect:
+ @echo indirect regular
+ ${:U...}
+ @echo indirect deferred
+
+# If the dots are followed by a space, that space is part of the command and
+# thus does not defer the command below it.
+indirect-space: .IGNORE
+ @echo indirect-space regular
+ ${:U... }
+ @echo indirect-space deferred
+
+
# The "..." can appear more than once, even though that doesn't make sense.
# The second "..." is a no-op.
repeated: .IGNORE