Module Name: src
Committed By: rillig
Date: Wed May 10 15:53:32 UTC 2023
Modified Files:
src/usr.bin/make/unit-tests: cond-func.mk cond-late.mk dep-var.mk
varmod-gmtime.mk varmod-localtime.mk varmod-path.mk
Log Message:
tests/make: clean up comments in tests
To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/cond-func.mk \
src/usr.bin/make/unit-tests/varmod-localtime.mk
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cond-late.mk \
src/usr.bin/make/unit-tests/varmod-path.mk
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/dep-var.mk
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/varmod-gmtime.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/cond-func.mk
diff -u src/usr.bin/make/unit-tests/cond-func.mk:1.11 src/usr.bin/make/unit-tests/cond-func.mk:1.12
--- src/usr.bin/make/unit-tests/cond-func.mk:1.11 Fri Jan 7 19:30:17 2022
+++ src/usr.bin/make/unit-tests/cond-func.mk Wed May 10 15:53:32 2023
@@ -1,12 +1,12 @@
-# $NetBSD: cond-func.mk,v 1.11 2022/01/07 19:30:17 rillig Exp $
+# $NetBSD: cond-func.mk,v 1.12 2023/05/10 15:53:32 rillig Exp $
#
# Tests for those parts of the functions in .if conditions that are common
# among several functions.
#
-# The below test uses the function defined(...) since it has no side-effects,
-# the other functions (except empty(...)) would work equally well. The
-# function empty is special because it uses a different parsing algorithm for
-# its argument.
+# The below test uses the 'defined' function since it has no side-effects.
+# The other functions would work equally well, except for 'empty', which
+# parses its argument differently from the other functions.
+#
DEF= defined
${:UA B}= variable name with spaces
@@ -74,7 +74,7 @@ ${VARNAME_UNBALANCED_BRACES}= variable n
# There may be spaces around the operators and parentheses, and even
# inside the parentheses. The spaces inside the parentheses are not
-# allowed for the empty() function (see cond-func-empty.mk), therefore
+# allowed for the 'empty' function (see cond-func-empty.mk), therefore
# they are typically omitted for the other functions as well.
.if ! defined ( DEF )
. error
Index: src/usr.bin/make/unit-tests/varmod-localtime.mk
diff -u src/usr.bin/make/unit-tests/varmod-localtime.mk:1.11 src/usr.bin/make/unit-tests/varmod-localtime.mk:1.12
--- src/usr.bin/make/unit-tests/varmod-localtime.mk:1.11 Tue May 9 16:31:41 2023
+++ src/usr.bin/make/unit-tests/varmod-localtime.mk Wed May 10 15:53:32 2023
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-localtime.mk,v 1.11 2023/05/09 16:31:41 rillig Exp $
+# $NetBSD: varmod-localtime.mk,v 1.12 2023/05/10 15:53:32 rillig Exp $
#
# Tests for the :localtime variable modifier, which formats a timestamp
# using strftime(3) in local time.
@@ -129,7 +129,7 @@
.endif
# Before var.c 1.1050 from 2023-05-09, the timestamp could be directly
-# followed by the next modifier, without a ':' separator. This is the same
+# followed by the next modifier, without a ':' separator. This was the same
# bug as for the ':L' and ':P' modifiers.
.if ${%Y:L:localtime=100000S,1970,bad,} != "bad"
. error
Index: src/usr.bin/make/unit-tests/cond-late.mk
diff -u src/usr.bin/make/unit-tests/cond-late.mk:1.3 src/usr.bin/make/unit-tests/cond-late.mk:1.4
--- src/usr.bin/make/unit-tests/cond-late.mk:1.3 Sun Nov 15 14:07:53 2020
+++ src/usr.bin/make/unit-tests/cond-late.mk Wed May 10 15:53:32 2023
@@ -1,11 +1,12 @@
-# $NetBSD: cond-late.mk,v 1.3 2020/11/15 14:07:53 rillig Exp $
+# $NetBSD: cond-late.mk,v 1.4 2023/05/10 15:53:32 rillig Exp $
#
# Using the :? modifier, variable expressions can contain conditional
# expressions that are evaluated late, at expansion time.
#
-# Any variables appearing in these
-# conditions are expanded before parsing the condition. This is
-# different from many other places.
+# Any expressions appearing in these conditions are expanded before parsing
+# the condition. This is different from conditions in .if directives, where
+# expressions are evaluated individually and only as far as necessary, see
+# cond-short.mk.
#
# Because of this, variables that are used in these lazy conditions
# should not contain double-quotes, or the parser will probably fail.
@@ -22,10 +23,14 @@ COND.false= "yes" != "yes"
# If the order of evaluation were to change to first parse the condition
# and then expand the variables, the output would change from the
# current "yes no" to "yes yes", since both variables are non-empty.
+# expect: yes
+# expect: no
cond-literal:
@echo ${ ${COND.true} :?yes:no}
@echo ${ ${COND.false} :?yes:no}
-VAR+= ${${UNDEF} != "no":?:}
+VAR= ${${UNDEF} != "no":?:}
+# expect-reset
+# expect: make: Bad conditional expression ' != "no"' in ' != "no"?:'
.if empty(VAR:Mpattern)
.endif
Index: src/usr.bin/make/unit-tests/varmod-path.mk
diff -u src/usr.bin/make/unit-tests/varmod-path.mk:1.3 src/usr.bin/make/unit-tests/varmod-path.mk:1.4
--- src/usr.bin/make/unit-tests/varmod-path.mk:1.3 Sun Aug 23 08:10:49 2020
+++ src/usr.bin/make/unit-tests/varmod-path.mk Wed May 10 15:53:32 2023
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-path.mk,v 1.3 2020/08/23 08:10:49 rillig Exp $
+# $NetBSD: varmod-path.mk,v 1.4 2023/05/10 15:53:32 rillig Exp $
#
# Tests for the :P variable modifier, which looks up the path for a given
# target.
@@ -7,11 +7,12 @@
# as of 2020-08-23 it is nevertheless resolved to a path. This is probably
# unintended.
#
-# The real target is located in a subdirectory, and its full path is returned.
-# If it had been in the current directory, the difference between its path and
-# its name would not be visible.
+# In this test, the real target is located in a subdirectory, and its full
+# path is returned. If it had been in the current directory, the difference
+# between its path and its name would not be visible.
#
-# The enoent target does not exist, therefore the target name is returned.
+# The enoent target does not exist, therefore the plain name of the target
+# is returned.
.MAIN: all
@@ -20,7 +21,8 @@ _!= mkdir varmod-path.subdir
_!= > varmod-path.subdir/varmod-path.phony
_!= > varmod-path.subdir/varmod-path.real
-# To have an effect, this .PATH declaration must be after the directory is created.
+# To have an effect, this .PATH declaration must be processed after the
+# directory has been created.
.PATH: varmod-path.subdir
varmod-path.phony: .PHONY
Index: src/usr.bin/make/unit-tests/dep-var.mk
diff -u src/usr.bin/make/unit-tests/dep-var.mk:1.7 src/usr.bin/make/unit-tests/dep-var.mk:1.8
--- src/usr.bin/make/unit-tests/dep-var.mk:1.7 Mon Feb 13 21:01:46 2023
+++ src/usr.bin/make/unit-tests/dep-var.mk Wed May 10 15:53:32 2023
@@ -1,4 +1,4 @@
-# $NetBSD: dep-var.mk,v 1.7 2023/02/13 21:01:46 rillig Exp $
+# $NetBSD: dep-var.mk,v 1.8 2023/05/10 15:53:32 rillig Exp $
#
# Tests for variable references in dependency declarations.
#
@@ -91,5 +91,6 @@ undef1 def2 a-def2-b 1-2-$$INDIRECT_2-2-
.MAKEFLAGS: -d0
-# XXX: Why is the exit status still 0, even though Parse_Error is called
-# with PARSE_FATAL in SuffExpandChildren?
+# XXX: The exit status is still 0, even though Parse_Error is called with
+# PARSE_FATAL in SuffExpandChildren. The exit status is only affected by
+# parse errors when they occur in the parsing phase, see Parse_File.
Index: src/usr.bin/make/unit-tests/varmod-gmtime.mk
diff -u src/usr.bin/make/unit-tests/varmod-gmtime.mk:1.13 src/usr.bin/make/unit-tests/varmod-gmtime.mk:1.14
--- src/usr.bin/make/unit-tests/varmod-gmtime.mk:1.13 Tue May 9 16:31:41 2023
+++ src/usr.bin/make/unit-tests/varmod-gmtime.mk Wed May 10 15:53:32 2023
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-gmtime.mk,v 1.13 2023/05/09 16:31:41 rillig Exp $
+# $NetBSD: varmod-gmtime.mk,v 1.14 2023/05/10 15:53:32 rillig Exp $
#
# Tests for the :gmtime variable modifier, which formats a timestamp
# using strftime(3) in UTC.
@@ -129,7 +129,7 @@
.endif
# Before var.c 1.1050 from 2023-05-09, the timestamp could be directly
-# followed by the next modifier, without a ':' separator. This is the same
+# followed by the next modifier, without a ':' separator. This was the same
# bug as for the ':L' and ':P' modifiers.
.if ${%Y:L:gmtime=100000S,1970,bad,} != "bad"
. error