Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make tests/make: add tests for whitespace in leading...
details: https://anonhg.NetBSD.org/src/rev/965aac25321c
branches: trunk
changeset: 373126:965aac25321c
user: rillig <rillig%NetBSD.org@localhost>
date: Thu Jan 19 19:55:27 2023 +0000
description:
tests/make: add tests for whitespace in leading '@+-'
diffstat:
usr.bin/make/test-variants.mk | 4 ++--
usr.bin/make/unit-tests/Makefile | 5 ++++-
usr.bin/make/unit-tests/sh-leading-at.exp | 1 +
usr.bin/make/unit-tests/sh-leading-at.mk | 6 +++++-
usr.bin/make/unit-tests/sh-leading-hyphen.exp | 10 ++++++++++
usr.bin/make/unit-tests/sh-leading-hyphen.mk | 19 +++++++++++++++++--
usr.bin/make/unit-tests/sh-leading-plus.exp | 2 ++
usr.bin/make/unit-tests/sh-leading-plus.mk | 6 +++++-
8 files changed, 46 insertions(+), 7 deletions(-)
diffs (145 lines):
diff -r 9b47a51c8245 -r 965aac25321c usr.bin/make/test-variants.mk
--- a/usr.bin/make/test-variants.mk Thu Jan 19 18:03:03 2023 +0000
+++ b/usr.bin/make/test-variants.mk Thu Jan 19 19:55:27 2023 +0000
@@ -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
diff -r 9b47a51c8245 -r 965aac25321c usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile Thu Jan 19 18:03:03 2023 +0000
+++ b/usr.bin/make/unit-tests/Makefile Thu Jan 19 19:55:27 2023 +0000
@@ -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,^\(\*\*\* 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 @@
# 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.
diff -r 9b47a51c8245 -r 965aac25321c usr.bin/make/unit-tests/sh-leading-at.exp
--- a/usr.bin/make/unit-tests/sh-leading-at.exp Thu Jan 19 18:03:03 2023 +0000
+++ b/usr.bin/make/unit-tests/sh-leading-at.exp Thu Jan 19 19:55:27 2023 +0000
@@ -3,4 +3,5 @@
echo 'echoed'
echoed
3
+whitespace in leading part
exit status 0
diff -r 9b47a51c8245 -r 965aac25321c usr.bin/make/unit-tests/sh-leading-at.mk
--- a/usr.bin/make/unit-tests/sh-leading-at.mk Thu Jan 19 18:03:03 2023 +0000
+++ b/usr.bin/make/unit-tests/sh-leading-at.mk Thu Jan 19 19:55:27 2023 +0000
@@ -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 @@
# 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'
diff -r 9b47a51c8245 -r 965aac25321c usr.bin/make/unit-tests/sh-leading-hyphen.exp
--- a/usr.bin/make/unit-tests/sh-leading-hyphen.exp Thu Jan 19 18:03:03 2023 +0000
+++ b/usr.bin/make/unit-tests/sh-leading-hyphen.exp Thu Jan 19 19:55:27 2023 +0000
@@ -1,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
diff -r 9b47a51c8245 -r 965aac25321c usr.bin/make/unit-tests/sh-leading-hyphen.mk
--- a/usr.bin/make/unit-tests/sh-leading-hyphen.mk Thu Jan 19 18:03:03 2023 +0000
+++ b/usr.bin/make/unit-tests/sh-leading-hyphen.mk Thu Jan 19 19:55:27 2023 +0000
@@ -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'
diff -r 9b47a51c8245 -r 965aac25321c usr.bin/make/unit-tests/sh-leading-plus.exp
--- a/usr.bin/make/unit-tests/sh-leading-plus.exp Thu Jan 19 18:03:03 2023 +0000
+++ b/usr.bin/make/unit-tests/sh-leading-plus.exp Thu Jan 19 19:55:27 2023 +0000
@@ -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
diff -r 9b47a51c8245 -r 965aac25321c usr.bin/make/unit-tests/sh-leading-plus.mk
--- a/usr.bin/make/unit-tests/sh-leading-plus.mk Thu Jan 19 18:03:03 2023 +0000
+++ b/usr.bin/make/unit-tests/sh-leading-plus.mk Thu Jan 19 19:55:27 2023 +0000
@@ -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'
Home |
Main Index |
Thread Index |
Old Index