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): add test for .ERROR_CMD in ...



details:   https://anonhg.NetBSD.org/src/rev/8017068c5632
branches:  trunk
changeset: 1015412:8017068c5632
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Oct 23 06:18:23 2020 +0000

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

diffstat:

 distrib/sets/lists/tests/mi                                      |   4 +-
 usr.bin/make/unit-tests/Makefile                                 |   3 +-
 usr.bin/make/unit-tests/varname-make_print_var_on_error-jobs.exp |   7 +++
 usr.bin/make/unit-tests/varname-make_print_var_on_error-jobs.mk  |  21 ++++++++++
 usr.bin/make/unit-tests/varname-make_print_var_on_error.mk       |  11 ++--
 5 files changed, 39 insertions(+), 7 deletions(-)

diffs (96 lines):

diff -r b182082f9322 -r 8017068c5632 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Fri Oct 23 05:44:02 2020 +0000
+++ b/distrib/sets/lists/tests/mi       Fri Oct 23 06:18:23 2020 +0000
@@ -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
diff -r b182082f9322 -r 8017068c5632 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Fri Oct 23 05:44:02 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Fri Oct 23 06:18:23 2020 +0000
@@ -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-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
diff -r b182082f9322 -r 8017068c5632 usr.bin/make/unit-tests/varname-make_print_var_on_error-jobs.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/varname-make_print_var_on_error-jobs.exp  Fri Oct 23 06:18:23 2020 +0000
@@ -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
diff -r b182082f9322 -r 8017068c5632 usr.bin/make/unit-tests/varname-make_print_var_on_error-jobs.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/varname-make_print_var_on_error-jobs.mk   Fri Oct 23 06:18:23 2020 +0000
@@ -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}
diff -r b182082f9322 -r 8017068c5632 usr.bin/make/unit-tests/varname-make_print_var_on_error.mk
--- a/usr.bin/make/unit-tests/varname-make_print_var_on_error.mk        Fri Oct 23 05:44:02 2020 +0000
+++ b/usr.bin/make/unit-tests/varname-make_print_var_on_error.mk        Fri Oct 23 06:18:23 2020 +0000
@@ -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.



Home | Main Index | Thread Index | Old Index