Module Name:    src
Committed By:   rillig
Date:           Sun Nov 15 20:20:59 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: Makefile dep-double-colon.mk dep-exclam.mk
            depsrc-ignore.mk depsrc-make.mk depsrc-precious.mk
            depsrc-usebefore.mk depsrc.mk deptgt-error.mk deptgt-ignore.mk
            deptgt-interrupt.mk deptgt-main.mk deptgt-makeflags.mk
            directive-for.exp directive-for.mk directive-if.exp directive-if.mk
            directive-ifmake.exp directive-ifmake.mk directive-sinclude.mk
            moderrs.mk modmisc.mk modword.mk sh-leading-at.mk
            sh-leading-hyphen.mk sh-meta-chars.mk var-op-assign.exp
            var-op-assign.mk var-op-sunsh.mk varmod-shell.mk varmod-subst.mk
            varmod-to-lower.mk varmod-to-separator.mk varmod-undefined.mk

Log Message:
make(1): update and add comments in tests

As a result of the new comments, some line numbers have changed in the
output of the tests.  No other changes.


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/dep-double-colon.mk \
    src/usr.bin/make/unit-tests/depsrc-ignore.mk \
    src/usr.bin/make/unit-tests/directive-ifmake.exp \
    src/usr.bin/make/unit-tests/modword.mk \
    src/usr.bin/make/unit-tests/sh-leading-at.mk \
    src/usr.bin/make/unit-tests/varmod-to-lower.mk
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/dep-exclam.mk \
    src/usr.bin/make/unit-tests/depsrc-precious.mk \
    src/usr.bin/make/unit-tests/depsrc.mk \
    src/usr.bin/make/unit-tests/deptgt-error.mk \
    src/usr.bin/make/unit-tests/deptgt-ignore.mk \
    src/usr.bin/make/unit-tests/deptgt-interrupt.mk \
    src/usr.bin/make/unit-tests/deptgt-main.mk \
    src/usr.bin/make/unit-tests/sh-leading-hyphen.mk \
    src/usr.bin/make/unit-tests/sh-meta-chars.mk \
    src/usr.bin/make/unit-tests/varmod-shell.mk
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/depsrc-make.mk \
    src/usr.bin/make/unit-tests/var-op-assign.exp
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/depsrc-usebefore.mk \
    src/usr.bin/make/unit-tests/deptgt-makeflags.mk \
    src/usr.bin/make/unit-tests/directive-if.exp \
    src/usr.bin/make/unit-tests/var-op-sunsh.mk
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/directive-for.exp \
    src/usr.bin/make/unit-tests/directive-if.mk \
    src/usr.bin/make/unit-tests/var-op-assign.mk \
    src/usr.bin/make/unit-tests/varmod-subst.mk \
    src/usr.bin/make/unit-tests/varmod-to-separator.mk \
    src/usr.bin/make/unit-tests/varmod-undefined.mk
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/directive-for.mk
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/directive-ifmake.mk
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/directive-sinclude.mk
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/make/unit-tests/moderrs.mk
cvs rdiff -u -r1.50 -r1.51 src/usr.bin/make/unit-tests/modmisc.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.200 src/usr.bin/make/unit-tests/Makefile:1.201
--- src/usr.bin/make/unit-tests/Makefile:1.200	Sat Nov 14 18:07:26 2020
+++ src/usr.bin/make/unit-tests/Makefile	Sun Nov 15 20:20:58 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.200 2020/11/14 18:07:26 rillig Exp $
+# $NetBSD: Makefile,v 1.201 2020/11/15 20:20:58 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -381,6 +381,26 @@ TESTS+=		varparse-mod
 TESTS+=		varparse-undef-partial
 TESTS+=		varquote
 
+# Ideas for more tests:
+#	char-0020-space.mk
+#	char-005C-backslash.mk
+#	escape-cond-str.mk
+#	escape-cond-func-arg.mk
+#	escape-cond-func-arg.mk
+#	escape-varmod.mk
+#	escape-varmod-define.mk
+#	escape-varmod-match.mk
+#	escape-varname.mk
+#	escape-varassign-varname.mk
+#	escape-varassign-varname-cmdline.mk
+#	escape-varassign-value.mk
+#	escape-varassign-value-cmdline.mk
+#	escape-dependency-source.mk
+#	escape-dependency-target.mk
+#	escape-for-varname.mk
+#	escape-for-item.mk
+#	posix-*.mk (see posix.mk and posix1.mk)
+
 .if ${.OBJDIR} != ${.CURDIR}
 RO_OBJDIR:=	${.OBJDIR}/roobj
 .else

Index: src/usr.bin/make/unit-tests/dep-double-colon.mk
diff -u src/usr.bin/make/unit-tests/dep-double-colon.mk:1.4 src/usr.bin/make/unit-tests/dep-double-colon.mk:1.5
--- src/usr.bin/make/unit-tests/dep-double-colon.mk:1.4	Sat Sep 26 15:41:53 2020
+++ src/usr.bin/make/unit-tests/dep-double-colon.mk	Sun Nov 15 20:20:58 2020
@@ -1,6 +1,9 @@
-# $NetBSD: dep-double-colon.mk,v 1.4 2020/09/26 15:41:53 rillig Exp $
+# $NetBSD: dep-double-colon.mk,v 1.5 2020/11/15 20:20:58 rillig Exp $
 #
-# Tests for the :: operator in dependency declarations.
+# Tests for the '::' operator in dependency declarations, which allows
+# several dependency groups for a single node, each having its own attributes
+# and dependencies.  In the code, the additional dependency groups are called
+# cohorts.
 
 all::
 	@echo 'command 1a'
