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 tests for suppressing "...



details:   https://anonhg.NetBSD.org/src/rev/62adf63b8f4e
branches:  trunk
changeset: 946571:62adf63b8f4e
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Dec 01 17:50:04 2020 +0000

description:
make(1): add tests for suppressing "stopped in"

These tests demonstrate the unwanted behavior described in PR bin/55578
and PR bin/55832.

diffstat:

 distrib/sets/lists/tests/mi                        |  12 +++++++++---
 usr.bin/make/unit-tests/Makefile                   |  16 +++++++++++-----
 usr.bin/make/unit-tests/jobs-error-indirect.exp    |   8 ++++++++
 usr.bin/make/unit-tests/jobs-error-indirect.mk     |  21 +++++++++++++++++++++
 usr.bin/make/unit-tests/jobs-error-nested-make.exp |   3 +++
 usr.bin/make/unit-tests/jobs-error-nested-make.mk  |  20 ++++++++++++++++++++
 usr.bin/make/unit-tests/jobs-error-nested.exp      |  15 +++++++++++++++
 usr.bin/make/unit-tests/jobs-error-nested.mk       |  20 ++++++++++++++++++++
 8 files changed, 107 insertions(+), 8 deletions(-)

diffs (178 lines):

diff -r b7bcce0bf6ac -r 62adf63b8f4e distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Tue Dec 01 14:53:47 2020 +0000
+++ b/distrib/sets/lists/tests/mi       Tue Dec 01 17:50:04 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.979 2020/11/30 21:36:52 sjg Exp $
+# $NetBSD: mi,v 1.980 2020/12/01 17:50:04 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5119,12 +5119,18 @@
 ./usr/tests/usr.bin/make/unit-tests/job-flags.mk                               tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/job-output-long-lines.exp                  tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/job-output-long-lines.mk                   tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/jobs-error-indirect.exp                    tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/jobs-error-indirect.mk                     tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/jobs-error-nested-make.exp                 tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/jobs-error-nested-make.mk                  tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/jobs-error-nested.exp                      tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/jobs-error-nested.mk                       tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/lint.exp                                   tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/lint.mk                                    tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/make-exported.exp                          tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/make-exported.mk                           tests-usr.bin-tests     compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/meta-cmd-cmp.exp                           tests-usr.bin-tests     compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/meta-cmd-cmp.mk                            tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/meta-cmd-cmp.exp                           tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/meta-cmd-cmp.mk                            tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/misc.exp                                   tests-obsolete          obsolete
 ./usr/tests/usr.bin/make/unit-tests/misc.mk                                    tests-obsolete          obsolete
 ./usr/tests/usr.bin/make/unit-tests/moderrs.exp                                        tests-usr.bin-tests     compattestfile,atf
diff -r b7bcce0bf6ac -r 62adf63b8f4e usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Tue Dec 01 14:53:47 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Tue Dec 01 17:50:04 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.231 2020/11/30 21:10:15 rillig Exp $
+# $NetBSD: Makefile,v 1.232 2020/12/01 17:50:04 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -186,6 +186,9 @@
 TESTS+=                include-main
 TESTS+=                job-flags
 TESTS+=                job-output-long-lines
+TESTS+=                jobs-error-indirect
+TESTS+=                jobs-error-nested
+TESTS+=                jobs-error-nested-make
 TESTS+=                lint
 TESTS+=                make-exported
 TESTS+=                meta-cmd-cmp
@@ -433,10 +436,13 @@
 # Override make flags for some of the tests; default is -k.
 # If possible, write ".MAKEFLAGS: -dv" in the test .mk file instead of
 # settings FLAGS.test=-dv here, since that is closer to the test code.
-FLAGS.cond-func-make=  via-cmdline
-FLAGS.directive-ifmake=        first second
-FLAGS.doterror=                # none, especially not -k
-FLAGS.varname-empty=   -dv '$${:U}=cmdline-u' '=cmdline-plain'
+FLAGS.cond-func-make=          via-cmdline
+FLAGS.directive-ifmake=                first second
+FLAGS.doterror=                        # none, especially not -k
+FLAGS.jobs-error-indirect=     # none, especially not -k
+FLAGS.jobs-error-nested=       # none, especially not -k
+FLAGS.jobs-error-nested-make=  # none, especially not -k
+FLAGS.varname-empty=           -dv '$${:U}=cmdline-u' '=cmdline-plain'
 
 # Some tests need extra postprocessing.
 SED_CMDS.dir=          ${:D remove output from -DCLEANUP mode }
