Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make/unit-tests make(1): normalize shell error messa...



details:   https://anonhg.NetBSD.org/src/rev/a86b791e0a77
branches:  trunk
changeset: 950180:a86b791e0a77
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Jan 19 05:49:33 2021 +0000

description:
make(1): normalize shell error messages in tests

Newly supported is bash, which outputs "bash: line 123".

diffstat:

 usr.bin/make/unit-tests/Makefile |  28 +++++++++++++++++++++++-----
 1 files changed, 23 insertions(+), 5 deletions(-)

diffs (49 lines):

diff -r 09fc0348c9ae -r a86b791e0a77 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Tue Jan 19 05:26:34 2021 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Tue Jan 19 05:49:33 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.260 2020/12/31 03:05:12 rillig Exp $
+# $NetBSD: Makefile,v 1.261 2021/01/19 05:49:33 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -504,10 +504,9 @@
 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}
-SED_CMDS.var-op-shell+=        \
-       -e 's,^${.SHELL:T}: [ 0-9:]*,,' \
-       -e '/command/s,No such.*,not found,'
-SED_CMDS.vardebug+=    -e 's,${.SHELL},</path/to/shell>,'
+SED_CMDS.var-op-shell+=                ${STD_SED_CMDS.shell}
+SED_CMDS.var-op-shell+=                -e '/command/s,No such.*,not found,'
+SED_CMDS.vardebug+=            -e 's,${.SHELL},</path/to/shell>,'
 SED_CMDS.varmod-subst-regex+= \
                        -e 's,\(Regex compilation error:\).*,\1 (details omitted),'
 SED_CMDS.varname-dot-parsedir= -e '/in some cases/ s,^make: "[^"]*,make: "<normalized>,'
@@ -553,6 +552,25 @@
        -e 's,hide-from-output ,,' \
        -e 's,hide-from-output,,'
 
+# Normalize the output for error messages from the shell.
+#
+# $shell -c '...'
+#      NetBSD sh       ...: not found
+#      NetBSD ksh      ksh: ...: not found
+#      bash 5          bash: line 1: ...: command not found
+#      dash            dash: 1: ...: not found
+#
+# $shell -c '< /nonexistent'
+#      NetBSD sh       sh: cannot open /nonexistent: no such file
+#      NetBSD ksh      ksh: cannot open /nonexistent: No such file or directory
+#      bash 5          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: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}: ,,'
+
 # End of the configuration helpers section.
 
 .MAIN: all



Home | Main Index | Thread Index | Old Index