Index: src/usr.bin/make/unit-tests/depsrc-ignore.mk
diff -u src/usr.bin/make/unit-tests/depsrc-ignore.mk:1.4 src/usr.bin/make/unit-tests/depsrc-ignore.mk:1.5
--- src/usr.bin/make/unit-tests/depsrc-ignore.mk:1.4	Sat Aug 29 16:13:27 2020
+++ src/usr.bin/make/unit-tests/depsrc-ignore.mk	Sun Nov 15 20:20:58 2020
@@ -1,11 +1,10 @@
-# $NetBSD: depsrc-ignore.mk,v 1.4 2020/08/29 16:13:27 rillig Exp $
+# $NetBSD: depsrc-ignore.mk,v 1.5 2020/11/15 20:20:58 rillig Exp $
 #
 # Tests for the special source .IGNORE in dependency declarations,
 # which ignores any command failures for that target.
 #
-# Even though ignore-errors fails, the all target is still made.
-# Since the all target is not marked with .IGNORE, it stops at the
-# first failing command.
+# Even though 'ignore-errors' fails, 'all' is still made.  Since 'all' is
+# not marked with .IGNORE, it stops at the first failing command.
 #
 # XXX: The ordering of the messages in the output is confusing.
 # The "ignored" comes much too late to be related to the "false
@@ -24,8 +23,8 @@
 # This is what actually happens, as of 2020-08-29.  To verify it, set the
 # following breakpoints in CompatRunCommand:
 #
-# * the "!silent" line, to see all commands.
-# * the "fflush" line, to see stdout being flushed.
+# * the "!silent" line, to see all commands
+# * the "fflush" line, to see stdout being flushed
 # * the "status = WEXITSTATUS" line
 # * the "(continuing)" line
 # * the "(ignored)" line
Index: src/usr.bin/make/unit-tests/directive-ifmake.exp
diff -u src/usr.bin/make/unit-tests/directive-ifmake.exp:1.4 src/usr.bin/make/unit-tests/directive-ifmake.exp:1.5
--- src/usr.bin/make/unit-tests/directive-ifmake.exp:1.4	Wed Nov 11 07:13:42 2020
+++ src/usr.bin/make/unit-tests/directive-ifmake.exp	Sun Nov 15 20:20:58 2020
@@ -1,10 +1,10 @@
-make: "directive-ifmake.mk" line 10: ok: positive condition works
-make: "directive-ifmake.mk" line 21: ok: negation works
-make: "directive-ifmake.mk" line 27: ok: double negation works
-make: "directive-ifmake.mk" line 34: ok: both mentioned
-make: "directive-ifmake.mk" line 41: ok: only those mentioned
-make: "directive-ifmake.mk" line 51: Targets can even be added at parse time.
-make: "directive-ifmake.mk" line 69: ok
+make: "directive-ifmake.mk" line 13: ok: positive condition works
+make: "directive-ifmake.mk" line 24: ok: negation works
+make: "directive-ifmake.mk" line 33: ok: double negation works
+make: "directive-ifmake.mk" line 40: ok: both mentioned
+make: "directive-ifmake.mk" line 47: ok: only those mentioned
+make: "directive-ifmake.mk" line 57: Targets can even be added at parse time.
+make: "directive-ifmake.mk" line 75: ok
 : first
 : second
 : late-target
Index: src/usr.bin/make/unit-tests/modword.mk
diff -u src/usr.bin/make/unit-tests/modword.mk:1.4 src/usr.bin/make/unit-tests/modword.mk:1.5
--- src/usr.bin/make/unit-tests/modword.mk:1.4	Sun Nov  1 13:55:31 2020
+++ src/usr.bin/make/unit-tests/modword.mk	Sun Nov 15 20:20:58 2020
@@ -1,6 +1,7 @@
-# $NetBSD: modword.mk,v 1.4 2020/11/01 13:55:31 rillig Exp $
+# $NetBSD: modword.mk,v 1.5 2020/11/15 20:20:58 rillig Exp $
 #
 # Test behaviour of new :[] modifier
+# TODO: When was this modifier new?
 
 all: mod-squarebrackets mod-S-W mod-C-W mod-tW-tw
 
Index: src/usr.bin/make/unit-tests/sh-leading-at.mk
diff -u src/usr.bin/make/unit-tests/sh-leading-at.mk:1.4 src/usr.bin/make/unit-tests/sh-leading-at.mk:1.5
--- src/usr.bin/make/unit-tests/sh-leading-at.mk:1.4	Mon Nov  9 20:57:36 2020
+++ src/usr.bin/make/unit-tests/sh-leading-at.mk	Sun Nov 15 20:20:58 2020
@@ -1,7 +1,12 @@
-# $NetBSD: sh-leading-at.mk,v 1.4 2020/11/09 20:57:36 rillig Exp $
+# $NetBSD: sh-leading-at.mk,v 1.5 2020/11/15 20:20:58 rillig Exp $
 #
 # Tests for shell commands preceded by an '@', to suppress printing
 # the command to stdout.
+#
+# See also:
+#	.SILENT
+#	depsrc-silent.mk
+#	opt-silent.mk
 
 all:
 	@
Index: src/usr.bin/make/unit-tests/varmod-to-lower.mk
diff -u src/usr.bin/make/unit-tests/varmod-to-lower.mk:1.4 src/usr.bin/make/unit-tests/varmod-to-lower.mk:1.5
--- src/usr.bin/make/unit-tests/varmod-to-lower.mk:1.4	Sat Oct 24 08:46:08 2020
+++ src/usr.bin/make/unit-tests/varmod-to-lower.mk	Sun Nov 15 20:20:58 2020
@@ -1,7 +1,9 @@
-# $NetBSD: varmod-to-lower.mk,v 1.4 2020/10/24 08:46:08 rillig Exp $
+# $NetBSD: varmod-to-lower.mk,v 1.5 2020/11/15 20:20:58 rillig Exp $
 #
 # Tests for the :tl variable modifier, which returns the words in the
 # variable value, converted to lowercase.
