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 make(1): update and add comments in ...
details: https://anonhg.NetBSD.org/src/rev/33157b0dde4e
branches: trunk
changeset: 957070:33157b0dde4e
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Nov 15 20:20:58 2020 +0000
description:
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.
diffstat:
usr.bin/make/unit-tests/Makefile | 22 +++++++++++++++-
usr.bin/make/unit-tests/dep-double-colon.mk | 7 +++-
usr.bin/make/unit-tests/dep-exclam.mk | 9 +++++-
usr.bin/make/unit-tests/depsrc-ignore.mk | 11 +++----
usr.bin/make/unit-tests/depsrc-make.mk | 4 ++-
usr.bin/make/unit-tests/depsrc-precious.mk | 12 +++++++-
usr.bin/make/unit-tests/depsrc-usebefore.mk | 6 +++-
usr.bin/make/unit-tests/depsrc.mk | 4 ++-
usr.bin/make/unit-tests/deptgt-error.mk | 5 ++-
usr.bin/make/unit-tests/deptgt-ignore.mk | 5 ++-
usr.bin/make/unit-tests/deptgt-interrupt.mk | 6 ++-
usr.bin/make/unit-tests/deptgt-main.mk | 6 ++-
usr.bin/make/unit-tests/deptgt-makeflags.mk | 5 ++-
usr.bin/make/unit-tests/directive-for.exp | 36 +++++++++++++-------------
usr.bin/make/unit-tests/directive-for.mk | 12 +++++++-
usr.bin/make/unit-tests/directive-if.exp | 24 ++++++++--------
usr.bin/make/unit-tests/directive-if.mk | 5 ++-
usr.bin/make/unit-tests/directive-ifmake.exp | 14 +++++-----
usr.bin/make/unit-tests/directive-ifmake.mk | 10 +++++-
usr.bin/make/unit-tests/directive-sinclude.mk | 6 +++-
usr.bin/make/unit-tests/moderrs.mk | 4 +-
usr.bin/make/unit-tests/modmisc.mk | 4 +-
usr.bin/make/unit-tests/modword.mk | 3 +-
usr.bin/make/unit-tests/sh-leading-at.mk | 7 ++++-
usr.bin/make/unit-tests/sh-leading-hyphen.mk | 7 ++++-
usr.bin/make/unit-tests/sh-meta-chars.mk | 8 ++++-
usr.bin/make/unit-tests/var-op-assign.exp | 4 +-
usr.bin/make/unit-tests/var-op-assign.mk | 19 +++++++++----
usr.bin/make/unit-tests/var-op-sunsh.mk | 4 ++-
usr.bin/make/unit-tests/varmod-shell.mk | 4 ++-
usr.bin/make/unit-tests/varmod-subst.mk | 19 +++++++++++++-
usr.bin/make/unit-tests/varmod-to-lower.mk | 4 ++-
usr.bin/make/unit-tests/varmod-to-separator.mk | 8 +++++-
usr.bin/make/unit-tests/varmod-undefined.mk | 3 +-
34 files changed, 216 insertions(+), 91 deletions(-)
diffs (truncated from 740 to 300 lines):
diff -r 5db63b6f3815 -r 33157b0dde4e usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile Sun Nov 15 18:33:41 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile Sun Nov 15 20:20:58 2020 +0000
@@ -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-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
diff -r 5db63b6f3815 -r 33157b0dde4e usr.bin/make/unit-tests/dep-double-colon.mk
--- a/usr.bin/make/unit-tests/dep-double-colon.mk Sun Nov 15 18:33:41 2020 +0000
+++ b/usr.bin/make/unit-tests/dep-double-colon.mk Sun Nov 15 20:20:58 2020 +0000
@@ -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'
diff -r 5db63b6f3815 -r 33157b0dde4e usr.bin/make/unit-tests/dep-exclam.mk
--- a/usr.bin/make/unit-tests/dep-exclam.mk Sun Nov 15 18:33:41 2020 +0000
+++ b/usr.bin/make/unit-tests/dep-exclam.mk Sun Nov 15 20:20:58 2020 +0000
@@ -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
diff -r 5db63b6f3815 -r 33157b0dde4e usr.bin/make/unit-tests/depsrc-ignore.mk
--- a/usr.bin/make/unit-tests/depsrc-ignore.mk Sun Nov 15 18:33:41 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc-ignore.mk Sun Nov 15 20:20:58 2020 +0000
@@ -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
diff -r 5db63b6f3815 -r 33157b0dde4e usr.bin/make/unit-tests/depsrc-make.mk
--- a/usr.bin/make/unit-tests/depsrc-make.mk Sun Nov 15 18:33:41 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc-make.mk Sun Nov 15 20:20:58 2020 +0000
@@ -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
diff -r 5db63b6f3815 -r 33157b0dde4e usr.bin/make/unit-tests/depsrc-precious.mk
--- a/usr.bin/make/unit-tests/depsrc-precious.mk Sun Nov 15 18:33:41 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc-precious.mk Sun Nov 15 20:20:58 2020 +0000
@@ -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
diff -r 5db63b6f3815 -r 33157b0dde4e usr.bin/make/unit-tests/depsrc-usebefore.mk
--- a/usr.bin/make/unit-tests/depsrc-usebefore.mk Sun Nov 15 18:33:41 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc-usebefore.mk Sun Nov 15 20:20:58 2020 +0000
@@ -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
diff -r 5db63b6f3815 -r 33157b0dde4e usr.bin/make/unit-tests/depsrc.mk
--- a/usr.bin/make/unit-tests/depsrc.mk Sun Nov 15 18:33:41 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc.mk Sun Nov 15 20:20:58 2020 +0000
@@ -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:
@:;
diff -r 5db63b6f3815 -r 33157b0dde4e usr.bin/make/unit-tests/deptgt-error.mk
--- a/usr.bin/make/unit-tests/deptgt-error.mk Sun Nov 15 18:33:41 2020 +0000
+++ b/usr.bin/make/unit-tests/deptgt-error.mk Sun Nov 15 20:20:58 2020 +0000
@@ -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
diff -r 5db63b6f3815 -r 33157b0dde4e usr.bin/make/unit-tests/deptgt-ignore.mk
--- a/usr.bin/make/unit-tests/deptgt-ignore.mk Sun Nov 15 18:33:41 2020 +0000
+++ b/usr.bin/make/unit-tests/deptgt-ignore.mk Sun Nov 15 20:20:58 2020 +0000
@@ -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
diff -r 5db63b6f3815 -r 33157b0dde4e usr.bin/make/unit-tests/deptgt-interrupt.mk
--- a/usr.bin/make/unit-tests/deptgt-interrupt.mk Sun Nov 15 18:33:41 2020 +0000
+++ b/usr.bin/make/unit-tests/deptgt-interrupt.mk Sun Nov 15 20:20:58 2020 +0000
@@ -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
diff -r 5db63b6f3815 -r 33157b0dde4e usr.bin/make/unit-tests/deptgt-main.mk
--- a/usr.bin/make/unit-tests/deptgt-main.mk Sun Nov 15 18:33:41 2020 +0000
+++ b/usr.bin/make/unit-tests/deptgt-main.mk Sun Nov 15 20:20:58 2020 +0000
@@ -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
diff -r 5db63b6f3815 -r 33157b0dde4e usr.bin/make/unit-tests/deptgt-makeflags.mk
--- a/usr.bin/make/unit-tests/deptgt-makeflags.mk Sun Nov 15 18:33:41 2020 +0000
+++ b/usr.bin/make/unit-tests/deptgt-makeflags.mk Sun Nov 15 20:20:58 2020 +0000
@@ -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.
diff -r 5db63b6f3815 -r 33157b0dde4e usr.bin/make/unit-tests/directive-for.exp
--- a/usr.bin/make/unit-tests/directive-for.exp Sun Nov 15 18:33:41 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-for.exp Sun Nov 15 20:20:58 2020 +0000
@@ -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
diff -r 5db63b6f3815 -r 33157b0dde4e usr.bin/make/unit-tests/directive-for.mk
--- a/usr.bin/make/unit-tests/directive-for.mk Sun Nov 15 18:33:41 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-for.mk Sun Nov 15 20:20:58 2020 +0000
@@ -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 @@
.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}
Home |
Main Index |
Thread Index |
Old Index