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 tests/make: demonstrate inconsistenc...
details: https://anonhg.NetBSD.org/src/rev/f138ae3ecb06
branches: trunk
changeset: 359560:f138ae3ecb06
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Jan 09 18:22:31 2022 +0000
description:
tests/make: demonstrate inconsistencies in Cmd_Exec callers
The assignment 'VAR != cmd' generates a warning, the others generate an
error message. That error message is ignored for backwards
compatibility though.
The assignment via the expression ${VAR::!=cmd} only uses the output of
the command if there was no error, the other places use the output
nevertheless.
diffstat:
usr.bin/make/unit-tests/var-op-shell.exp | 8 ++++----
usr.bin/make/unit-tests/var-op-shell.mk | 9 ++++++---
usr.bin/make/unit-tests/varmod-assign-shell.exp | 2 +-
usr.bin/make/unit-tests/varmod-assign-shell.mk | 8 +++++---
4 files changed, 16 insertions(+), 11 deletions(-)
diffs (72 lines):
diff -r 15424fa3fe15 -r f138ae3ecb06 usr.bin/make/unit-tests/var-op-shell.exp
--- a/usr.bin/make/unit-tests/var-op-shell.exp Sun Jan 09 18:11:09 2022 +0000
+++ b/usr.bin/make/unit-tests/var-op-shell.exp Sun Jan 09 18:22:31 2022 +0000
@@ -1,7 +1,7 @@
-make: "var-op-shell.mk" line 28: warning: "echo "failed"; false" returned non-zero status
-make: "var-op-shell.mk" line 34: warning: "false" returned non-zero status
-make: "var-op-shell.mk" line 56: warning: "kill $$" exited on a signal
+make: "var-op-shell.mk" line 31: warning: "echo "failed"; false" returned non-zero status
+make: "var-op-shell.mk" line 37: warning: "false" returned non-zero status
+make: "var-op-shell.mk" line 59: warning: "kill $$" exited on a signal
/bin/no/such/command: not found
-make: "var-op-shell.mk" line 62: warning: "/bin/no/such/command" returned non-zero status
+make: "var-op-shell.mk" line 65: warning: "/bin/no/such/command" returned non-zero status
stderr
exit status 0
diff -r 15424fa3fe15 -r f138ae3ecb06 usr.bin/make/unit-tests/var-op-shell.mk
--- a/usr.bin/make/unit-tests/var-op-shell.mk Sun Jan 09 18:11:09 2022 +0000
+++ b/usr.bin/make/unit-tests/var-op-shell.mk Sun Jan 09 18:22:31 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: var-op-shell.mk,v 1.4 2021/02/06 04:55:08 sjg Exp $
+# $NetBSD: var-op-shell.mk,v 1.5 2022/01/09 18:22:31 rillig Exp $
#
# Tests for the != variable assignment operator, which runs its right-hand
# side through the shell.
@@ -15,7 +15,7 @@
# an empty output produced the error message "Couldn't read shell's output
# for \"%s\"".
#
-# The error message is still there but reserved for technical errors.
+# The error message is still in Cmd_Exec but reserved for technical errors.
# It may be possible to trigger the error message by killing the shell after
# reading part of its output.
OUTPUT!= true
@@ -24,7 +24,10 @@
.endif
# The output of a shell command that failed is processed nevertheless.
-# TODO: Make this an error in lint mode.
+# Unlike the other places that run external commands (expression modifier
+# '::!=', expression modifier ':!...!'), a failed command generates only a
+# warning, not an "error". These "errors" are ignored in default mode, for
+# compatibility, but not in lint mode (-dL).
OUTPUT!= echo "failed"; false
.if ${OUTPUT} != "failed"
. error
diff -r 15424fa3fe15 -r f138ae3ecb06 usr.bin/make/unit-tests/varmod-assign-shell.exp
--- a/usr.bin/make/unit-tests/varmod-assign-shell.exp Sun Jan 09 18:11:09 2022 +0000
+++ b/usr.bin/make/unit-tests/varmod-assign-shell.exp Sun Jan 09 18:22:31 2022 +0000
@@ -1,4 +1,4 @@
-make: "varmod-assign-shell.mk" line 25: warning: "echo output; false" returned non-zero status
+make: "varmod-assign-shell.mk" line 27: warning: "echo output; false" returned non-zero status
make: "echo output; false" returned non-zero status
DIRECT=output
ASSIGNED=previous
diff -r 15424fa3fe15 -r f138ae3ecb06 usr.bin/make/unit-tests/varmod-assign-shell.mk
--- a/usr.bin/make/unit-tests/varmod-assign-shell.mk Sun Jan 09 18:11:09 2022 +0000
+++ b/usr.bin/make/unit-tests/varmod-assign-shell.mk Sun Jan 09 18:22:31 2022 +0000
@@ -1,9 +1,11 @@
-# $NetBSD: varmod-assign-shell.mk,v 1.2 2021/12/28 10:47:00 rillig Exp $
+# $NetBSD: varmod-assign-shell.mk,v 1.3 2022/01/09 18:22:31 rillig Exp $
#
# Tests for the variable modifier '::!=', which assigns the output of a shell
# command to the variable, but only if the command exited successfully. This
-# is different from the variable assignment operator '!=', which also assigns
-# when the shell command fails or crashes.
+# is different from the other places that capture the output of an external
+# command (variable assignment operator '!=', expression modifier ':sh',
+# expression modifier ':!...!'), which also use the output when the shell
+# command fails or crashes.
#
# The variable modifier '::!=' and its close relatives have been around since
# var.c 1.45 from 2000-06-01.
Home |
Main Index |
Thread Index |
Old Index