Module Name:    src
Committed By:   rillig
Date:           Fri Oct 23 06:18:23 UTC 2020

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

Log Message:
make(1): add test for .ERROR_CMD in jobs mode


To generate a diff of this commit:
cvs rdiff -u -r1.944 -r1.945 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.169 -r1.170 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 \
    src/usr.bin/make/unit-tests/varname-make_print_var_on_error-jobs.exp \
    src/usr.bin/make/unit-tests/varname-make_print_var_on_error-jobs.mk
cvs rdiff -u -r1.3 -r1.4 \
    src/usr.bin/make/unit-tests/varname-make_print_var_on_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.944 src/distrib/sets/lists/tests/mi:1.945
--- src/distrib/sets/lists/tests/mi:1.944	Tue Oct 20 20:36:53 2020
+++ src/distrib/sets/lists/tests/mi	Fri Oct 23 06:18:23 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.944 2020/10/20 20:36:53 rillig Exp $
+# $NetBSD: mi,v 1.945 2020/10/23 06:18:23 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5203,6 +5203,8 @@
 ./usr/tests/usr.bin/make/unit-tests/varname-empty.mk				tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varname-make.exp				tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varname-make.mk				tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/varname-make_print_var_on_error-jobs.exp	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/varname-make_print_var_on_error-jobs.mk	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varname-make_print_var_on_error.exp		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varname-make_print_var_on_error.mk		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varname-makefile.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.169 src/usr.bin/make/unit-tests/Makefile:1.170
--- src/usr.bin/make/unit-tests/Makefile:1.169	Tue Oct 20 20:36:53 2020
+++ src/usr.bin/make/unit-tests/Makefile	Fri Oct 23 06:18:23 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.169 2020/10/20 20:36:53 rillig Exp $
+# $NetBSD: Makefile,v 1.170 2020/10/23 06:18:23 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -358,6 +358,7 @@ TESTS+=		varname-dot-targets
 TESTS+=		varname-empty
 TESTS+=		varname-make
 TESTS+=		varname-make_print_var_on_error
+TESTS+=		varname-make_print_var_on_error-jobs
 TESTS+=		varname-makefile
 TESTS+=		varname-makeflags
 TESTS+=		varname-pwd

Index: src/usr.bin/make/unit-tests/varname-make_print_var_on_error.mk
diff -u src/usr.bin/make/unit-tests/varname-make_print_var_on_error.mk:1.3 src/usr.bin/make/unit-tests/varname-make_print_var_on_error.mk:1.4
--- src/usr.bin/make/unit-tests/varname-make_print_var_on_error.mk:1.3	Fri Oct 23 05:44:02 2020
+++ src/usr.bin/make/unit-tests/varname-make_print_var_on_error.mk	Fri Oct 23 06:18:23 2020
@@ -1,15 +1,16 @@
-# $NetBSD: varname-make_print_var_on_error.mk,v 1.3 2020/10/23 05:44:02 rillig Exp $
+# $NetBSD: varname-make_print_var_on_error.mk,v 1.4 2020/10/23 06:18:23 rillig Exp $
 #
 # Tests for the special MAKE_PRINT_VAR_ON_ERROR variable, which prints the
 # values of selected variables on error.
 
+# XXX: As of 2020-10-23, the .ERROR_CMD variable is pointless in compat mode
+# since at the point where it is filled in PrintOnError, the first command in
+# gn->commands has been set to NULL already.  This leaves .ERROR_CMD an empty
+# list.
+
 MAKE_PRINT_VAR_ON_ERROR=	.ERROR_TARGET .ERROR_CMD
 
 all:
 	@: command before
 	@echo fail; false
 	@: command after
-
-# XXX: As of 2020-10-23, the .ERROR_CMD variable seems pointless since at
-# that point, the first command in gn->commands has been set to NULL already.
-# And because of this, .ERROR_CMD stays an empty list.

Added files:

Index: src/usr.bin/make/unit-tests/varname-make_print_var_on_error-jobs.exp
diff -u /dev/null src/usr.bin/make/unit-tests/varname-make_print_var_on_error-jobs.exp:1.1
--- /dev/null	Fri Oct 23 06:18:23 2020
+++ src/usr.bin/make/unit-tests/varname-make_print_var_on_error-jobs.exp	Fri Oct 23 06:18:23 2020
@@ -0,0 +1,7 @@
+fail
+*** [all] Error code 1
+
+make: stopped in unit-tests
+.ERROR_TARGET='all'
+.ERROR_CMD='@: command before @echo fail; false @: command after, with variable expressions expanded'
+exit status 1
Index: src/usr.bin/make/unit-tests/varname-make_print_var_on_error-jobs.mk
diff -u /dev/null src/usr.bin/make/unit-tests/varname-make_print_var_on_error-jobs.mk:1.1
--- /dev/null	Fri Oct 23 06:18:23 2020
+++ src/usr.bin/make/unit-tests/varname-make_print_var_on_error-jobs.mk	Fri Oct 23 06:18:23 2020
@@ -0,0 +1,21 @@
+# $NetBSD: varname-make_print_var_on_error-jobs.mk,v 1.1 2020/10/23 06:18:23 rillig Exp $
+#
+# Tests for the special MAKE_PRINT_VAR_ON_ERROR variable, which prints the
+# values of selected variables on error.
+#
+# The variable .ERROR_CMD contains all commands of the target, with variable
+# expressions expanded, just as they were printed to the shell command file.
+#
+# The commands in .ERROR_CMD are space-separated.  Since each command usually
+# contains spaces as well, this value is only intended as a first hint to what
+# happened.  For more details, use the debug options -de, -dj, -dl, -dn, -dx.
+
+# As of 2020-10-23, .ERROR_CMD only works in parallel mode.
+.MAKEFLAGS: -j1
+
+MAKE_PRINT_VAR_ON_ERROR=	.ERROR_TARGET .ERROR_CMD
+
+all:
+	@: command before
+	@echo fail; false
+	@: command after${:U, with variable expressions expanded}

Reply via email to