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 tests/make: test the combination of ...



details:   https://anonhg.NetBSD.org/src/rev/6e97d2960b18
branches:  trunk
changeset: 378891:6e97d2960b18
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Apr 27 16:20:06 2021 +0000

description:
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.

diffstat:

 distrib/sets/lists/tests/mi                       |   4 +-
 usr.bin/make/unit-tests/Makefile                  |   3 +-
 usr.bin/make/unit-tests/opt-debug-errors-jobs.exp |  48 +++++++++++++++++++++++
 usr.bin/make/unit-tests/opt-debug-errors-jobs.mk  |  36 +++++++++++++++++
 4 files changed, 89 insertions(+), 2 deletions(-)

diffs (127 lines):

diff -r ea8f9169f440 -r 6e97d2960b18 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Tue Apr 27 15:21:42 2021 +0000
+++ b/distrib/sets/lists/tests/mi       Tue Apr 27 16:20:06 2021 +0000
@@ -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
diff -r ea8f9169f440 -r 6e97d2960b18 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Tue Apr 27 15:21:42 2021 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Tue Apr 27 16:20:06 2021 +0000
@@ -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
diff -r ea8f9169f440 -r 6e97d2960b18 usr.bin/make/unit-tests/opt-debug-errors-jobs.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp Tue Apr 27 16:20:06 2021 +0000
@@ -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
diff -r ea8f9169f440 -r 6e97d2960b18 usr.bin/make/unit-tests/opt-debug-errors-jobs.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/opt-debug-errors-jobs.mk  Tue Apr 27 16:20:06 2021 +0000
@@ -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



Home | Main Index | Thread Index | Old Index