Module Name: src
Committed By: rillig
Date: Tue Dec 1 17:50:04 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: jobs-error-indirect.exp
jobs-error-indirect.mk jobs-error-nested-make.exp
jobs-error-nested-make.mk jobs-error-nested.exp
jobs-error-nested.mk
Log Message:
make(1): add tests for suppressing "stopped in"
These tests demonstrate the unwanted behavior described in PR bin/55578
and PR bin/55832.
To generate a diff of this commit:
cvs rdiff -u -r1.979 -r1.980 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.231 -r1.232 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/jobs-error-indirect.exp \
src/usr.bin/make/unit-tests/jobs-error-indirect.mk \
src/usr.bin/make/unit-tests/jobs-error-nested-make.exp \
src/usr.bin/make/unit-tests/jobs-error-nested-make.mk \
src/usr.bin/make/unit-tests/jobs-error-nested.exp \
src/usr.bin/make/unit-tests/jobs-error-nested.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.979 src/distrib/sets/lists/tests/mi:1.980
--- src/distrib/sets/lists/tests/mi:1.979 Mon Nov 30 21:36:52 2020
+++ src/distrib/sets/lists/tests/mi Tue Dec 1 17:50:04 2020
@@ -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
Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.231 src/usr.bin/make/unit-tests/Makefile:1.232
--- src/usr.bin/make/unit-tests/Makefile:1.231 Mon Nov 30 21:10:15 2020
+++ src/usr.bin/make/unit-tests/Makefile Tue Dec 1 17:50:04 2020
@@ -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+= impsrc
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 @@ ENV.varname-vpath+= VPATH=varname-vpath.
# 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 }
Added files:
Index: src/usr.bin/make/unit-tests/jobs-error-indirect.exp
diff -u /dev/null src/usr.bin/make/unit-tests/jobs-error-indirect.exp:1.1
--- /dev/null Tue Dec 1 17:50:04 2020
+++ src/usr.bin/make/unit-tests/jobs-error-indirect.exp Tue Dec 1 17:50:04 2020
@@ -0,0 +1,8 @@
+false
+*** [indirect] Error code 1
+
+make: stopped in unit-tests
+1 error
+
+make: stopped in unit-tests
+exit status 2
Index: src/usr.bin/make/unit-tests/jobs-error-indirect.mk
diff -u /dev/null src/usr.bin/make/unit-tests/jobs-error-indirect.mk:1.1
--- /dev/null Tue Dec 1 17:50:04 2020
+++ src/usr.bin/make/unit-tests/jobs-error-indirect.mk Tue Dec 1 17:50:04 2020
@@ -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
Index: src/usr.bin/make/unit-tests/jobs-error-nested-make.exp
diff -u /dev/null src/usr.bin/make/unit-tests/jobs-error-nested-make.exp:1.1
--- /dev/null Tue Dec 1 17:50:04 2020
+++ src/usr.bin/make/unit-tests/jobs-error-nested-make.exp Tue Dec 1 17:50:04 2020
@@ -0,0 +1,3 @@
+make -f jobs-error-nested-make.mk nested
+false
+exit status 2
Index: src/usr.bin/make/unit-tests/jobs-error-nested-make.mk
diff -u /dev/null src/usr.bin/make/unit-tests/jobs-error-nested-make.mk:1.1
--- /dev/null Tue Dec 1 17:50:04 2020
+++ src/usr.bin/make/unit-tests/jobs-error-nested-make.mk Tue Dec 1 17:50:04 2020
@@ -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
Index: src/usr.bin/make/unit-tests/jobs-error-nested.exp
diff -u /dev/null src/usr.bin/make/unit-tests/jobs-error-nested.exp:1.1
--- /dev/null Tue Dec 1 17:50:04 2020
+++ src/usr.bin/make/unit-tests/jobs-error-nested.exp Tue Dec 1 17:50:04 2020
@@ -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
Index: src/usr.bin/make/unit-tests/jobs-error-nested.mk
diff -u /dev/null src/usr.bin/make/unit-tests/jobs-error-nested.mk:1.1
--- /dev/null Tue Dec 1 17:50:04 2020
+++ src/usr.bin/make/unit-tests/jobs-error-nested.mk Tue Dec 1 17:50:04 2020
@@ -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