diff -r b7bcce0bf6ac -r 62adf63b8f4e usr.bin/make/unit-tests/jobs-error-indirect.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/jobs-error-indirect.exp   Tue Dec 01 17:50:04 2020 +0000
@@ -0,0 +1,8 @@
+false
+*** [indirect] Error code 1
+
+make: stopped in unit-tests
+1 error
+
+make: stopped in unit-tests
+exit status 2
diff -r b7bcce0bf6ac -r 62adf63b8f4e usr.bin/make/unit-tests/jobs-error-indirect.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/jobs-error-indirect.mk    Tue Dec 01 17:50:04 2020 +0000
@@ -0,0 +1,21 @@
+# $NetBSD: jobs-error-indirect.mk,v 1.1 2020/12/01 17:50:04 rillig Exp $
+#
+# Ensure that in jobs mode, when a command fails, the current directory is
+# printed, to aid in debugging.
+#
+# XXX: This test is run without the -k flag, which prints "stopped in" twice.
+# Why?
+#
+# This particular case is not the cause for the PRs, but it is very close.
+#
+# https://gnats.netbsd.org/55578
+# https://gnats.netbsd.org/55832
+#
+#
+
+.MAKEFLAGS: -j1
+
+all: .PHONY indirect
+
+indirect: .PHONY
+       false
diff -r b7bcce0bf6ac -r 62adf63b8f4e usr.bin/make/unit-tests/jobs-error-nested-make.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/jobs-error-nested-make.exp        Tue Dec 01 17:50:04 2020 +0000
@@ -0,0 +1,3 @@
+make -f jobs-error-nested-make.mk nested
+false
+exit status 2
diff -r b7bcce0bf6ac -r 62adf63b8f4e usr.bin/make/unit-tests/jobs-error-nested-make.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/jobs-error-nested-make.mk Tue Dec 01 17:50:04 2020 +0000
@@ -0,0 +1,20 @@
+# $NetBSD: jobs-error-nested-make.mk,v 1.1 2020/12/01 17:50:04 rillig Exp $
+#
+# Ensure that in jobs mode, when a command fails, the current directory is
+# printed, to aid in debugging, even if the target is marked as .MAKE.
+# This marker is typically used for targets like 'all' that descend into
+# subdirectories.
+#
+# XXX: In case of .MAKE targets, the "stopped if" output has been suppressed
+# since job.c 1.198 from 2020-06-19.
+#
+# https://gnats.netbsd.org/55578
+# https://gnats.netbsd.org/55832
+
+.MAKEFLAGS: -j1
+
+all: .PHONY .MAKE
+       ${MAKE} -f ${MAKEFILE} nested
+
+nested: .PHONY .MAKE
+       false
diff -r b7bcce0bf6ac -r 62adf63b8f4e usr.bin/make/unit-tests/jobs-error-nested.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/jobs-error-nested.exp     Tue Dec 01 17:50:04 2020 +0000
@@ -0,0 +1,15 @@
+make -f jobs-error-nested.mk nested
+false
+*** [nested] Error code 1
+
+make: stopped in unit-tests
+1 error
+
+make: stopped in unit-tests
+*** [all] Error code 2
+
+make: stopped in unit-tests
+1 error
+
+make: stopped in unit-tests
+exit status 2
diff -r b7bcce0bf6ac -r 62adf63b8f4e usr.bin/make/unit-tests/jobs-error-nested.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/jobs-error-nested.mk      Tue Dec 01 17:50:04 2020 +0000
@@ -0,0 +1,20 @@
+# $NetBSD: jobs-error-nested.mk,v 1.1 2020/12/01 17:50:04 rillig Exp $
+#
+# Ensure that in jobs mode, when a command fails, the current directory is
+# printed, to aid in debugging.
+#
+# XXX: This test is run without the -k flag, which prints "stopped in" 4
+# times.  Why?
+#
+# This particular case is not the cause for the PRs, but it is very close.
+#
+# https://gnats.netbsd.org/55578
+# https://gnats.netbsd.org/55832
+
+.MAKEFLAGS: -j1
+
+all: .PHONY
+       ${MAKE} -f ${MAKEFILE} nested
+
+nested: .PHONY
+       false



Home | Main Index | Thread Index | Old Index