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: document inconsistencies...
details: https://anonhg.NetBSD.org/src/rev/c98322bccae4
branches: trunk
changeset: 1029226:c98322bccae4
user: rillig <rillig%NetBSD.org@localhost>
date: Tue Dec 28 00:56:16 2021 +0000
description:
tests/make: document inconsistencies between '!=' and '::!='
Found while trying to make the error messages from Cmd_Exec more
detailed.
diffstat:
distrib/sets/lists/tests/mi | 4 ++-
usr.bin/make/unit-tests/Makefile | 3 +-
usr.bin/make/unit-tests/varmod-assign-shell.exp | 5 +++
usr.bin/make/unit-tests/varmod-assign-shell.mk | 32 +++++++++++++++++++++++++
4 files changed, 42 insertions(+), 2 deletions(-)
diffs (80 lines):
diff -r 61676984523b -r c98322bccae4 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi Tue Dec 28 00:37:16 2021 +0000
+++ b/distrib/sets/lists/tests/mi Tue Dec 28 00:56:16 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1180 2021/12/23 11:05:58 rillig Exp $
+# $NetBSD: mi,v 1.1181 2021/12/28 00:56:16 rillig Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -5967,6 +5967,8 @@
./usr/tests/usr.bin/make/unit-tests/varfind.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/varmisc.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/varmisc.mk tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/varmod-assign-shell.exp tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/varmod-assign-shell.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/varmod-assign.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/varmod-assign.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/varmod-defined.exp tests-usr.bin-tests compattestfile,atf
diff -r 61676984523b -r c98322bccae4 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile Tue Dec 28 00:37:16 2021 +0000
+++ b/usr.bin/make/unit-tests/Makefile Tue Dec 28 00:56:16 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.291 2021/12/23 11:05:59 rillig Exp $
+# $NetBSD: Makefile,v 1.292 2021/12/28 00:56:17 rillig Exp $
#
# Unit tests for make(1)
#
@@ -342,6 +342,7 @@
TESTS+= varmisc
TESTS+= varmod
TESTS+= varmod-assign
+TESTS+= varmod-assign-shell
TESTS+= varmod-defined
TESTS+= varmod-edge
TESTS+= varmod-exclam-shell
diff -r 61676984523b -r c98322bccae4 usr.bin/make/unit-tests/varmod-assign-shell.exp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/varmod-assign-shell.exp Tue Dec 28 00:56:16 2021 +0000
@@ -0,0 +1,5 @@
+make: "varmod-assign-shell.mk" line 25: warning: "echo output; false" returned non-zero status
+make: "echo output; false" returned non-zero status
+DIRECT=output
+ASSIGNED=previous
+exit status 0
diff -r 61676984523b -r c98322bccae4 usr.bin/make/unit-tests/varmod-assign-shell.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/varmod-assign-shell.mk Tue Dec 28 00:56:16 2021 +0000
@@ -0,0 +1,32 @@
+# $NetBSD: varmod-assign-shell.mk,v 1.1 2021/12/28 00:56:17 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.
+#
+# The variable modifier '::!=' and its close relatives have been around since
+# var.c 1.45 from 2000-06-01.
+#
+# Before 2020.08.25.21.16.53, the variable modifier '::!=' had a bug for
+# unsuccessful commands, it put the previous value of the variable into the
+# error message instead of the command that was executed. That's where the
+# counterintuitive error message 'make: "previous" returned non-zero status'
+# comes from.
+#
+# BUGS
+# Even though the variable modifier '::!=' produces an error message,
+# the exit status of make is still 0.
+#
+# Having an error message instead of a warning like for the variable
+# assignment operator '!=' is another unnecessary inconsistency.
+
+DIRECT= previous
+DIRECT!= echo output; false
+
+ASSIGNED= previous
+_:= ${ASSIGNED::!=echo output; false}
+
+all:
+ @echo DIRECT=${DIRECT:Q}
+ @echo ASSIGNED=${ASSIGNED:Q}
Home |
Main Index |
Thread Index |
Old Index