Module Name: src Committed By: rillig Date: Sat Aug 22 11:27:02 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: sh-dots.exp sh-dots.mk Log Message: make(1): add test for the special "..." in shell commands To generate a diff of this commit: cvs rdiff -u -r1.897 -r1.898 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.105 -r1.106 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/sh-dots.exp \ 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/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.897 src/distrib/sets/lists/tests/mi:1.898 --- src/distrib/sets/lists/tests/mi:1.897 Sat Aug 22 08:29:13 2020 +++ src/distrib/sets/lists/tests/mi Sat Aug 22 11:27:02 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.897 2020/08/22 08:29:13 rillig Exp $ +# $NetBSD: mi,v 1.898 2020/08/22 11:27:02 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -4839,6 +4839,8 @@ ./usr/tests/usr.bin/make/unit-tests/qequals.mk tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/recursive.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/recursive.mk tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/sh-dots.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/sh-dots.mk tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/sh-jobs-error.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/sh-jobs-error.mk tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/sh-jobs.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.105 src/usr.bin/make/unit-tests/Makefile:1.106 --- src/usr.bin/make/unit-tests/Makefile:1.105 Sat Aug 22 08:29:13 2020 +++ src/usr.bin/make/unit-tests/Makefile Sat Aug 22 11:27:02 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.105 2020/08/22 08:29:13 rillig Exp $ +# $NetBSD: Makefile,v 1.106 2020/08/22 11:27:02 rillig Exp $ # # Unit tests for make(1) # @@ -187,6 +187,7 @@ TESTS+= # posix1 # broken by reverting TESTS+= qequals TESTS+= recursive TESTS+= sh +TESTS+= sh-dots TESTS+= sh-jobs TESTS+= sh-jobs-error TESTS+= sh-leading-at Added files: Index: src/usr.bin/make/unit-tests/sh-dots.exp diff -u /dev/null src/usr.bin/make/unit-tests/sh-dots.exp:1.1 --- /dev/null Sat Aug 22 11:27:02 2020 +++ src/usr.bin/make/unit-tests/sh-dots.exp Sat Aug 22 11:27:02 2020 @@ -0,0 +1,15 @@ +first first +hidden hidden +make: exec(...) failed (No such file or directory) +hidden delayed hidden +repeated repeated +commented commented +*** Error code 1 (ignored) +... # Run the below commands later +...: not found +commented delayed commented +first delayed first +repeated delayed repeated +repeated delayed twice repeated +*** Error code 127 (ignored) +exit status 0 Index: src/usr.bin/make/unit-tests/sh-dots.mk diff -u /dev/null src/usr.bin/make/unit-tests/sh-dots.mk:1.1 --- /dev/null Sat Aug 22 11:27:02 2020 +++ src/usr.bin/make/unit-tests/sh-dots.mk Sat Aug 22 11:27:02 2020 @@ -0,0 +1,37 @@ +# $NetBSD: sh-dots.mk,v 1.1 2020/08/22 11:27:02 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 +# at the end. + +all: first hidden repeated commented + +# The ${.TARGET} correctly expands to the target name, even though the +# commands are run separately from the main commands. +first: + @echo first ${.TARGET} + ... + @echo first delayed ${.TARGET} + +# The dots cannot be prefixed by the usual @-+ characters. +# They must be written exactly as dots. +hidden: .IGNORE + @echo hidden ${.TARGET} + @... + @echo hidden delayed ${.TARGET} + +# Since the shell command lines don't recognize '#' as comment character, +# the "..." is not interpreted specially here. +commented: .IGNORE + @echo commented ${.TARGET} + ... # Run the below commands later + @echo commented delayed ${.TARGET} + +# The "..." can appear more than once, even though that doesn't make sense. +# The second "..." is a no-op. +repeated: .IGNORE + @echo repeated ${.TARGET} + ... + @echo repeated delayed ${.TARGET} + ... + @echo repeated delayed twice ${.TARGET}