+#
+# TODO: What about non-ASCII characters? ISO-8859-1, UTF-8?
 
 .if ${:UUPPER:tl} != "upper"
 .  error

Index: src/usr.bin/make/unit-tests/dep-exclam.mk
diff -u src/usr.bin/make/unit-tests/dep-exclam.mk:1.2 src/usr.bin/make/unit-tests/dep-exclam.mk:1.3
--- src/usr.bin/make/unit-tests/dep-exclam.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/dep-exclam.mk	Sun Nov 15 20:20:58 2020
@@ -1,6 +1,11 @@
-# $NetBSD: dep-exclam.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: dep-exclam.mk,v 1.3 2020/11/15 20:20:58 rillig Exp $
 #
-# Tests for the ! operator in dependency declarations.
+# Tests for the ! operator in dependency declarations, which always re-creates
+# the target, whether or not it is out of date.
+#
+# TODO: Is this related to OP_PHONY?
+# TODO: Is this related to OP_EXEC?
+# TODO: Is this related to OP_MAKE?
 
 # TODO: Implementation
 
Index: src/usr.bin/make/unit-tests/depsrc-precious.mk
diff -u src/usr.bin/make/unit-tests/depsrc-precious.mk:1.2 src/usr.bin/make/unit-tests/depsrc-precious.mk:1.3
--- src/usr.bin/make/unit-tests/depsrc-precious.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/depsrc-precious.mk	Sun Nov 15 20:20:58 2020
@@ -1,6 +1,14 @@
-# $NetBSD: depsrc-precious.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: depsrc-precious.mk,v 1.3 2020/11/15 20:20:58 rillig Exp $
 #
-# Tests for the special source .PRECIOUS in dependency declarations.
+# Tests for the special source .PRECIOUS in dependency declarations, which
+# is only relevant if the commands for the target fail or are interrupted.
+# In such a case, the target file is usually removed, to avoid having
+# half-finished files with a timestamp suggesting the file were up-to-date.
+#
+# For targets marked with .PRECIOUS, the target file is not removed.
+# The author of the makefile is then responsible for avoiding the above
+# situation, in which the target would be wrongly considered up-to-date,
+# just because its timestamp says so.
 
 # TODO: Implementation
 
Index: src/usr.bin/make/unit-tests/depsrc.mk
diff -u src/usr.bin/make/unit-tests/depsrc.mk:1.2 src/usr.bin/make/unit-tests/depsrc.mk:1.3
--- src/usr.bin/make/unit-tests/depsrc.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/depsrc.mk	Sun Nov 15 20:20:58 2020
@@ -1,9 +1,11 @@
-# $NetBSD: depsrc.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: depsrc.mk,v 1.3 2020/11/15 20:20:58 rillig Exp $
 #
 # Tests for special sources (those starting with a dot, followed by
 # uppercase letters) in dependency declarations, such as .PHONY.
 
 # TODO: Implementation
 
+# TODO: Test 'target: ${:U.SILENT}'
+
 all:
 	@:;
Index: src/usr.bin/make/unit-tests/deptgt-error.mk
diff -u src/usr.bin/make/unit-tests/deptgt-error.mk:1.2 src/usr.bin/make/unit-tests/deptgt-error.mk:1.3
--- src/usr.bin/make/unit-tests/deptgt-error.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/deptgt-error.mk	Sun Nov 15 20:20:58 2020
@@ -1,6 +1,7 @@
-# $NetBSD: deptgt-error.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: deptgt-error.mk,v 1.3 2020/11/15 20:20:58 rillig Exp $
 #
-# Tests for the special target .ERROR in dependency declarations.
+# Tests for the special target .ERROR in dependency declarations, which
+# collects commands that are run when another target fails.
 
 # TODO: Implementation
 
Index: src/usr.bin/make/unit-tests/deptgt-ignore.mk
diff -u src/usr.bin/make/unit-tests/deptgt-ignore.mk:1.2 src/usr.bin/make/unit-tests/deptgt-ignore.mk:1.3
--- src/usr.bin/make/unit-tests/deptgt-ignore.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/deptgt-ignore.mk	Sun Nov 15 20:20:58 2020
@@ -1,6 +1,7 @@
-# $NetBSD: deptgt-ignore.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: deptgt-ignore.mk,v 1.3 2020/11/15 20:20:58 rillig Exp $
 #
-# Tests for the special target .IGNORE in dependency declarations.
+# Tests for the special target .IGNORE in dependency declarations, which
+# does not stop if a command from this target exits with a non-zero status.
 
 # TODO: Implementation
 
Index: src/usr.bin/make/unit-tests/deptgt-interrupt.mk
diff -u src/usr.bin/make/unit-tests/deptgt-interrupt.mk:1.2 src/usr.bin/make/unit-tests/deptgt-interrupt.mk:1.3
--- src/usr.bin/make/unit-tests/deptgt-interrupt.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/deptgt-interrupt.mk	Sun Nov 15 20:20:58 2020
@@ -1,6 +1,8 @@
-# $NetBSD: deptgt-interrupt.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: deptgt-interrupt.mk,v 1.3 2020/11/15 20:20:58 rillig Exp $
 #
-# Tests for the special target .INTERRUPT in dependency declarations.
+# Tests for the special target .INTERRUPT in dependency declarations, which
+# collects commands to be run when make is interrupted while building another
+# target.
 
 # TODO: Implementation
 
