Module Name:    src
Committed By:   rillig
Date:           Sun Dec 13 17:44:31 UTC 2020

Modified Files:
        src/distrib/sets/lists/tests: mi
        src/usr.bin/make/unit-tests: Makefile
Added Files:
        src/usr.bin/make/unit-tests: compat-error.exp compat-error.mk

Log Message:
make(1): demonstrate wrong error handling in compat mode


To generate a diff of this commit:
cvs rdiff -u -r1.992 -r1.993 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.248 -r1.249 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/compat-error.exp \
    src/usr.bin/make/unit-tests/compat-error.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.992 src/distrib/sets/lists/tests/mi:1.993
--- src/distrib/sets/lists/tests/mi:1.992	Sun Dec 13 00:46:25 2020
+++ src/distrib/sets/lists/tests/mi	Sun Dec 13 17:44:31 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.992 2020/12/13 00:46:25 rillig Exp $
+# $NetBSD: mi,v 1.993 2020/12/13 17:44:31 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4830,6 +4830,8 @@
 ./usr/tests/usr.bin/make/unit-tests/cmdline.mk					tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/comment.exp					tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/comment.mk					tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/compat-error.exp				tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/compat-error.mk				tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cond-cmp-numeric-eq.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cond-cmp-numeric-ge.exp			tests-usr.bin-tests	compattestfile,atf

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.248 src/usr.bin/make/unit-tests/Makefile:1.249
--- src/usr.bin/make/unit-tests/Makefile:1.248	Sun Dec 13 05:13:38 2020
+++ src/usr.bin/make/unit-tests/Makefile	Sun Dec 13 17:44:31 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.248 2020/12/13 05:13:38 sjg Exp $
+# $NetBSD: Makefile,v 1.249 2020/12/13 17:44:31 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -46,6 +46,7 @@ TESTS+=		cmd-interrupt
 TESTS+=		cmdline
 TESTS+=		cmdline-undefined
 TESTS+=		comment
+TESTS+=		compat-error
 TESTS+=		cond-cmp-numeric
 TESTS+=		cond-cmp-numeric-eq
 TESTS+=		cond-cmp-numeric-ge

Added files:

Index: src/usr.bin/make/unit-tests/compat-error.exp
diff -u /dev/null src/usr.bin/make/unit-tests/compat-error.exp:1.1
--- /dev/null	Sun Dec 13 17:44:31 2020
+++ src/usr.bin/make/unit-tests/compat-error.exp	Sun Dec 13 17:44:31 2020
@@ -0,0 +1,15 @@
+: Making success1 out of nothing.
+: Making fail1 out of nothing.
+false
+*** Error code 1 (continuing)
+: Making success2 out of nothing.
+: Making fail2 out of nothing.
+false
+*** Error code 1 (continuing)
+: Making success3 out of nothing.
+
+Stop.
+make: stopped in unit-tests
+target: success3
+command:
+exit status 1
Index: src/usr.bin/make/unit-tests/compat-error.mk
diff -u /dev/null src/usr.bin/make/unit-tests/compat-error.mk:1.1
--- /dev/null	Sun Dec 13 17:44:31 2020
+++ src/usr.bin/make/unit-tests/compat-error.mk	Sun Dec 13 17:44:31 2020
@@ -0,0 +1,33 @@
+# $NetBSD: compat-error.mk,v 1.1 2020/12/13 17:44:31 rillig Exp $
+#
+# Test detailed error handling in compat mode.
+#
+# XXX: As of 2020-12-13, .ERROR_TARGET is success3, which is wrong.
+#
+# XXX: As of 2020-12-13, .ERROR_CMD is empty, which is wrong.
+#
+# See also:
+#	Compat_Run
+#
+#	The commit that added the NULL command to gn->commands:
+#		CVS: 1994.06.06.22.45.??
+#		Git: 26a8972fd7f982502c5fbfdabd34578b99d77ca5
+#		1994: Lst_Replace (cmdNode, (ClientData) NULL);
+#		2020: LstNode_SetNull(cmdNode);
+#
+#	The commit that skipped NULL commands for .ERROR_CMD:
+#		CVS: 2016.08.11.19.53.??
+#		Git: 58b23478b7353d46457089e726b07a49197388e4
+
+.MAKEFLAGS: success1 fail1 success2 fail2 success3
+
+success1 success2 success3:
+	: Making ${.TARGET} out of nothing.
+
+fail1 fail2:
+	: Making ${.TARGET} out of nothing.
+	false
+
+.ERROR:
+	@echo target: ${.ERROR_TARGET}
+	@echo command: ${.ERROR_CMD}

Reply via email to