Module Name: src
Committed By: rillig
Date: Sat Feb 12 01:15:18 UTC 2022
Modified Files:
src/distrib/sets/lists/tests: mi
src/usr.bin/make/unit-tests: Makefile
Added Files:
src/usr.bin/make/unit-tests: deptgt-silent-jobs.exp
deptgt-silent-jobs.mk
Log Message:
tests/make: demonstrate bug for .SILENT in jobs mode (since 2003)
Reported 2011 in PR#45356.
To generate a diff of this commit:
cvs rdiff -u -r1.1186 -r1.1187 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.307 -r1.308 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/deptgt-silent-jobs.exp \
src/usr.bin/make/unit-tests/deptgt-silent-jobs.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.1186 src/distrib/sets/lists/tests/mi:1.1187
--- src/distrib/sets/lists/tests/mi:1.1186 Mon Feb 7 22:43:50 2022
+++ src/distrib/sets/lists/tests/mi Sat Feb 12 01:15:17 2022
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1186 2022/02/07 22:43:50 rillig Exp $
+# $NetBSD: mi,v 1.1187 2022/02/12 01:15:17 rillig Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -5561,6 +5561,8 @@
./usr/tests/usr.bin/make/unit-tests/deptgt-precious.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/deptgt-shell.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/deptgt-shell.mk tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/deptgt-silent-jobs.exp tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/deptgt-silent-jobs.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/deptgt-silent.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/deptgt-silent.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/deptgt-stale.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.307 src/usr.bin/make/unit-tests/Makefile:1.308
--- src/usr.bin/make/unit-tests/Makefile:1.307 Wed Feb 9 21:24:29 2022
+++ src/usr.bin/make/unit-tests/Makefile Sat Feb 12 01:15:18 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.307 2022/02/09 21:24:29 rillig Exp $
+# $NetBSD: Makefile,v 1.308 2022/02/12 01:15:18 rillig Exp $
#
# Unit tests for make(1)
#
@@ -146,6 +146,7 @@ TESTS+= deptgt-phony
TESTS+= deptgt-precious
TESTS+= deptgt-shell
TESTS+= deptgt-silent
+TESTS+= deptgt-silent-jobs
TESTS+= deptgt-stale
TESTS+= deptgt-suffixes
TESTS+= dir
Added files:
Index: src/usr.bin/make/unit-tests/deptgt-silent-jobs.exp
diff -u /dev/null src/usr.bin/make/unit-tests/deptgt-silent-jobs.exp:1.1
--- /dev/null Sat Feb 12 01:15:18 2022
+++ src/usr.bin/make/unit-tests/deptgt-silent-jobs.exp Sat Feb 12 01:15:18 2022
@@ -0,0 +1,8 @@
+compat: testing 1
+compat: testing 2
+compat: testing 3
+jobs: testing 1
+echo 'jobs: testing 2'
+jobs: testing 2
+jobs: testing 3
+exit status 0
Index: src/usr.bin/make/unit-tests/deptgt-silent-jobs.mk
diff -u /dev/null src/usr.bin/make/unit-tests/deptgt-silent-jobs.mk:1.1
--- /dev/null Sat Feb 12 01:15:18 2022
+++ src/usr.bin/make/unit-tests/deptgt-silent-jobs.mk Sat Feb 12 01:15:18 2022
@@ -0,0 +1,36 @@
+# $NetBSD: deptgt-silent-jobs.mk,v 1.1 2022/02/12 01:15:18 rillig Exp $
+#
+# Ensure that the special dependency target '.SILENT' only affects the amount
+# of output, but not the kind of error handling.
+#
+# History:
+# In job.c 1.83 from 2003.12.20.00.18.22, in an attempt to fix
+# https://gnats.netbsd.org/18573, commands that suppressed error
+# handling were output in jobs mode, even when the global '.SILENT'
+# was set.
+#
+# See also:
+# https://gnats.netbsd.org/45356
+
+all: compat jobs
+.PHONY: all compat jobs test
+
+.SILENT:
+test:
+ @echo '${VARIANT}: testing 1'
+ -echo '${VARIANT}: testing 2'
+ echo '${VARIANT}: testing 3'
+
+# expect: compat: testing 1
+# expect: compat: testing 2
+# expect: compat: testing 3
+compat:
+ @${MAKE} -r -f ${MAKEFILE} test VARIANT=compat
+
+# expect: jobs: testing 1
+# FIXME: suppress 'echo 'jobs: testing 2''
+# expect: echo 'jobs: testing 2'
+# expect: jobs: testing 2
+# expect: jobs: testing 3
+jobs:
+ @${MAKE} -r -f ${MAKEFILE} test VARIANT=jobs -j1