Index: src/usr.bin/make/unit-tests/deptgt-main.mk
diff -u src/usr.bin/make/unit-tests/deptgt-main.mk:1.2 src/usr.bin/make/unit-tests/deptgt-main.mk:1.3
--- src/usr.bin/make/unit-tests/deptgt-main.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/deptgt-main.mk	Sun Nov 15 20:20:58 2020
@@ -1,6 +1,8 @@
-# $NetBSD: deptgt-main.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: deptgt-main.mk,v 1.3 2020/11/15 20:20:58 rillig Exp $
 #
-# Tests for the special target .MAIN in dependency declarations.
+# Tests for the special target .MAIN in dependency declarations, which defines
+# the main target.  This main target is built if no target has been specified
+# on the command line or via MAKEFLAGS.
 
 # TODO: Implementation
 
Index: src/usr.bin/make/unit-tests/sh-leading-hyphen.mk
diff -u src/usr.bin/make/unit-tests/sh-leading-hyphen.mk:1.2 src/usr.bin/make/unit-tests/sh-leading-hyphen.mk:1.3
--- src/usr.bin/make/unit-tests/sh-leading-hyphen.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/sh-leading-hyphen.mk	Sun Nov 15 20:20:58 2020
@@ -1,7 +1,12 @@
-# $NetBSD: sh-leading-hyphen.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: sh-leading-hyphen.mk,v 1.3 2020/11/15 20:20:58 rillig Exp $
 #
 # Tests for shell commands preceded by a '-', to ignore the exit status of
 # the command line.
+#
+# See also:
+#	.IGNORE
+#	depsrc-ignore.mk
+#	opt-ignore.mk
 
 # TODO: Implementation
 
Index: src/usr.bin/make/unit-tests/sh-meta-chars.mk
diff -u src/usr.bin/make/unit-tests/sh-meta-chars.mk:1.2 src/usr.bin/make/unit-tests/sh-meta-chars.mk:1.3
--- src/usr.bin/make/unit-tests/sh-meta-chars.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/sh-meta-chars.mk	Sun Nov 15 20:20:58 2020
@@ -1,9 +1,13 @@
-# $NetBSD: sh-meta-chars.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: sh-meta-chars.mk,v 1.3 2020/11/15 20:20:58 rillig Exp $
 #
 # Tests for running shell commands that contain meta-characters.
 #
 # These meta-characters decide whether the command is run by the shell
-# or executed directly via execv.  See Cmd_Exec for details.
+# or executed directly via execv, but only in compatibility mode, not
+# in jobs mode, and only if MAKE_NATIVE is defined during compilation.
+#
+# See also:
+#	Compat_RunCommand, useShell
 
 # TODO: Implementation
 
Index: src/usr.bin/make/unit-tests/varmod-shell.mk
diff -u src/usr.bin/make/unit-tests/varmod-shell.mk:1.2 src/usr.bin/make/unit-tests/varmod-shell.mk:1.3
--- src/usr.bin/make/unit-tests/varmod-shell.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/varmod-shell.mk	Sun Nov 15 20:20:58 2020
@@ -1,7 +1,9 @@
-# $NetBSD: varmod-shell.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: varmod-shell.mk,v 1.3 2020/11/15 20:20:58 rillig Exp $
 #
 # Tests for the :sh variable modifier, which runs the shell command
 # given by the variable value and returns its output.
+#
+# TODO: Since when is this modifier available?
 
 # TODO: Implementation
 

Index: src/usr.bin/make/unit-tests/depsrc-make.mk
diff -u src/usr.bin/make/unit-tests/depsrc-make.mk:1.3 src/usr.bin/make/unit-tests/depsrc-make.mk:1.4
--- src/usr.bin/make/unit-tests/depsrc-make.mk:1.3	Sat Sep  5 15:57:12 2020
+++ src/usr.bin/make/unit-tests/depsrc-make.mk	Sun Nov 15 20:20:58 2020
@@ -1,9 +1,11 @@
-# $NetBSD: depsrc-make.mk,v 1.3 2020/09/05 15:57:12 rillig Exp $
+# $NetBSD: depsrc-make.mk,v 1.4 2020/11/15 20:20:58 rillig Exp $
 #
 # Tests for the special source .MAKE in dependency declarations, which
 # executes the commands of the target even if the -n or -t command line
 # options are given.
 
+# TODO: Add a test for the -t command line option.
+
 .MAKEFLAGS: -n
 
 all: this-is-made
Index: src/usr.bin/make/unit-tests/var-op-assign.exp
diff -u src/usr.bin/make/unit-tests/var-op-assign.exp:1.3 src/usr.bin/make/unit-tests/var-op-assign.exp:1.4
--- src/usr.bin/make/unit-tests/var-op-assign.exp:1.3	Tue Aug 25 16:20:32 2020
+++ src/usr.bin/make/unit-tests/var-op-assign.exp	Sun Nov 15 20:20:58 2020
@@ -1,6 +1,6 @@
 this will be evaluated later
-make: "var-op-assign.mk" line 52: Need an operator
-make: "var-op-assign.mk" line 86: Parsing still continues until here.
+make: "var-op-assign.mk" line 59: Need an operator
+make: "var-op-assign.mk" line 93: Parsing still continues until here.
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1

Index: src/usr.bin/make/unit-tests/depsrc-usebefore.mk
diff -u src/usr.bin/make/unit-tests/depsrc-usebefore.mk:1.5 src/usr.bin/make/unit-tests/depsrc-usebefore.mk:1.6
--- src/usr.bin/make/unit-tests/depsrc-usebefore.mk:1.5	Sat Aug 22 11:53:18 2020
+++ src/usr.bin/make/unit-tests/depsrc-usebefore.mk	Sun Nov 15 20:20:58 2020
@@ -1,7 +1,11 @@
-# $NetBSD: depsrc-usebefore.mk,v 1.5 2020/08/22 11:53:18 rillig Exp $
+# $NetBSD: depsrc-usebefore.mk,v 1.6 2020/11/15 20:20:58 rillig Exp $
 #
 # Tests for the special source .USEBEFORE in dependency declarations,
 # which allows to prepend common commands to other targets.
