Module Name:    src
Committed By:   rillig
Date:           Tue Apr 27 16:20:06 UTC 2021

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

Log Message:
tests/make: test the combination of -de with -j1

The test cases are the same as in opt-debug-errors.mk.  The output
differs in several details though.

Even though the option '-k' is given (which is the default for any tests
that don't override it in unit-tests/Makefile), there is no message
"(continuing)" anywhere.

The failed target is printed twice.  Once before the failed commands,
once after.  This redundancy is not necessary and may be removed in a
follow-up commit.

The printed commands are in their unexpanded form, which may or may not
be more helpful than the expanded and space-normalized form of compat
mode.  Either way, this is an unnecessary inconsistency between compat
mode and jobs mode.

In jobs mode, the message "make: stopped in $dir" is printed for each
failure, which is helpful since each of the jobs may have started in a
separate directory.


To generate a diff of this commit:
cvs rdiff -u -r1.1045 -r1.1046 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.276 -r1.277 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp \
    src/usr.bin/make/unit-tests/opt-debug-errors-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.1045 src/distrib/sets/lists/tests/mi:1.1046
--- src/distrib/sets/lists/tests/mi:1.1045	Thu Apr 22 22:43:26 2021
+++ src/distrib/sets/lists/tests/mi	Tue Apr 27 16:20:06 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1045 2021/04/22 22:43:26 rillig Exp $
+# $NetBSD: mi,v 1.1046 2021/04/27 16:20:06 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5533,6 +5533,8 @@
 ./usr/tests/usr.bin/make/unit-tests/opt-debug-curdir.mk				tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/opt-debug-dir.exp				tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/opt-debug-dir.mk				tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/opt-debug-errors-jobs.mk			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/opt-debug-errors.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/opt-debug-errors.mk				tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/opt-debug-file.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.276 src/usr.bin/make/unit-tests/Makefile:1.277
--- src/usr.bin/make/unit-tests/Makefile:1.276	Thu Apr 15 19:02:29 2021
+++ src/usr.bin/make/unit-tests/Makefile	Tue Apr 27 16:20:06 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.276 2021/04/15 19:02:29 rillig Exp $
+# $NetBSD: Makefile,v 1.277 2021/04/27 16:20:06 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -230,6 +230,7 @@ TESTS+=		opt-debug-curdir
 TESTS+=		opt-debug-cond
 TESTS+=		opt-debug-dir
 TESTS+=		opt-debug-errors
+TESTS+=		opt-debug-errors-jobs
 TESTS+=		opt-debug-file
 TESTS+=		opt-debug-for
 TESTS+=		opt-debug-graph1

Added files:

Index: src/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp
diff -u /dev/null src/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp:1.1
--- /dev/null	Tue Apr 27 16:20:06 2021
+++ src/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp	Tue Apr 27 16:20:06 2021
@@ -0,0 +1,48 @@
+echo '3   spaces'; false
+3   spaces
+
+*** Failed target:  fail-spaces
+*** Failed commands:
+	echo '3   spaces'; false
+*** [fail-spaces] Error code 1
+
+make: stopped in unit-tests
+echo \  indented; false
+  indented
+
+*** Failed target:  fail-escaped-space
+*** Failed commands:
+	echo \  indented; false
+*** [fail-escaped-space] Error code 1
+
+make: stopped in unit-tests
+echo 'line1
+line2'; false
+line1
+line2
+
+*** Failed target:  fail-newline
+*** Failed commands:
+	echo 'line1${.newline}line2'; false
+*** [fail-newline] Error code 1
+
+make: stopped in unit-tests
+echo 'line1 line2'; false
+line1 line2
+
+*** Failed target:  fail-multiline
+*** Failed commands:
+	echo 'line1 line2'; false
+*** [fail-multiline] Error code 1
+
+make: stopped in unit-tests
+echo	'word1'							 'word2'; false
+word1 word2
+
+*** Failed target:  fail-multiline-intention
+*** Failed commands:
+	echo	'word1'							 'word2'; false
+*** [fail-multiline-intention] Error code 1
+
+make: stopped in unit-tests
+exit status 1
Index: src/usr.bin/make/unit-tests/opt-debug-errors-jobs.mk
diff -u /dev/null src/usr.bin/make/unit-tests/opt-debug-errors-jobs.mk:1.1
--- /dev/null	Tue Apr 27 16:20:06 2021
+++ src/usr.bin/make/unit-tests/opt-debug-errors-jobs.mk	Tue Apr 27 16:20:06 2021
@@ -0,0 +1,36 @@
+# $NetBSD: opt-debug-errors-jobs.mk,v 1.1 2021/04/27 16:20:06 rillig Exp $
+#
+# Tests for the -de command line option, which adds debug logging for
+# failed commands and targets; since 2021-04-27 also in jobs mode.
+
+.MAKEFLAGS: -de -j1
+
+all: fail-spaces
+all: fail-escaped-space
+all: fail-newline
+all: fail-multiline
+all: fail-multiline-intention
+
+fail-spaces:
+	echo '3   spaces'; false
+
+fail-escaped-space:
+	echo \  indented; false
+
+fail-newline:
+	echo 'line1${.newline}line2'; false
+
+# The line continuations in multiline commands are turned into an ordinary
+# space before the command is actually run.
+fail-multiline:
+	echo 'line1\
+		line2'; false
+
+# It is a common style to align the continuation backslashes at the right
+# of the lines, usually at column 73.  All spaces before the continuation
+# backslash are preserved and are usually outside a shell word and thus
+# irrelevant.  Since "usually" is not "always", these space characters are
+# not merged into a single space.
+fail-multiline-intention:
+	echo	'word1'							\
+		'word2'; false

Reply via email to