Module Name: src Committed By: rillig Date: Thu Jan 19 19:55:28 UTC 2023
Modified Files: src/usr.bin/make: test-variants.mk src/usr.bin/make/unit-tests: Makefile sh-leading-at.exp sh-leading-at.mk sh-leading-hyphen.exp sh-leading-hyphen.mk sh-leading-plus.exp sh-leading-plus.mk Log Message: tests/make: add tests for whitespace in leading '@+-' To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/test-variants.mk cvs rdiff -u -r1.327 -r1.328 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/sh-leading-at.exp \ src/usr.bin/make/unit-tests/sh-leading-hyphen.mk cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/sh-leading-at.mk cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/sh-leading-hyphen.exp cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/sh-leading-plus.exp cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/sh-leading-plus.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/test-variants.mk diff -u src/usr.bin/make/test-variants.mk:1.4 src/usr.bin/make/test-variants.mk:1.5 --- src/usr.bin/make/test-variants.mk:1.4 Sun May 8 19:19:11 2022 +++ src/usr.bin/make/test-variants.mk Thu Jan 19 19:55:27 2023 @@ -1,4 +1,4 @@ -# $NetBSD: test-variants.mk,v 1.4 2022/05/08 19:19:11 rillig Exp $ +# $NetBSD: test-variants.mk,v 1.5 2023/01/19 19:55:27 rillig Exp $ # # Build several variants of make and run the tests on them. # @@ -10,7 +10,7 @@ usage: @echo 'usage: ${MAKE} -f ${MAKEFILE} list' @echo ' ${MAKE} -f ${MAKEFILE} all' - @echo ' ${MAKE} -f ${MAKEFILE} test...' + @echo ' ${MAKE} -f ${MAKEFILE} <test>...' TESTS+= default Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.327 src/usr.bin/make/unit-tests/Makefile:1.328 --- src/usr.bin/make/unit-tests/Makefile:1.327 Sun Sep 25 12:32:56 2022 +++ src/usr.bin/make/unit-tests/Makefile Thu Jan 19 19:55:27 2023 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.327 2022/09/25 12:32:56 rillig Exp $ +# $NetBSD: Makefile,v 1.328 2023/01/19 19:55:27 rillig Exp $ # # Unit tests for make(1) # @@ -527,6 +527,7 @@ SED_CMDS.sh-dots+= -e 's,^make: exec(\( SED_CMDS.sh-dots+= -e 's,^\(\*\*\* Error code \)[1-9][0-9]*,\1<nonzero>,' SED_CMDS.sh-errctl= ${STD_SED_CMDS.dj} SED_CMDS.sh-flags= ${STD_SED_CMDS.hide-from-output} +SED_CMDS.sh-leading-hyphen= ${STD_SED_CMDS.shell} SED_CMDS.suff-main+= ${STD_SED_CMDS.dg1} SED_CMDS.suff-main-several+= ${STD_SED_CMDS.dg1} SED_CMDS.suff-transform-debug+= ${STD_SED_CMDS.dg1} @@ -613,9 +614,11 @@ STD_SED_CMDS.hide-from-output= \ # bash 5.1.0 bash: line 1: /nonexistent: No such file or directory # dash dash: 1: cannot open /nonexistent: No such file # +STD_SED_CMDS.shell+= -e 's,^${.SHELL},${.SHELL:T},' STD_SED_CMDS.shell+= -e 's,^${.SHELL:T}: line [0-9][0-9]*: ,,' STD_SED_CMDS.shell+= -e 's,^${.SHELL:T}: [0-9][0-9]*: ,,' STD_SED_CMDS.shell+= -e 's,^${.SHELL:T}: ,,' +STD_SED_CMDS.shell+= -e 's,: command not found,: not found,' # The actual error messages for a failed regcomp or regexec differ between the # implementations. Index: src/usr.bin/make/unit-tests/sh-leading-at.exp diff -u src/usr.bin/make/unit-tests/sh-leading-at.exp:1.3 src/usr.bin/make/unit-tests/sh-leading-at.exp:1.4 --- src/usr.bin/make/unit-tests/sh-leading-at.exp:1.3 Mon Nov 9 20:57:36 2020 +++ src/usr.bin/make/unit-tests/sh-leading-at.exp Thu Jan 19 19:55:27 2023 @@ -3,4 +3,5 @@ space after @ echo 'echoed' echoed 3 +whitespace in leading part exit status 0 Index: src/usr.bin/make/unit-tests/sh-leading-hyphen.mk diff -u src/usr.bin/make/unit-tests/sh-leading-hyphen.mk:1.3 src/usr.bin/make/unit-tests/sh-leading-hyphen.mk:1.4 --- src/usr.bin/make/unit-tests/sh-leading-hyphen.mk:1.3 Sun Nov 15 20:20:58 2020 +++ src/usr.bin/make/unit-tests/sh-leading-hyphen.mk Thu Jan 19 19:55:27 2023 @@ -1,4 +1,4 @@ -# $NetBSD: sh-leading-hyphen.mk,v 1.3 2020/11/15 20:20:58 rillig Exp $ +# $NetBSD: sh-leading-hyphen.mk,v 1.4 2023/01/19 19:55:27 rillig Exp $ # # Tests for shell commands preceded by a '-', to ignore the exit status of # the command line. @@ -11,4 +11,19 @@ # TODO: Implementation all: - @:; + -true + -false + + # An undefined variable expands to an empty string, without warning. + # This is used in practice for prefixing tool names or for DESTDIR. + # The '-' before 'unknown' is interpreted by make as '.IGNORE' flag. + ${UNDEF}-unknown-command 'needed for needshell in compat.c' + + # Expanding undefined variables may lead to strange error messages + # when the shell interprets single-character options as commands + # instead. + ${UNDEF} --unknown-long-option 'needed for needshell in compat.c' + + # Since 2023-01-17, the leading '@', '+' and '-' may contain + # whitespace, for compatibility with GNU make. + - - - @echo 'whitespace in leading part' Index: src/usr.bin/make/unit-tests/sh-leading-at.mk diff -u src/usr.bin/make/unit-tests/sh-leading-at.mk:1.5 src/usr.bin/make/unit-tests/sh-leading-at.mk:1.6 --- src/usr.bin/make/unit-tests/sh-leading-at.mk:1.5 Sun Nov 15 20:20:58 2020 +++ src/usr.bin/make/unit-tests/sh-leading-at.mk Thu Jan 19 19:55:27 2023 @@ -1,4 +1,4 @@ -# $NetBSD: sh-leading-at.mk,v 1.5 2020/11/15 20:20:58 rillig Exp $ +# $NetBSD: sh-leading-at.mk,v 1.6 2023/01/19 19:55:27 rillig Exp $ # # Tests for shell commands preceded by an '@', to suppress printing # the command to stdout. @@ -16,3 +16,7 @@ all: # The leading '@' can be repeated. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@echo '3' + + # Since 2023-01-17, the leading '@', '+' and '-' may contain + # whitespace, for compatibility with GNU make. + @ @ @ echo 'whitespace in leading part' Index: src/usr.bin/make/unit-tests/sh-leading-hyphen.exp diff -u src/usr.bin/make/unit-tests/sh-leading-hyphen.exp:1.1 src/usr.bin/make/unit-tests/sh-leading-hyphen.exp:1.2 --- src/usr.bin/make/unit-tests/sh-leading-hyphen.exp:1.1 Sun Aug 16 12:07:51 2020 +++ src/usr.bin/make/unit-tests/sh-leading-hyphen.exp Thu Jan 19 19:55:27 2023 @@ -1 +1,11 @@ +true +false +*** Error code 1 (ignored) +unknown-command 'needed for needshell in compat.c' +unknown-command: not found +*** Error code 127 (ignored) +unknown-long-option 'needed for needshell in compat.c' +unknown-long-option: not found +whitespace in leading part +*** Error code 127 (ignored) exit status 0 Index: src/usr.bin/make/unit-tests/sh-leading-plus.exp diff -u src/usr.bin/make/unit-tests/sh-leading-plus.exp:1.2 src/usr.bin/make/unit-tests/sh-leading-plus.exp:1.3 --- src/usr.bin/make/unit-tests/sh-leading-plus.exp:1.2 Sun Aug 23 14:46:33 2020 +++ src/usr.bin/make/unit-tests/sh-leading-plus.exp Thu Jan 19 19:55:27 2023 @@ -1,4 +1,6 @@ echo 'this command is not run' echo 'this command is run' this command is run +echo 'whitespace in leading part' +whitespace in leading part exit status 0 Index: src/usr.bin/make/unit-tests/sh-leading-plus.mk diff -u src/usr.bin/make/unit-tests/sh-leading-plus.mk:1.4 src/usr.bin/make/unit-tests/sh-leading-plus.mk:1.5 --- src/usr.bin/make/unit-tests/sh-leading-plus.mk:1.4 Mon Nov 9 20:50:56 2020 +++ src/usr.bin/make/unit-tests/sh-leading-plus.mk Thu Jan 19 19:55:27 2023 @@ -1,4 +1,4 @@ -# $NetBSD: sh-leading-plus.mk,v 1.4 2020/11/09 20:50:56 rillig Exp $ +# $NetBSD: sh-leading-plus.mk,v 1.5 2023/01/19 19:55:27 rillig Exp $ # # Tests for shell commands preceded by a '+', to run them even if # the command line option -n is given. @@ -8,3 +8,7 @@ all: @echo 'this command is not run' @+echo 'this command is run' + + # Since 2023-01-17, the leading '@', '+' and '-' may contain + # whitespace, for compatibility with GNU make. + + + + @echo 'whitespace in leading part'