+#
+# See also:
+#	.USE
+#	depsrc-use.mk
 
 all: action directly
 
Index: src/usr.bin/make/unit-tests/deptgt-makeflags.mk
diff -u src/usr.bin/make/unit-tests/deptgt-makeflags.mk:1.5 src/usr.bin/make/unit-tests/deptgt-makeflags.mk:1.6
--- src/usr.bin/make/unit-tests/deptgt-makeflags.mk:1.5	Sun Nov  8 02:31:24 2020
+++ src/usr.bin/make/unit-tests/deptgt-makeflags.mk	Sun Nov 15 20:20:58 2020
@@ -1,7 +1,10 @@
-# $NetBSD: deptgt-makeflags.mk,v 1.5 2020/11/08 02:31:24 rillig Exp $
+# $NetBSD: deptgt-makeflags.mk,v 1.6 2020/11/15 20:20:58 rillig Exp $
 #
 # Tests for the special target .MAKEFLAGS in dependency declarations,
 # which adds command line options later, at parse time.
+#
+# In these unit tests, it is often used to temporarily toggle the debug log
+# during parsing.
 
 # The -D option sets a variable in the "Global" scope and thus can be
 # undefined later.
Index: src/usr.bin/make/unit-tests/directive-if.exp
diff -u src/usr.bin/make/unit-tests/directive-if.exp:1.5 src/usr.bin/make/unit-tests/directive-if.exp:1.6
--- src/usr.bin/make/unit-tests/directive-if.exp:1.5	Thu Nov 12 19:46:36 2020
+++ src/usr.bin/make/unit-tests/directive-if.exp	Sun Nov 15 20:20:58 2020
@@ -1,15 +1,15 @@
-make: "directive-if.mk" line 10: 0 evaluates to false.
-make: "directive-if.mk" line 14: 1 evaluates to true.
-make: "directive-if.mk" line 37: Unknown directive "ifx"
-make: "directive-if.mk" line 38: Unknown directive "error"
-make: "directive-if.mk" line 39: if-less else
-make: "directive-if.mk" line 40: Unknown directive "error"
-make: "directive-if.mk" line 41: if-less endif
-make: "directive-if.mk" line 44: Malformed conditional ()
-make: "directive-if.mk" line 54: Quotes in plain words are probably a mistake.
-make: "directive-if.mk" line 63: Don't do this, always put a space after a directive.
-make: "directive-if.mk" line 67: Don't do this, always put a space after a directive.
-make: "directive-if.mk" line 73: Don't do this, always put a space around comparison operators.
+make: "directive-if.mk" line 13: 0 evaluates to false.
+make: "directive-if.mk" line 17: 1 evaluates to true.
+make: "directive-if.mk" line 40: Unknown directive "ifx"
+make: "directive-if.mk" line 41: Unknown directive "error"
+make: "directive-if.mk" line 42: if-less else
+make: "directive-if.mk" line 43: Unknown directive "error"
+make: "directive-if.mk" line 44: if-less endif
+make: "directive-if.mk" line 47: Malformed conditional ()
+make: "directive-if.mk" line 57: Quotes in plain words are probably a mistake.
+make: "directive-if.mk" line 66: Don't do this, always put a space after a directive.
+make: "directive-if.mk" line 70: Don't do this, always put a space after a directive.
+make: "directive-if.mk" line 76: Don't do this, always put a space around comparison operators.
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1
Index: src/usr.bin/make/unit-tests/var-op-sunsh.mk
diff -u src/usr.bin/make/unit-tests/var-op-sunsh.mk:1.5 src/usr.bin/make/unit-tests/var-op-sunsh.mk:1.6
--- src/usr.bin/make/unit-tests/var-op-sunsh.mk:1.5	Sun Oct  4 08:32:52 2020
+++ src/usr.bin/make/unit-tests/var-op-sunsh.mk	Sun Nov 15 20:20:58 2020
@@ -1,4 +1,4 @@
-# $NetBSD: var-op-sunsh.mk,v 1.5 2020/10/04 08:32:52 rillig Exp $
+# $NetBSD: var-op-sunsh.mk,v 1.6 2020/11/15 20:20:58 rillig Exp $
 #
 # Tests for the :sh= variable assignment operator, which runs its right-hand
 # side through the shell.  It is a seldom-used alternative to the !=
@@ -118,5 +118,7 @@ VAR :sh +=	echo two
 .  error ${VAR}
 .endif
 
+# TODO: test VAR:sh!=command
+
 all:
 	@:;

Index: src/usr.bin/make/unit-tests/directive-for.exp
diff -u src/usr.bin/make/unit-tests/directive-for.exp:1.6 src/usr.bin/make/unit-tests/directive-for.exp:1.7
--- src/usr.bin/make/unit-tests/directive-for.exp:1.6	Sun Oct 25 15:49:03 2020
+++ src/usr.bin/make/unit-tests/directive-for.exp	Sun Nov 15 20:20:58 2020
@@ -1,19 +1,19 @@
-make: "directive-for.mk" line 100: outer
-make: "directive-for.mk" line 125: a:\ a:\file.txt
-make: "directive-for.mk" line 125: d:\\
-make: "directive-for.mk" line 125: d:\\file.txt
-make: "directive-for.mk" line 132: ( ( (
-make: "directive-for.mk" line 132: [ [ [
-make: "directive-for.mk" line 132: { { {
-make: "directive-for.mk" line 132: ) ) )
-make: "directive-for.mk" line 132: ] ] ]
-make: "directive-for.mk" line 132: } } }
-make: "directive-for.mk" line 132: (()) (()) (())
-make: "directive-for.mk" line 132: [[]] [[]] [[]]
-make: "directive-for.mk" line 132: {{}} {{}} {{}}
-make: "directive-for.mk" line 132: )( )( )(
-make: "directive-for.mk" line 132: ][ ][ ][
-make: "directive-for.mk" line 132: }{ }{ }{
-make: "directive-for.mk" line 140: outer value value
-make: "directive-for.mk" line 140: outer "quoted" \"quoted\"
+make: "directive-for.mk" line 108: outer
+make: "directive-for.mk" line 133: a:\ a:\file.txt
+make: "directive-for.mk" line 133: d:\\
+make: "directive-for.mk" line 133: d:\\file.txt
+make: "directive-for.mk" line 140: ( ( (
+make: "directive-for.mk" line 140: [ [ [
+make: "directive-for.mk" line 140: { { {
+make: "directive-for.mk" line 140: ) ) )
+make: "directive-for.mk" line 140: ] ] ]
+make: "directive-for.mk" line 140: } } }
+make: "directive-for.mk" line 140: (()) (()) (())
+make: "directive-for.mk" line 140: [[]] [[]] [[]]
+make: "directive-for.mk" line 140: {{}} {{}} {{}}
+make: "directive-for.mk" line 140: )( )( )(
+make: "directive-for.mk" line 140: ][ ][ ][
+make: "directive-for.mk" line 140: }{ }{ }{
+make: "directive-for.mk" line 148: outer value value
+make: "directive-for.mk" line 148: outer "quoted" \"quoted\"
 exit status 0
Index: src/usr.bin/make/unit-tests/directive-if.mk
diff -u src/usr.bin/make/unit-tests/directive-if.mk:1.6 src/usr.bin/make/unit-tests/directive-if.mk:1.7
--- src/usr.bin/make/unit-tests/directive-if.mk:1.6	Thu Nov 12 19:46:36 2020
+++ src/usr.bin/make/unit-tests/directive-if.mk	Sun Nov 15 20:20:58 2020
@@ -1,6 +1,9 @@
-# $NetBSD: directive-if.mk,v 1.6 2020/11/12 19:46:36 rillig Exp $
+# $NetBSD: directive-if.mk,v 1.7 2020/11/15 20:20:58 rillig Exp $
 #
 # Tests for the .if directive.
+#
+# See also:
+#	cond-*.mk
 
 # TODO: Implementation
 
Index: src/usr.bin/make/unit-tests/var-op-assign.mk
diff -u src/usr.bin/make/unit-tests/var-op-assign.mk:1.6 src/usr.bin/make/unit-tests/var-op-assign.mk:1.7
--- src/usr.bin/make/unit-tests/var-op-assign.mk:1.6	Sat Oct 24 08:50:17 2020
+++ src/usr.bin/make/unit-tests/var-op-assign.mk	Sun Nov 15 20:20:58 2020
@@ -1,11 +1,12 @@
-# $NetBSD: var-op-assign.mk,v 1.6 2020/10/24 08:50:17 rillig Exp $
+# $NetBSD: var-op-assign.mk,v 1.7 2020/11/15 20:20:58 rillig Exp $
 #
 # Tests for the = variable assignment operator, which overwrites an existing
 # variable or creates it.
 
 # This is a simple variable assignment.
 # To the left of the assignment operator '=' there is the variable name,
-# and to the right is the variable value.
+# and to the right is the variable value.  The variable value is stored as-is,
+# it is not expanded in any way.
 #
 VAR=	value
 
@@ -36,9 +37,15 @@ VAR=	new value and \# some $$ special ch
 
 # The variable value may contain references to other variables.
 # In this example, the reference is to the variable with the empty name,
-# which always expands to an empty string.  This alone would not produce
-# any side-effects, therefore the variable has a :!...! modifier that
-# executes a shell command.
+# which is never defined.
+#
+# This alone would not produce any side-effects, therefore the variable has
+# a :!...! modifier that executes a shell command.  The :!...! modifier turns
+# an undefined expression into a defined one, see ApplyModifier_ShellCommand,
+# the call to ApplyModifiersState_Define.
+#
+# Since the right-hand side of a '=' assignment is not expanded at the time
+# when the variable is defined, the first command is not run at all.
 VAR=	${:! echo 'not yet evaluated' 1>&2 !}
 VAR=	${:! echo 'this will be evaluated later' 1>&2 !}
 
@@ -48,7 +55,7 @@ VAR=	${:! echo 'this will be evaluated l
 .endif
 
 # In a variable assignment, the variable name must consist of a single word.
-#
+# The following line therefore generates a parse error.
 VARIABLE NAME=	variable value
 
 # But if the whitespace appears inside parentheses or braces, everything is
Index: src/usr.bin/make/unit-tests/varmod-subst.mk
diff -u src/usr.bin/make/unit-tests/varmod-subst.mk:1.6 src/usr.bin/make/unit-tests/varmod-subst.mk:1.7
--- src/usr.bin/make/unit-tests/varmod-subst.mk:1.6	Tue Nov  3 18:21:36 2020
+++ src/usr.bin/make/unit-tests/varmod-subst.mk	Sun Nov 15 20:20:58 2020
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-subst.mk,v 1.6 2020/11/03 18:21:36 rillig Exp $
+# $NetBSD: varmod-subst.mk,v 1.7 2020/11/15 20:20:58 rillig Exp $
 #
 # Tests for the :S,from,to, variable modifier.
 
@@ -8,55 +8,72 @@ all: mod-subst-chain
 all: mod-subst-dollar
 
 WORDS=		sequences of letters
+
 .if ${WORDS:S,,,} != ${WORDS}
 .  warning The empty pattern matches something.
 .endif
+
 .if ${WORDS:S,e,*,1} != "s*quences of letters"
 .  warning The :S modifier flag '1' is not applied exactly once.
 .endif
+
 .if ${WORDS:S,f,*,1} != "sequences o* letters"
 .  warning The :S modifier flag '1' is only applied to the first word,\
 	 not to the first occurrence.
 .endif
+
 .if ${WORDS:S,e,*,} != "s*quences of l*tters"
 .  warning The :S modifier does not replace every first match per word.
 .endif
+
 .if ${WORDS:S,e,*,g} != "s*qu*nc*s of l*tt*rs"
 .  warning The :S modifier flag 'g' does not replace every occurrence.
 .endif
+
 .if ${WORDS:S,^sequ,occurr,} != "occurrences of letters"
 .  warning The :S modifier fails for a short match anchored at the start.
 .endif
+
 .if ${WORDS:S,^of,with,} != "sequences with letters"
 .  warning The :S modifier fails for an exact match anchored at the start.
 .endif
+
 .if ${WORDS:S,^office,does not match,} != ${WORDS}
 .  warning The :S modifier matches a too long pattern anchored at the start.
 .endif
+
 .if ${WORDS:S,f$,r,} != "sequences or letters"
 .  warning The :S modifier fails for a short match anchored at the end.
 .endif
+
 .if ${WORDS:S,s$,,} != "sequence of letter"
 .  warning The :S modifier fails to replace one occurrence per word.
 .endif
+
 .if ${WORDS:S,of$,,} != "sequences letters"
 .  warning The :S modifier fails for an exact match anchored at the end.
 .endif
+
 .if ${WORDS:S,eof$,,} != ${WORDS}
 .  warning The :S modifier matches a too long pattern anchored at the end.
 .endif
+
 .if ${WORDS:S,^of$,,} != "sequences letters"
 .  warning The :S modifier does not match a word anchored at both ends.
 .endif
+
 .if ${WORDS:S,^o$,,} != ${WORDS}
 .  warning The :S modifier matches a prefix anchored at both ends.
 .endif
+
 .if ${WORDS:S,^f$,,} != ${WORDS}
 .  warning The :S modifier matches a suffix anchored at both ends.
 .endif
+
 .if ${WORDS:S,^eof$,,} != ${WORDS}
 .  warning The :S modifier matches a too long prefix anchored at both ends.
 .endif
+
 .if ${WORDS:S,^office$,,} != ${WORDS}
 .  warning The :S modifier matches a too long suffix anchored at both ends.
 .endif
Index: src/usr.bin/make/unit-tests/varmod-to-separator.mk
diff -u src/usr.bin/make/unit-tests/varmod-to-separator.mk:1.6 src/usr.bin/make/unit-tests/varmod-to-separator.mk:1.7
--- src/usr.bin/make/unit-tests/varmod-to-separator.mk:1.6	Sun Nov  1 14:36:25 2020
+++ src/usr.bin/make/unit-tests/varmod-to-separator.mk	Sun Nov 15 20:20:58 2020
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-to-separator.mk,v 1.6 2020/11/01 14:36:25 rillig Exp $
+# $NetBSD: varmod-to-separator.mk,v 1.7 2020/11/15 20:20:58 rillig Exp $
 #
 # Tests for the :ts variable modifier, which joins the words of the variable
 # using an arbitrary character as word separator.
@@ -166,4 +166,10 @@ WORDS=	one two three four five six
 .  info This line is not reached.
 .endif
 
+# TODO: This modifier used to accept decimal numbers as well, in the form
+# ':ts\120'.  When has this been changed to octal, and what happens now
+# for ':ts\90' ('Z' in decimal ASCII, undefined in octal)?
+
+# TODO: :ts\x1F600
+
 all:
Index: src/usr.bin/make/unit-tests/varmod-undefined.mk
diff -u src/usr.bin/make/unit-tests/varmod-undefined.mk:1.6 src/usr.bin/make/unit-tests/varmod-undefined.mk:1.7
--- src/usr.bin/make/unit-tests/varmod-undefined.mk:1.6	Sat Oct 24 08:46:08 2020
+++ src/usr.bin/make/unit-tests/varmod-undefined.mk	Sun Nov 15 20:20:58 2020
@@ -1,9 +1,10 @@
-# $NetBSD: varmod-undefined.mk,v 1.6 2020/10/24 08:46:08 rillig Exp $
+# $NetBSD: varmod-undefined.mk,v 1.7 2020/11/15 20:20:58 rillig Exp $
 #
 # Tests for the :U variable modifier, which returns the given string
 # if the variable is undefined.
 #
 # See also:
+#	directive-for.mk
 #	varmod-defined.mk
 
 # The pattern ${:Uword} is heavily used when expanding .for loops.

Index: src/usr.bin/make/unit-tests/directive-for.mk
diff -u src/usr.bin/make/unit-tests/directive-for.mk:1.8 src/usr.bin/make/unit-tests/directive-for.mk:1.9
--- src/usr.bin/make/unit-tests/directive-for.mk:1.8	Sun Oct 25 15:49:03 2020
+++ src/usr.bin/make/unit-tests/directive-for.mk	Sun Nov 15 20:20:58 2020
@@ -1,6 +1,13 @@
-# $NetBSD: directive-for.mk,v 1.8 2020/10/25 15:49:03 rillig Exp $
+# $NetBSD: directive-for.mk,v 1.9 2020/11/15 20:20:58 rillig Exp $
 #
 # Tests for the .for directive.
+#
+# TODO: Describe naming conventions for the loop variables.
+#	.for f in values
+#	.for file in values
+#	.for _FILE_ in values
+#	.for .FILE. in values
+#	.for _f_ in values
 
 # Using the .for loop, lists of values can be produced.
 # In simple cases, the :@var@${var}@ variable modifier can be used to
@@ -15,6 +22,7 @@ NUMBERS+=	${num}
 .endif
 
 # The .for loop also works for multiple iteration variables.
+# This is something that the variable modifier :@ cannot do.
 .for name value in VARNAME value NAME2 value2
 ${name}=	${value}
 .endfor
@@ -26,7 +34,7 @@ ${name}=	${value}
 # just like the :M or :S variable modifiers.
 #
 # Until 2012-06-03, it had split the items exactly at whitespace, without
-# taking the quotes into account.
+# taking the quotes into account.  This had resulted in 10 words.
 #
 .undef WORDS
 .for var in one t\ w\ o "three three" 'four four' `five six`

Index: src/usr.bin/make/unit-tests/directive-ifmake.mk
diff -u src/usr.bin/make/unit-tests/directive-ifmake.mk:1.7 src/usr.bin/make/unit-tests/directive-ifmake.mk:1.8
--- src/usr.bin/make/unit-tests/directive-ifmake.mk:1.7	Wed Nov 11 07:13:42 2020
+++ src/usr.bin/make/unit-tests/directive-ifmake.mk	Sun Nov 15 20:20:58 2020
@@ -1,7 +1,10 @@
-# $NetBSD: directive-ifmake.mk,v 1.7 2020/11/11 07:13:42 rillig Exp $
+# $NetBSD: directive-ifmake.mk,v 1.8 2020/11/15 20:20:58 rillig Exp $
 #
 # Tests for the .ifmake directive, which provides a shortcut for asking
 # whether a certain target is requested to be made from the command line.
+#
+# TODO: Describe why the shortcut may be useful (if it's useful at all),
+# instead of sticking to the simple '.if' only.
 
 # The targets 'first' and 'second' are passed in on the command line.
 
@@ -22,7 +25,10 @@
 .endif
 
 # See if the exclamation mark really means "not", or if it is just part of
-# the target name.
+# the target name.  Since it means 'not', the two exclamation marks are
+# effectively ignored, and 'first' is indeed a requested target.  If the
+# exclamation mark were part of the name instead, the name would be '!!first',
+# and such a target was not requested to be made.
 .ifmake !!first
 .  info ok: double negation works
 .else

Index: src/usr.bin/make/unit-tests/directive-sinclude.mk
diff -u src/usr.bin/make/unit-tests/directive-sinclude.mk:1.1 src/usr.bin/make/unit-tests/directive-sinclude.mk:1.2
--- src/usr.bin/make/unit-tests/directive-sinclude.mk:1.1	Sun Sep 13 09:20:23 2020
+++ src/usr.bin/make/unit-tests/directive-sinclude.mk	Sun Nov 15 20:20:58 2020
@@ -1,7 +1,11 @@
-# $NetBSD: directive-sinclude.mk,v 1.1 2020/09/13 09:20:23 rillig Exp $
+# $NetBSD: directive-sinclude.mk,v 1.2 2020/11/15 20:20:58 rillig Exp $
 #
 # Tests for the .sinclude directive, which includes another file,
 # silently skipping it if it cannot be opened.
+#
+# The 'silently skipping' only applies to the case where the file cannot be
+# opened.  Parse errors and other errors are handled the same way as in the
+# other .include directives.
 
 # TODO: Implementation
 

Index: src/usr.bin/make/unit-tests/moderrs.mk
diff -u src/usr.bin/make/unit-tests/moderrs.mk:1.24 src/usr.bin/make/unit-tests/moderrs.mk:1.25
--- src/usr.bin/make/unit-tests/moderrs.mk:1.24	Sun Nov  1 14:36:25 2020
+++ src/usr.bin/make/unit-tests/moderrs.mk	Sun Nov 15 20:20:58 2020
@@ -1,4 +1,4 @@
-# $NetBSD: moderrs.mk,v 1.24 2020/11/01 14:36:25 rillig Exp $
+# $NetBSD: moderrs.mk,v 1.25 2020/11/15 20:20:58 rillig Exp $
 #
 # various modifier error tests
 
@@ -123,7 +123,7 @@ mod-regex-delimiter: print-header print-
 # always set; some may be missing.  Warn about these.
 #
 # Since there is no way to turn off this warning, the combination of
-# alternative matches and capturing groups is not widely used.
+# alternative matches and capturing groups is seldom used, if at all.
 #
 # A newly added modifier 'U' such as in :C,(a.)|(b.),\1\2,U might be added
 # for treating undefined capturing groups as empty, but that would create a

Index: src/usr.bin/make/unit-tests/modmisc.mk
diff -u src/usr.bin/make/unit-tests/modmisc.mk:1.50 src/usr.bin/make/unit-tests/modmisc.mk:1.51
--- src/usr.bin/make/unit-tests/modmisc.mk:1.50	Tue Nov  3 18:42:33 2020
+++ src/usr.bin/make/unit-tests/modmisc.mk	Sun Nov 15 20:20:58 2020
@@ -1,4 +1,4 @@
-# $NetBSD: modmisc.mk,v 1.50 2020/11/03 18:42:33 rillig Exp $
+# $NetBSD: modmisc.mk,v 1.51 2020/11/15 20:20:58 rillig Exp $
 #
 # miscellaneous modifier tests
 
@@ -60,7 +60,7 @@ undefvar:
 mod-quote:
 	@echo $@: new${.newline:Q}${.newline:Q}line
 
-# Cover the bmake_realloc in brk_string.
+# Cover the bmake_realloc in Str_Words.
 mod-break-many-words:
 	@echo $@: ${UNDEF:U:range=500:[#]}
 

Reply via email to