diff options
| author | Simon J. Gerraty <sjg@FreeBSD.org> | 2024-05-03 22:43:12 +0000 |
|---|---|---|
| committer | Simon J. Gerraty <sjg@FreeBSD.org> | 2024-05-03 22:43:12 +0000 |
| commit | 507951f55039f9d1ceae507d510f8cb68225fbc5 (patch) | |
| tree | 339e681a4a61256f8f943d0a7321f89b5007032c /unit-tests | |
| parent | 368b06ce6b0135d6de13f7265f6dcbaeb791b3bb (diff) | |
Diffstat (limited to 'unit-tests')
90 files changed, 388 insertions, 321 deletions
diff --git a/unit-tests/Makefile b/unit-tests/Makefile index 6c41bf811dcf..5960a0621ddd 100644 --- a/unit-tests/Makefile +++ b/unit-tests/Makefile @@ -1,6 +1,6 @@ -# $Id: Makefile,v 1.211 2024/03/10 17:46:44 sjg Exp $ +# $Id: Makefile,v 1.216 2024/04/30 16:42:50 sjg Exp $ # -# $NetBSD: Makefile,v 1.342 2024/01/07 02:07:44 sjg Exp $ +# $NetBSD: Makefile,v 1.344 2024/04/30 16:41:32 sjg Exp $ # # Unit tests for make(1) # @@ -474,20 +474,11 @@ BROKEN_TESTS+= sh-flags BROKEN_TESTS+= varmod-localtime .endif -.if ${.MAKE.OS:NCYGWIN*} == "" -BROKEN_TESTS+= \ - export \ - opt-chdir \ - opt-keep-going-indirect \ - -.endif - - .if ${.MAKE.OS:NDarwin} == "" BROKEN_TESTS+= shell-ksh .endif -.if ${.MAKE.OS:MIRIX*} != "" +.if ${.MAKE.OS:NIRIX*} == "" BROKEN_TESTS+= \ cmd-interrupt \ deptgt-interrupt \ @@ -573,6 +564,9 @@ SED_CMDS.directive-include-guard= \ -e '/^ParseDependency/d' \ -e '/^ParseEOF:/d' SED_CMDS.export= -e '/^[^=_A-Za-z0-9]*=/d' +.if ${.MAKE.OS:NCygwin} == "" +SED_CMDS.export+= -e '/^WINDIR=/d' -e '/^SYSTEMROOT=/d' +.endif SED_CMDS.export-all= ${SED_CMDS.export} SED_CMDS.export-env= ${SED_CMDS.export} SED_CMDS.cmdline= -e 's,uid${.MAKE.UID}/,,' @@ -625,7 +619,7 @@ SED_CMDS.var-op-shell+= ${STD_SED_CMDS.shell} SED_CMDS.var-op-shell+= -e '/command/s,No such.*,not found,' SED_CMDS.var-op-shell+= ${STD_SED_CMDS.white-space} SED_CMDS.vardebug+= -e 's,${.SHELL},</path/to/shell>,' -SED_CMDS.varmod-mtime+= -e "s,': .*,': <ENOENT>," +SED_CMDS.varmod-mtime+= -e "s,\(.*\)': .*,\1': <ENOENT>," SED_CMDS.varmod-subst-regex+= ${STD_SED_CMDS.regex} SED_CMDS.varparse-errors+= ${STD_SED_CMDS.timestamp} SED_CMDS.varname-dot-make-meta-ignore_filter+= ${SED_CMDS.meta-ignore} @@ -655,8 +649,9 @@ unexport-env.rawout: export.mk # In tests that use the debugging option -dd, ignore debugging output that is # only logged in -DCLEANUP mode. -STD_SED_CMDS.dd= -e '/^OpenDirs_Done:/d' -STD_SED_CMDS.dd+= -e '/^CachedDir /d' +STD_SED_CMDS.dd= -e '/^OpenDirs_Done:/d' +STD_SED_CMDS.dd+= -e '/^CachedDir /d' +STD_SED_CMDS.dd+= -e 's, ${DEFSYSPATH:U/usr/share/mk} , <defsyspath> ,' # Omit details such as process IDs from the output of the -dg1 option. STD_SED_CMDS.dg1= -e '/\#.* \.$$/d' @@ -762,12 +757,10 @@ TOOL_TR?= tr TOOL_DIFF?= diff DIFF_FLAGS?= -u -.if defined(.PARSEDIR) # ensure consistent results from sort(1) LC_ALL= C LANG= C .export LANG LC_ALL -.endif .if ${.MAKE.MODE:Unormal:Mmeta} != "" # we don't need the noise diff --git a/unit-tests/archive.exp b/unit-tests/archive.exp index 645add4f5899..5cf847388544 100644 --- a/unit-tests/archive.exp +++ b/unit-tests/archive.exp @@ -25,4 +25,12 @@ depend-on-existing-member Making remove-archive rm -f libprog.a +begin library +Examining libbad.a...up-to-date. +Examining -lbad...up-to-date. +Examining libgood.a...library...up-to-date. +Examining -lgood...library...up-to-date. +Examining library...nonexistent....PHONY node...out-of-date. +Examining .END...nonexistent...nonexistent and no sources...out-of-date. +end library exit status 0 diff --git a/unit-tests/archive.mk b/unit-tests/archive.mk index 2cd43a99e9ad..eef64396f419 100644 --- a/unit-tests/archive.mk +++ b/unit-tests/archive.mk @@ -1,4 +1,4 @@ -# $NetBSD: archive.mk,v 1.12 2021/04/09 14:42:00 christos Exp $ +# $NetBSD: archive.mk,v 1.13 2024/04/27 20:23:22 rillig Exp $ # # Very basic demonstration of handling archives, based on the description # in PSD.doc/tutorial.ms. @@ -24,6 +24,12 @@ all: @${MAKE} -f ${MAKEFILE} depend-on-existing-member @${MAKE} -f ${MAKEFILE} depend-on-nonexistent-member @${MAKE} -f ${MAKEFILE} remove-archive + @${MAKE} -f ${MAKEFILE} set-up-library + @${MAKE} -f ${MAKEFILE} -dm library 2>&1 \ + | sed -n '/^Examining/p' \ + | sed 's,\.\.\.modified[^.]*,,' + @${MAKE} -f ${MAKEFILE} tear-down-library + create-archive: ${ARCHIVE} pre post @@ -58,3 +64,28 @@ pre: .USEBEFORE @echo Making ${.TARGET} ${.OODATE:C,.+,out-of-date,W} ${.OODATE:O} post: .USE @echo + + +set-up-library: .PHONY + @echo "member" > member.txt + @echo "not a library" > libbad.a + @ar cr libgood.a member.txt + @echo "begin library" + +.if make(library) +.SUFFIXES: .a +.LIBS: .a +.endif +# The two lines for libgood contain the word "library", the two lines for +# libbad don't. +# +# expect: Examining libbad.a...up-to-date. +# expect: Examining -lbad...up-to-date. +# expect: Examining libgood.a...library...up-to-date. +# expect: Examining -lgood...library...up-to-date. +library: .PHONY libbad.a -lbad libgood.a -lgood + : Making ${.TARGET} from ${.ALLSRC} + +tear-down-library: .PHONY + @echo "end library" + @rm member.txt libbad.a libgood.a diff --git a/unit-tests/cmd-errors-jobs.exp b/unit-tests/cmd-errors-jobs.exp index d0a6e51eb84d..c8e483a9609b 100644 --- a/unit-tests/cmd-errors-jobs.exp +++ b/unit-tests/cmd-errors-jobs.exp @@ -1,9 +1,9 @@ : undefined--eol -make: Unclosed variable "UNCLOSED" -: unclosed-variable- +make: in target "unclosed-expression": Unclosed variable "UNCLOSED" +: unclosed-expression- make: Unclosed expression, expecting '}' for "UNCLOSED" : unclosed-modifier- -make: Unknown modifier "Z" +make: in target "unknown-modifier": while evaluating variable "UNKNOWN": Unknown modifier "Z" : unknown-modifier--eol : end-eol exit status 0 diff --git a/unit-tests/cmd-errors-jobs.mk b/unit-tests/cmd-errors-jobs.mk index b3dc982de35f..7a82c0b416e8 100644 --- a/unit-tests/cmd-errors-jobs.mk +++ b/unit-tests/cmd-errors-jobs.mk @@ -1,32 +1,39 @@ -# $NetBSD: cmd-errors-jobs.mk,v 1.2 2022/09/25 12:51:37 rillig Exp $ +# $NetBSD: cmd-errors-jobs.mk,v 1.4 2024/04/23 22:51:28 rillig Exp $ # -# Demonstrate how errors in variable expansions affect whether the commands +# Demonstrate how errors in expressions affect whether the commands # are actually executed in jobs mode. .MAKEFLAGS: -j1 -all: undefined unclosed-variable unclosed-modifier unknown-modifier end +all: undefined unclosed-expression unclosed-modifier unknown-modifier end -# Undefined variables are not an error. They expand to empty strings. +# Undefined variables in expressions are not an error. They expand to empty +# strings. +# expect: : undefined--eol undefined: : $@-${UNDEFINED}-eol -# XXX: As of 2020-11-01, this command is executed even though it contains -# parse errors. -unclosed-variable: +# XXX: This command is executed even though it contains parse errors. +# expect: make: in target "unclosed-expression": Unclosed variable "UNCLOSED" +# expect: : unclosed-expression- +unclosed-expression: : $@-${UNCLOSED -# XXX: As of 2020-11-01, this command is executed even though it contains -# parse errors. +# XXX: This command is executed even though it contains parse errors. +# expect: make: Unclosed expression, expecting '}' for "UNCLOSED" +# expect: : unclosed-modifier- unclosed-modifier: : $@-${UNCLOSED: -# XXX: As of 2020-11-01, this command is executed even though it contains -# parse errors. +# XXX: This command is executed even though it contains parse errors. +# expect: make: in target "unknown-modifier": while evaluating variable "UNKNOWN": Unknown modifier "Z" +# expect: : unknown-modifier--eol unknown-modifier: : $@-${UNKNOWN:Z}-eol +# expect: : end-eol end: : $@-eol -# XXX: As of 2020-11-02, despite the parse errors, the exit status is 0. +# XXX: Despite the parse errors, the exit status is 0. +# expect: exit status 0 diff --git a/unit-tests/cmd-errors-lint.exp b/unit-tests/cmd-errors-lint.exp index bdf4ae1a17e8..d489c6be57c9 100644 --- a/unit-tests/cmd-errors-lint.exp +++ b/unit-tests/cmd-errors-lint.exp @@ -1,9 +1,9 @@ : undefined -make: Unclosed variable "UNCLOSED" -: unclosed-variable +make: in target "unclosed-expression": Unclosed variable "UNCLOSED" +: unclosed-expression make: Unclosed expression, expecting '}' for "UNCLOSED" : unclosed-modifier -make: Unknown modifier "Z" +make: in target "unknown-modifier": while evaluating variable "UNKNOWN": Unknown modifier "Z" : unknown-modifier : end exit status 2 diff --git a/unit-tests/cmd-errors-lint.mk b/unit-tests/cmd-errors-lint.mk index 371e12af0f4f..2e7d537f5f1f 100644 --- a/unit-tests/cmd-errors-lint.mk +++ b/unit-tests/cmd-errors-lint.mk @@ -1,20 +1,21 @@ -# $NetBSD: cmd-errors-lint.mk,v 1.1 2020/11/02 20:43:27 rillig Exp $ +# $NetBSD: cmd-errors-lint.mk,v 1.2 2024/04/23 22:51:28 rillig Exp $ # -# Demonstrate how errors in variable expansions affect whether the commands +# Demonstrate how errors in expressions affect whether the commands # are actually executed. .MAKEFLAGS: -dL -all: undefined unclosed-variable unclosed-modifier unknown-modifier end +all: undefined unclosed-expression unclosed-modifier unknown-modifier end -# Undefined variables are not an error. They expand to empty strings. +# Undefined variables in expressions are not an error. They expand to empty +# strings. undefined: : $@ ${UNDEFINED} # XXX: As of 2020-11-01, this obvious syntax error is not detected. # XXX: As of 2020-11-01, this command is executed even though it contains # parse errors. -unclosed-variable: +unclosed-expression: : $@ ${UNCLOSED # XXX: As of 2020-11-01, this obvious syntax error is not detected. diff --git a/unit-tests/cmd-errors.exp b/unit-tests/cmd-errors.exp index d0a6e51eb84d..c8e483a9609b 100644 --- a/unit-tests/cmd-errors.exp +++ b/unit-tests/cmd-errors.exp @@ -1,9 +1,9 @@ : undefined--eol -make: Unclosed variable "UNCLOSED" -: unclosed-variable- +make: in target "unclosed-expression": Unclosed variable "UNCLOSED" +: unclosed-expression- make: Unclosed expression, expecting '}' for "UNCLOSED" : unclosed-modifier- -make: Unknown modifier "Z" +make: in target "unknown-modifier": while evaluating variable "UNKNOWN": Unknown modifier "Z" : unknown-modifier--eol : end-eol exit status 0 diff --git a/unit-tests/cmd-errors.mk b/unit-tests/cmd-errors.mk index 6d3880684bcf..d1125d444fcd 100644 --- a/unit-tests/cmd-errors.mk +++ b/unit-tests/cmd-errors.mk @@ -1,17 +1,18 @@ -# $NetBSD: cmd-errors.mk,v 1.5 2022/09/25 12:51:37 rillig Exp $ +# $NetBSD: cmd-errors.mk,v 1.6 2024/04/23 22:51:28 rillig Exp $ # -# Demonstrate how errors in variable expansions affect whether the commands +# Demonstrate how errors in expressions affect whether the commands # are actually executed in compat mode. -all: undefined unclosed-variable unclosed-modifier unknown-modifier end +all: undefined unclosed-expression unclosed-modifier unknown-modifier end -# Undefined variables are not an error. They expand to empty strings. +# Undefined variables in expressions are not an error. They expand to empty +# strings. undefined: : $@-${UNDEFINED}-eol # XXX: As of 2020-11-01, this command is executed even though it contains # parse errors. -unclosed-variable: +unclosed-expression: : $@-${UNCLOSED # XXX: As of 2020-11-01, this command is executed even though it contains diff --git a/unit-tests/cmdline-undefined.mk b/unit-tests/cmdline-undefined.mk index 81b44518dd41..e7c0400ad1e1 100644 --- a/unit-tests/cmdline-undefined.mk +++ b/unit-tests/cmdline-undefined.mk @@ -1,6 +1,6 @@ -# $NetBSD: cmdline-undefined.mk,v 1.4 2023/11/19 21:47:52 rillig Exp $ +# $NetBSD: cmdline-undefined.mk,v 1.5 2024/04/23 22:51:28 rillig Exp $ # -# Tests for undefined expressions in the command line. +# Tests for undefined variables in expressions in the command line. all: # When the command line is parsed, variable assignments using the diff --git a/unit-tests/cmdline.mk b/unit-tests/cmdline.mk index a24d46208e52..40a0d7ccddbb 100644 --- a/unit-tests/cmdline.mk +++ b/unit-tests/cmdline.mk @@ -1,4 +1,4 @@ -# $NetBSD: cmdline.mk,v 1.4 2022/06/10 18:58:07 rillig Exp $ +# $NetBSD: cmdline.mk,v 1.5 2024/04/23 22:51:28 rillig Exp $ # # Tests for command line parsing and related special variables. @@ -24,7 +24,7 @@ makeobjdir-direct: @${MAKE_CMD} MAKEOBJDIR=${DIR2} show-objdir # The .OBJDIR can be set via the MAKEOBJDIR command line variable, -# and that variable could even contain the usual modifiers. +# and expressions based on that variable can contain the usual modifiers. # Since the .OBJDIR=MAKEOBJDIR assignment happens very early, # the SUB2 variable in the modifier is not defined yet and is therefore empty. # The SUB1 in the resulting path comes from the environment variable TMPBASE, diff --git a/unit-tests/comment.mk b/unit-tests/comment.mk index a3bf781b9a67..fea0f0b3d817 100644 --- a/unit-tests/comment.mk +++ b/unit-tests/comment.mk @@ -1,4 +1,4 @@ -# $NetBSD: comment.mk,v 1.6 2023/11/19 21:47:52 rillig Exp $ +# $NetBSD: comment.mk,v 1.7 2024/04/23 22:51:28 rillig Exp $ # # Demonstrate how comments are written in makefiles. @@ -53,9 +53,9 @@ VAR= \# # Both in the assignment. . error .endif -# Since 2012-03-24 the variable modifier :[#] does not need to be escaped. -# To keep the parsing code simple, any "[#" does not start a comment, even -# outside of an expression. +# Since 2012-03-24 the modifier :[#] does not need to be escaped. +# To keep the parsing code simple, the "#" in "[#" does not start a comment, +# regardless of the syntactical context it appears in. WORDS= ${VAR:[#]} [# .if ${WORDS} != "1 [#" . error diff --git a/unit-tests/cond-cmp-string.mk b/unit-tests/cond-cmp-string.mk index 7b13ebf2212b..e3346e08b5a0 100644 --- a/unit-tests/cond-cmp-string.mk +++ b/unit-tests/cond-cmp-string.mk @@ -1,4 +1,4 @@ -# $NetBSD: cond-cmp-string.mk,v 1.18 2023/11/19 21:47:52 rillig Exp $ +# $NetBSD: cond-cmp-string.mk,v 1.19 2024/04/23 22:51:28 rillig Exp $ # # Tests for string comparisons in .if conditions. @@ -20,12 +20,12 @@ . error .endif -# The left-hand side of the comparison requires that any expression -# is defined. +# An expression that occurs on the left-hand side of the comparison must be +# defined. # # The variable named "" is never defined, nevertheless it can be used as a -# starting point for expressions. Applying the :U modifier to such -# an undefined expression turns it into a defined expression. +# starting point for an expression. Applying the :U modifier to such an +# undefined expression turns it into a defined expression. # # See ApplyModifier_Defined and DEF_DEFINED. .if ${:Ustr} != "str" @@ -69,8 +69,9 @@ .endif # Between 2003-01-01 (maybe even earlier) and 2020-10-30, adding one of the -# characters " \t!=><" directly after an expression resulted in a -# "Malformed conditional", even though the string was well-formed. +# characters " \t!=><" directly after an expression in a string literal +# resulted in a "Malformed conditional", even though the string was +# well-formed. .if ${:Uword } != "${:Uword} " . error .endif @@ -94,8 +95,7 @@ . error .endif -# Adding a space at the beginning of the quoted expression works -# though. +# Adding a space at the beginning of the quoted expression works though. .if ${:U word } != " ${:Uword} " . error .endif @@ -145,7 +145,7 @@ . error .endif -# Two variables with different values compare unequal. +# Two expressions with different values compare unequal. VAR1= value1 VAR2= value2 .if ${VAR1} != ${VAR2} diff --git a/unit-tests/cond-func-defined.exp b/unit-tests/cond-func-defined.exp index d556f3b982b3..1d4243f9eddd 100644 --- a/unit-tests/cond-func-defined.exp +++ b/unit-tests/cond-func-defined.exp @@ -1,8 +1,5 @@ make: "cond-func-defined.mk" line 24: Missing closing parenthesis for defined() make: "cond-func-defined.mk" line 34: Missing closing parenthesis for defined() -make: "cond-func-defined.mk" line 47: In .for loops, expressions for the loop variables are -make: "cond-func-defined.mk" line 49: substituted at evaluation time. There is no actual variable -make: "cond-func-defined.mk" line 51: involved, even if it feels like it. make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/unit-tests/cond-func-defined.mk b/unit-tests/cond-func-defined.mk index 14597398bc62..6b24182c11c1 100644 --- a/unit-tests/cond-func-defined.mk +++ b/unit-tests/cond-func-defined.mk @@ -1,4 +1,4 @@ -# $NetBSD: cond-func-defined.mk,v 1.11 2023/11/19 21:47:52 rillig Exp $ +# $NetBSD: cond-func-defined.mk,v 1.12 2024/04/23 22:51:28 rillig Exp $ # # Tests for the defined() function in .if conditions. @@ -43,12 +43,9 @@ ${:UA B}= variable name with spaces . if defined(var) . error . else -# expect+1: In .for loops, expressions for the loop variables are -. info In .for loops, expressions for the loop variables are -# expect+1: substituted at evaluation time. There is no actual variable -. info substituted at evaluation time. There is no actual variable -# expect+1: involved, even if it feels like it. -. info involved, even if it feels like it. +# In .for loops, expressions based on the loop variables are substituted at +# evaluation time. There is no actual variable involved, even if the code in +# the makefiles looks like it. . endif .endfor diff --git a/unit-tests/cond-token-string.exp b/unit-tests/cond-token-string.exp index db07adcb2d09..4fbafc5e1986 100644 --- a/unit-tests/cond-token-string.exp +++ b/unit-tests/cond-token-string.exp @@ -1,4 +1,4 @@ -make: "cond-token-string.mk" line 15: Unknown modifier "Z" +make: "cond-token-string.mk" line 15: while evaluating "${:Uvalue:Z}"": Unknown modifier "Z" make: "cond-token-string.mk" line 15: Malformed conditional ("" != "${:Uvalue:Z}") make: "cond-token-string.mk" line 25: xvalue is not defined. make: "cond-token-string.mk" line 32: Malformed conditional (x${:Uvalue} == "") diff --git a/unit-tests/cond-token-string.mk b/unit-tests/cond-token-string.mk index d13c68da134a..edc9936b7d53 100644 --- a/unit-tests/cond-token-string.mk +++ b/unit-tests/cond-token-string.mk @@ -1,4 +1,4 @@ -# $NetBSD: cond-token-string.mk,v 1.9 2023/11/19 21:47:52 rillig Exp $ +# $NetBSD: cond-token-string.mk,v 1.10 2024/04/20 10:18:55 rillig Exp $ # # Tests for quoted string literals in .if conditions. # @@ -11,7 +11,7 @@ # Cover the code in CondParser_String that frees the memory after parsing # an expression based on an undefined variable. # expect+2: Malformed conditional ("" != "${:Uvalue:Z}") -# expect+1: Unknown modifier "Z" +# expect+1: while evaluating "${:Uvalue:Z}"": Unknown modifier "Z" .if "" != "${:Uvalue:Z}" . error .else diff --git a/unit-tests/depsrc-end.mk b/unit-tests/depsrc-end.mk index eb7543d5dfad..1bfe50d98620 100644 --- a/unit-tests/depsrc-end.mk +++ b/unit-tests/depsrc-end.mk @@ -1,6 +1,6 @@ -# $NetBSD: depsrc-end.mk,v 1.1 2020/10/23 19:23:01 rillig Exp $ +# $NetBSD: depsrc-end.mk,v 1.2 2024/04/27 20:41:32 rillig Exp $ # -# Demonstrate the edge case that .BEGIN depends on .END, which sounds a bit +# Demonstrate an edge case in which .BEGIN depends on .END, which sounds a bit # paradox but works since these special nodes are not in the dependency # hierarchy where the cycles are detected. diff --git a/unit-tests/depsrc-nopath.exp b/unit-tests/depsrc-nopath.exp index 39a9383953dd..01295d8df7f5 100644 --- a/unit-tests/depsrc-nopath.exp +++ b/unit-tests/depsrc-nopath.exp @@ -1 +1,3 @@ +: Making test-regular from depsrc-nopath.dir/regular.file +: Making test-nopath from nopath.file exit status 0 diff --git a/unit-tests/depsrc-nopath.mk b/unit-tests/depsrc-nopath.mk index 052c6f10db66..8d9ce93c16b9 100644 --- a/unit-tests/depsrc-nopath.mk +++ b/unit-tests/depsrc-nopath.mk @@ -1,8 +1,27 @@ -# $NetBSD: depsrc-nopath.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $ +# $NetBSD: depsrc-nopath.mk,v 1.3 2024/04/27 20:41:32 rillig Exp $ # # Tests for the special source .NOPATH in dependency declarations. -# TODO: Implementation +.if !target(test-*) +_!= rm -rf depsrc-nopath.dir +_!= mkdir depsrc-nopath.dir +_!= touch depsrc-nopath.dir/regular.file +_!= touch depsrc-nopath.dir/nopath.file +.endif all: - @:; + @${MAKE} -f ${MAKEFILE} test-regular + @${MAKE} -f ${MAKEFILE} test-nopath || echo "should have failed" + @rm -rf depsrc-nopath.dir + +.PATH: depsrc-nopath.dir + +test-regular: regular.file + : Making ${.TARGET} from ${.ALLSRC} +test-nopath: nopath.file + : Making ${.TARGET} from ${.ALLSRC} + +nopath.file: .NOPATH + +# expect: : Making test-regular from depsrc-nopath.dir/regular.file +# expect: : Making test-nopath from nopath.file diff --git a/unit-tests/depsrc-phony.mk b/unit-tests/depsrc-phony.mk index c41efac369a8..9df1eb570ab4 100644 --- a/unit-tests/depsrc-phony.mk +++ b/unit-tests/depsrc-phony.mk @@ -1,9 +1,10 @@ -# $NetBSD: depsrc-phony.mk,v 1.3 2020/09/05 15:57:12 rillig Exp $ +# $NetBSD: depsrc-phony.mk,v 1.4 2024/04/27 20:41:32 rillig Exp $ # # Tests for the special source .PHONY in dependency declarations, # which executes the commands for the target even if a file of the same # name exists and would be considered up to date. # Without the .PHONY, this target would be "up to date". +# expect: : depsrc-phony.mk is made. ${MAKEFILE}: .PHONY : ${.TARGET:T} is made. diff --git a/unit-tests/deptgt-phony.exp b/unit-tests/deptgt-phony.exp index 1c379b32a33b..e943091e4cef 100644 --- a/unit-tests/deptgt-phony.exp +++ b/unit-tests/deptgt-phony.exp @@ -2,7 +2,7 @@ Expanding "depsrc-phony-pr-15164-*-wildcard"... Expanding "deptgt-phony-pr-15164-*-wildcard"... Searching for .depend ... failed. -Searching for .depend ... +Searching for .depend ...[dot last]... . ... failed. Wildcard expanding "all"... diff --git a/unit-tests/deptgt.exp b/unit-tests/deptgt.exp index 00d312685de9..90213fe44fb5 100644 --- a/unit-tests/deptgt.exp +++ b/unit-tests/deptgt.exp @@ -8,7 +8,7 @@ ParseDependency(: empty-source) Parsing line 39: : command for empty targets list Parsing line 40: .MAKEFLAGS: -d0 ParseDependency(.MAKEFLAGS: -d0) -make: "deptgt.mk" line 49: Unknown modifier "Z" +make: "deptgt.mk" line 49: while evaluating "${:U:Z}:": Unknown modifier "Z" make: "deptgt.mk" line 52: warning: Extra target 'ordinary' ignored make: "deptgt.mk" line 55: warning: Extra target (ordinary) ignored make: "deptgt.mk" line 58: warning: Special and mundane targets don't mix. Mundane ones ignored diff --git a/unit-tests/deptgt.mk b/unit-tests/deptgt.mk index 30b8399191bd..eb948918abb7 100644 --- a/unit-tests/deptgt.mk +++ b/unit-tests/deptgt.mk @@ -1,4 +1,4 @@ -# $NetBSD: deptgt.mk,v 1.16 2023/12/17 09:44:00 rillig Exp $ +# $NetBSD: deptgt.mk,v 1.17 2024/04/20 10:18:55 rillig Exp $ # # Tests for special targets like .BEGIN or .SUFFIXES in dependency # declarations. @@ -45,7 +45,7 @@ ${:U}: empty-source # expansion would be to use the variable modifier '::=' to modify the # targets. This in turn would be such an extreme and unreliable edge case # that nobody uses it. -# expect+1: Unknown modifier "Z" +# expect+1: while evaluating "${:U:Z}:": Unknown modifier "Z" $$$$$$$${:U:Z}: # expect+1: warning: Extra target 'ordinary' ignored diff --git a/unit-tests/directive-export-impl.exp b/unit-tests/directive-export-impl.exp index fada441f5e92..7daf1f45b0cb 100644 --- a/unit-tests/directive-export-impl.exp +++ b/unit-tests/directive-export-impl.exp @@ -10,6 +10,7 @@ Pattern for ':N' is "*" ModifyWords: split "<>" into 1 word Result of ${UT_VAR:N*} is "" ParseDependency(: ) +Parsing line 42: .if ${:!echo "\$UT_VAR"!} != "<>" CondParser_Eval: ${:!echo "\$UT_VAR"!} != "<>" Var_Parse: ${:!echo "\$UT_VAR"!} != "<>" (eval-defined) Evaluating modifier ${:!...} on value "" (eval-defined, undefined) @@ -34,6 +35,7 @@ Result of ${UT_VAR:N*} is "" ParseDependency(: ) Parsing line 54: REF= defined Global: REF = defined +Parsing line 58: .if ${:!echo "\$UT_VAR"!} != "<defined>" CondParser_Eval: ${:!echo "\$UT_VAR"!} != "<defined>" Var_Parse: ${:!echo "\$UT_VAR"!} != "<defined>" (eval-defined) Evaluating modifier ${:!...} on value "" (eval-defined, undefined) diff --git a/unit-tests/directive-for-errors.exp b/unit-tests/directive-for-errors.exp index 115a6af5b069..9c1aa5c0b1ed 100644 --- a/unit-tests/directive-for-errors.exp +++ b/unit-tests/directive-for-errors.exp @@ -8,7 +8,7 @@ make: "directive-for-errors.mk" line 44: invalid character '$' in .for loop vari make: "directive-for-errors.mk" line 52: no iteration variables in for make: "directive-for-errors.mk" line 64: Wrong number of words (5) in .for substitution list with 3 variables make: "directive-for-errors.mk" line 78: missing `in' in for -make: "directive-for-errors.mk" line 89: Unknown modifier "Z" +make: "directive-for-errors.mk" line 89: while evaluating "${:U3:Z} 4": Unknown modifier "Z" make: "directive-for-errors.mk" line 90: warning: Should not be reached. make: "directive-for-errors.mk" line 90: warning: Should not be reached. make: "directive-for-errors.mk" line 90: warning: Should not be reached. diff --git a/unit-tests/directive-for-errors.mk b/unit-tests/directive-for-errors.mk index 94362847cdfd..1bd4f31d383a 100644 --- a/unit-tests/directive-for-errors.mk +++ b/unit-tests/directive-for-errors.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-for-errors.mk,v 1.9 2023/12/19 19:33:40 rillig Exp $ +# $NetBSD: directive-for-errors.mk,v 1.10 2024/04/20 10:18:55 rillig Exp $ # # Tests for error handling in .for loops. @@ -85,7 +85,7 @@ ${:U\\}= backslash # see whether the "variable" '\' is local # # XXX: As of 2020-12-31, Var_Subst doesn't report any errors, therefore # the loop body is expanded as if no error had happened. -# expect+1: Unknown modifier "Z" +# expect+1: while evaluating "${:U3:Z} 4": Unknown modifier "Z" .for i in 1 2 ${:U3:Z} 4 . warning Should not be reached. .endfor diff --git a/unit-tests/directive-for-escape.exp b/unit-tests/directive-for-escape.exp index 6c84b7780e84..1f4305185d65 100644 --- a/unit-tests/directive-for-escape.exp +++ b/unit-tests/directive-for-escape.exp @@ -106,6 +106,7 @@ make: "directive-for-escape.mk" line 228: long: " " For: end for 1 For: loop body with i = " ": +Parsing line 244: .for i in "${.newline}" For: end for 1 Parse_PushInput: .for loop in directive-for-escape.mk, line 244 make: "directive-for-escape.mk" line 244: newline in .for value diff --git a/unit-tests/directive-for-null.exp b/unit-tests/directive-for-null.exp index dee26de25e63..d6198c644817 100644 --- a/unit-tests/directive-for-null.exp +++ b/unit-tests/directive-for-null.exp @@ -1,9 +1,5 @@ make: "(stdin)" line 2: Zero byte read from file -make: "(stdin)" line 2: Unexpected end of file in .for loop -make: "(stdin)" line 3: Zero byte read from file -make: Fatal errors encountered -- cannot continue -make: stopped in unit-tests -*** Error code 1 (continuing) +*** Error code 2 (continuing) Stop. make: stopped in unit-tests diff --git a/unit-tests/directive-for-null.mk b/unit-tests/directive-for-null.mk index fb2d440ee1ba..d3de8b598bc2 100644 --- a/unit-tests/directive-for-null.mk +++ b/unit-tests/directive-for-null.mk @@ -1,18 +1,8 @@ -# $NetBSD: directive-for-null.mk,v 1.3 2022/06/12 15:03:27 rillig Exp $ +# $NetBSD: directive-for-null.mk,v 1.4 2024/04/01 12:26:02 rillig Exp $ # # Test for parsing a .for loop that accidentally contains a null byte. # -# As of 2020-12-19, there are 3 error messages: -# -# make: "(stdin)" line 2: Zero byte read from file -# make: "(stdin)" line 2: Unexpected end of file in for loop. -# make: "(stdin)" line 3: Zero byte read from file -# -# The one about "end of file" might be misleading but is due to the -# implementation. On both errors and EOF, ParseRawLine returns NULL. -# -# The one about the "zero byte" in line 3 is surprising since the only -# line that contains a null byte is line 2. +# expect: make: "(stdin)" line 2: Zero byte read from file all: .PHONY @printf '%s\n' \ diff --git a/unit-tests/directive-for.exp b/unit-tests/directive-for.exp index 0d0313c4e7b0..3e346dfab4ea 100755 --- a/unit-tests/directive-for.exp +++ b/unit-tests/directive-for.exp @@ -17,7 +17,7 @@ make: "directive-for.mk" line 146: }{ }{ }{ make: "directive-for.mk" line 166: invalid character ':' in .for loop variable name make: "directive-for.mk" line 173: invalid character '$' in .for loop variable name make: "directive-for.mk" line 185: invalid character '$' in .for loop variable name -make: "directive-for.mk" line 210: Unknown modifier "Z" +make: "directive-for.mk" line 210: while evaluating "${:Uword2:Z}-after word3": Unknown modifier "Z" make: "directive-for.mk" line 211: XXX: Should not reach word1 make: "directive-for.mk" line 211: XXX: Should not reach before--after make: "directive-for.mk" line 211: XXX: Should not reach word3 diff --git a/unit-tests/directive-for.mk b/unit-tests/directive-for.mk index becc314226dc..d777c3921556 100755 --- a/unit-tests/directive-for.mk +++ b/unit-tests/directive-for.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-for.mk,v 1.24 2023/12/06 22:28:20 rillig Exp $ +# $NetBSD: directive-for.mk,v 1.25 2024/04/20 10:18:55 rillig Exp $ # # Tests for the .for directive. # @@ -206,7 +206,7 @@ INDIRECT= ${DIRECT} # XXX: A parse error or evaluation error in the items of the .for loop # should skip the whole loop. As of 2023-05-09, the loop is expanded as # usual. -# expect+1: Unknown modifier "Z" +# expect+1: while evaluating "${:Uword2:Z}-after word3": Unknown modifier "Z" .for var in word1 before-${:Uword2:Z}-after word3 . info XXX: Should not reach ${var} .endfor diff --git a/unit-tests/directive-include.exp b/unit-tests/directive-include.exp index de94b751b33a..6454b6835edf 100755 --- a/unit-tests/directive-include.exp +++ b/unit-tests/directive-include.exp @@ -4,7 +4,7 @@ CondParser_Eval: ${.MAKE.MAKEFILES:T} != "${.PARSEFILE} null" Comparing "directive-include.mk null" != "directive-include.mk null" make: "directive-include.mk" line 26: Could not find nonexistent.mk make: "directive-include.mk" line 49: Could not find " -make: "directive-include.mk" line 56: Unknown modifier "Z" +make: "directive-include.mk" line 56: while evaluating "${:U123:Z}.mk": Unknown modifier "Z" make: "directive-include.mk" line 56: Could not find nonexistent.mk make: "directive-include.mk" line 61: Cannot open /nonexistent make: "directive-include.mk" line 66: Invalid line 'include' diff --git a/unit-tests/directive-include.mk b/unit-tests/directive-include.mk index 2517b4be6930..14d00600cb8f 100755 --- a/unit-tests/directive-include.mk +++ b/unit-tests/directive-include.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-include.mk,v 1.13 2023/08/19 10:52:14 rillig Exp $ +# $NetBSD: directive-include.mk,v 1.14 2024/04/20 10:18:55 rillig Exp $ # # Tests for the .include directive, which includes another file. @@ -52,7 +52,7 @@ DQUOT= " # expression is skipped and the file is included nevertheless. # FIXME: Add proper error handling, no file must be included here. # expect+2: Could not find nonexistent.mk -# expect+1: Unknown modifier "Z" +# expect+1: while evaluating "${:U123:Z}.mk": Unknown modifier "Z" .include "nonexistent${:U123:Z}.mk" # The traditional include directive is seldom used. diff --git a/unit-tests/directive-undef.exp b/unit-tests/directive-undef.exp index f3957a990e18..329dc8d6282a 100644 --- a/unit-tests/directive-undef.exp +++ b/unit-tests/directive-undef.exp @@ -1,5 +1,5 @@ make: "directive-undef.mk" line 30: The .undef directive requires an argument -make: "directive-undef.mk" line 88: Unknown modifier "Z" +make: "directive-undef.mk" line 88: while evaluating variable "VARNAMES": Unknown modifier "Z" make: "directive-undef.mk" line 105: warning: UT_EXPORTED is still listed in .MAKE.EXPORTED even though spaceit is not exported anymore. make: Fatal errors encountered -- cannot continue make: stopped in unit-tests diff --git a/unit-tests/directive-undef.mk b/unit-tests/directive-undef.mk index ef047fefe177..ac4b20d3e858 100644 --- a/unit-tests/directive-undef.mk +++ b/unit-tests/directive-undef.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-undef.mk,v 1.13 2023/06/01 20:56:35 rillig Exp $ +# $NetBSD: directive-undef.mk,v 1.14 2024/04/20 10:18:55 rillig Exp $ # # Tests for the .undef directive. # @@ -84,7 +84,7 @@ ${DOLLAR}= dollar # # As of var.c 1.762, this doesn't happen though because the error handling # in Var_Parse and Var_Subst is not done properly. -# expect+1: Unknown modifier "Z" +# expect+1: while evaluating variable "VARNAMES": Unknown modifier "Z" .undef ${VARNAMES:L:Z} diff --git a/unit-tests/lint.exp b/unit-tests/lint.exp index db2290c040cd..78761c862298 100755 --- a/unit-tests/lint.exp +++ b/unit-tests/lint.exp @@ -1,4 +1,4 @@ -make: In the :@ modifier of "VAR", the variable name "${:Ubar:S,b,v,}" must not contain a dollar +make: in target "mod-loop-varname": while evaluating variable "VAR": In the :@ modifier, the variable name "${:Ubar:S,b,v,}" must not contain a dollar y@:Q} xvaluey exit status 2 diff --git a/unit-tests/moderrs.exp b/unit-tests/moderrs.exp index 6b41241b6800..0d1bcdc5b0f9 100644 --- a/unit-tests/moderrs.exp +++ b/unit-tests/moderrs.exp @@ -1,11 +1,11 @@ mod-unknown-direct: want: Unknown modifier 'Z' -make: Unknown modifier "Z" +make: in target "mod-unknown-direct": while evaluating variable "VAR": Unknown modifier "Z" VAR:Z=before--after mod-unknown-indirect: want: Unknown modifier 'Z' -make: Unknown modifier "Z" +make: in target "mod-unknown-indirect": while evaluating variable "VAR": Unknown modifier "Z" VAR:Z=before-inner}-after unclosed-direct: @@ -119,17 +119,17 @@ then mod-remember-parse: 1 1 2 3 5 8 13 21 34 -make: Unknown modifier "__" +make: in target "mod-remember-parse": while evaluating variable "FIB": Unknown modifier "__" mod-sysv-parse: -make: Unknown modifier "3" +make: in target "mod-sysv-parse": while evaluating variable "FIB": Unknown modifier "3" make: Unclosed expression, expecting '}' for modifier "3" of variable "FIB" with value "" -make: Unknown modifier "3=" +make: in target "mod-sysv-parse": while evaluating variable "FIB": Unknown modifier "3=" make: Unclosed expression, expecting '}' for modifier "3=" of variable "FIB" with value "" -make: Unknown modifier "3=x3" +make: in target "mod-sysv-parse": while evaluating variable "FIB": Unknown modifier "3=x3" make: Unclosed expression, expecting '}' for modifier "3=x3" of variable "FIB" with value "" 1 1 2 x3 5 8 1x3 21 34 diff --git a/unit-tests/opt-chdir.exp b/unit-tests/opt-chdir.exp index d9759cf9ed8b..3d89360f9a62 100644 --- a/unit-tests/opt-chdir.exp +++ b/unit-tests/opt-chdir.exp @@ -1,5 +1,3 @@ -make: chdir /./././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././: File name too long -*** Error code 2 (ignored) cwd: / make: chdir /nonexistent: No such file or directory *** Error code 2 (ignored) diff --git a/unit-tests/opt-chdir.mk b/unit-tests/opt-chdir.mk index a8806149f31c..e94b8799af2e 100644 --- a/unit-tests/opt-chdir.mk +++ b/unit-tests/opt-chdir.mk @@ -1,4 +1,4 @@ -# $NetBSD: opt-chdir.mk,v 1.6 2021/05/18 17:05:45 sjg Exp $ +# $NetBSD: opt-chdir.mk,v 1.7 2024/04/02 11:11:00 rillig Exp $ # # Tests for the -C command line option, which changes the directory at the # beginning. @@ -7,15 +7,9 @@ .MAKEFLAGS: -d0 # switch stdout to line-buffered -all: chdir-filename-too-long all: chdir-root all: chdir-nonexistent -# Try to overflow the internal buffer for .CURDIR, which is curdir. -chdir-filename-too-long: .PHONY .IGNORE - # 5000 slashes, separated by dots: /./././.../././ - @${MAKE} -C ${:U:range=5000:@@/@:ts.} - # Changing to another directory is possible via the command line. # In this test, it is the root directory since almost any other directory # is not guaranteed to exist on every platform. diff --git a/unit-tests/opt-debug-errors-jobs.exp b/unit-tests/opt-debug-errors-jobs.exp index c957c7736b32..614bb33b9208 100644 --- a/unit-tests/opt-debug-errors-jobs.exp +++ b/unit-tests/opt-debug-errors-jobs.exp @@ -2,6 +2,7 @@ echo '3 spaces'; false 3 spaces *** Failed target: fail-spaces +*** In directory: <curdir> *** Failed commands: echo '3 spaces'; false *** [fail-spaces] Error code 1 @@ -11,6 +12,7 @@ echo \ indented; false indented *** Failed target: fail-escaped-space +*** In directory: <curdir> *** Failed commands: echo \ indented; false *** [fail-escaped-space] Error code 1 @@ -22,6 +24,7 @@ line1 line2 *** Failed target: fail-newline +*** In directory: <curdir> *** Failed commands: echo 'line1${.newline}line2'; false => echo 'line1 @@ -33,6 +36,7 @@ echo 'line1 line2'; false line1 line2 *** Failed target: fail-multiline +*** In directory: <curdir> *** Failed commands: echo 'line1 line2'; false *** [fail-multiline] Error code 1 @@ -42,6 +46,7 @@ echo 'word1' 'word2'; false word1 word2 *** Failed target: fail-multiline-intention +*** In directory: <curdir> *** Failed commands: echo 'word1' 'word2'; false *** [fail-multiline-intention] Error code 1 @@ -49,6 +54,7 @@ word1 word2 make: stopped in unit-tests *** Failed target: fail-vars +*** In directory: <curdir> *** Failed commands: @${COMPILE_C} ${COMPILE_C_FLAGS} => @false c-compiler flag1 -macro="several words" diff --git a/unit-tests/opt-debug-lint.exp b/unit-tests/opt-debug-lint.exp index 5a6510bd029a..c6cd748acd5d 100644 --- a/unit-tests/opt-debug-lint.exp +++ b/unit-tests/opt-debug-lint.exp @@ -2,9 +2,9 @@ make: "opt-debug-lint.mk" line 21: Variable "X" is undefined make: "opt-debug-lint.mk" line 21: Malformed conditional ($X) make: "opt-debug-lint.mk" line 45: Variable "UNDEF" is undefined make: "opt-debug-lint.mk" line 45: Malformed conditional (${UNDEF}) -make: "opt-debug-lint.mk" line 67: Missing delimiter ':' after modifier "L" -make: "opt-debug-lint.mk" line 67: Missing delimiter ':' after modifier "P" -make: "opt-debug-lint.mk" line 76: Unknown modifier "${" +make: "opt-debug-lint.mk" line 67: while evaluating variable "value": Missing delimiter ':' after modifier "L" +make: "opt-debug-lint.mk" line 67: while evaluating variable "value": Missing delimiter ':' after modifier "P" +make: "opt-debug-lint.mk" line 76: while evaluating variable "value": Unknown modifier "${" make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/unit-tests/opt-debug-lint.mk b/unit-tests/opt-debug-lint.mk index 042bfd51d35b..3e946ac6ad61 100644 --- a/unit-tests/opt-debug-lint.mk +++ b/unit-tests/opt-debug-lint.mk @@ -1,4 +1,4 @@ -# $NetBSD: opt-debug-lint.mk,v 1.16 2023/11/19 21:47:52 rillig Exp $ +# $NetBSD: opt-debug-lint.mk,v 1.17 2024/04/20 10:18:55 rillig Exp $ # # Tests for the -dL command line option, which runs additional checks # to catch common mistakes, such as unclosed expressions. @@ -62,8 +62,8 @@ ${UNDEF}: ${UNDEF} # Since 2020-10-03, in lint mode the variable modifier must be separated # by colons. See varparse-mod.mk. -# expect+2: Missing delimiter ':' after modifier "L" -# expect+1: Missing delimiter ':' after modifier "P" +# expect+2: while evaluating variable "value": Missing delimiter ':' after modifier "L" +# expect+1: while evaluating variable "value": Missing delimiter ':' after modifier "P" .if ${value:LPL} != "value" . error .endif @@ -72,7 +72,7 @@ ${UNDEF}: ${UNDEF} # variable modifier had to be separated by colons. This was wrong though # since make always fell back trying to parse the indirect modifier as a # SysV modifier. -# expect+1: Unknown modifier "${" +# expect+1: while evaluating variable "value": Unknown modifier "${" .if ${value:${:UL}PL} != "LPL}" # FIXME: "LPL}" is unexpected here. . error ${value:${:UL}PL} .endif diff --git a/unit-tests/opt-debug-parse.exp b/unit-tests/opt-debug-parse.exp index 811c6b45dce5..a19a58bcc965 100644 --- a/unit-tests/opt-debug-parse.exp +++ b/unit-tests/opt-debug-parse.exp @@ -1,3 +1,4 @@ +Parsing line 16: .for var in value Parse_PushInput: .for loop in opt-debug-parse.mk, line 16 SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `opt-debug-parse.mk' Parsing line 21: .info trace with multi-line .for loop head @@ -11,6 +12,7 @@ SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `null' SetFilenameVars: ${.INCLUDEDFROMDIR} = <some-dir> ${.INCLUDEDFROMFILE} = `opt-debug-parse.mk' ParseEOF: returning to file opt-debug-parse.mk, line 27 SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `opt-debug-parse.mk' +Parsing line 31: .for a b c in 1 2 3 ${:U4 5 6} Parse_PushInput: .for loop in opt-debug-parse.mk, line 31 SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `opt-debug-parse.mk' Parsing line 34: .info trace diff --git a/unit-tests/opt-file.exp b/unit-tests/opt-file.exp index 76a832949aca..9550958fea37 100644 --- a/unit-tests/opt-file.exp +++ b/unit-tests/opt-file.exp @@ -2,9 +2,7 @@ value value line-with-trailing-whitespace make: "(stdin)" line 1: Zero byte read from file -make: Fatal errors encountered -- cannot continue -make: stopped in unit-tests -*** Error code 1 (continuing) +*** Error code 2 (continuing) `all' not remade because of errors. Stop. diff --git a/unit-tests/opt-file.mk b/unit-tests/opt-file.mk index 5085fe126af8..0f07ede560f5 100644 --- a/unit-tests/opt-file.mk +++ b/unit-tests/opt-file.mk @@ -1,4 +1,4 @@ -# $NetBSD: opt-file.mk,v 1.15 2022/03/26 13:32:31 rillig Exp $ +# $NetBSD: opt-file.mk,v 1.16 2024/04/01 12:26:02 rillig Exp $ # # Tests for the -f command line option, which adds a makefile to the list of # files that are parsed. @@ -79,7 +79,7 @@ line-with-trailing-whitespace: .PHONY # exit status 0 # # 2008 to 2010: -# make: "zero-byte.in" line 1: Zero byte read from file +# make: "(stdin)" line 1: Zero byte read from file # make: Fatal errors encountered -- cannot continue # # make: stopped in . @@ -92,14 +92,18 @@ line-with-trailing-whitespace: .PHONY # exit status 2 # # 2014 to 2020-12-06: -# make: "zero-byte.in" line 1: warning: Zero byte read from file, skipping rest of line. +# make: "(stdin)" line 1: warning: Zero byte read from file, skipping rest of line. # exit status 0 # # Since 2020-12-07: -# make: "zero-byte.in" line 1: Zero byte read from file +# make: "(stdin)" line 1: Zero byte read from file # make: Fatal errors encountered -- cannot continue # make: stopped in . # exit status 1 +# +# Since 2024-04-01: +# make: "(stdin)" line 1: Zero byte read from file +# *** Error code 2 (continuing) file-containing-null-byte: .PHONY @printf '%s\n' 'VAR=value' 'VAR2=VALUE2' \ | tr 'l' '\0' \ diff --git a/unit-tests/opt-keep-going-indirect.mk b/unit-tests/opt-keep-going-indirect.mk index 22f7be945f71..5d18553fa512 100644 --- a/unit-tests/opt-keep-going-indirect.mk +++ b/unit-tests/opt-keep-going-indirect.mk @@ -1,4 +1,4 @@ -# $NetBSD: opt-keep-going-indirect.mk,v 1.2 2022/02/12 20:05:36 rillig Exp $ +# $NetBSD: opt-keep-going-indirect.mk,v 1.3 2024/04/02 15:05:15 rillig Exp $ # # Tests for the -k command line option, which stops building a target as soon # as an error is detected, but continues building the other, independent @@ -49,19 +49,19 @@ # to the child processes. all: @echo 'direct compat' - @set +e; env -i ${MAKE} -r -f ${MAKEFILE} -k direct; echo "exited $$?" + @set +e; env -i "PATH=$$PATH" ${MAKE} -r -f ${MAKEFILE} -k direct; echo "exited $$?" @echo @echo 'direct jobs' - @set +e; env -i ${MAKE} -r -f ${MAKEFILE} -k direct -j1; echo "exited $$?" + @set +e; env -i "PATH=$$PATH" ${MAKE} -r -f ${MAKEFILE} -k direct -j1; echo "exited $$?" @echo @echo 'indirect compat' - @set +e; env -i ${MAKE} -r -f ${MAKEFILE} -k indirect; echo "exited $$?" + @set +e; env -i "PATH=$$PATH" ${MAKE} -r -f ${MAKEFILE} -k indirect; echo "exited $$?" @echo @echo 'indirect jobs' - @set +e; env -i ${MAKE} -r -f ${MAKEFILE} -k indirect -j1; echo "exited $$?" + @set +e; env -i "PATH=$$PATH" ${MAKE} -r -f ${MAKEFILE} -k indirect -j1; echo "exited $$?" @echo indirect: direct diff --git a/unit-tests/opt-m-include-dir.mk b/unit-tests/opt-m-include-dir.mk index 6e0801390395..b677f172e85b 100644 --- a/unit-tests/opt-m-include-dir.mk +++ b/unit-tests/opt-m-include-dir.mk @@ -1,4 +1,4 @@ -# $NetBSD: opt-m-include-dir.mk,v 1.4 2020/09/01 20:14:34 rillig Exp $ +# $NetBSD: opt-m-include-dir.mk,v 1.5 2024/04/30 16:13:34 sjg Exp $ # # Tests for the -m command line option, which adds a directory to the # search path for the .include <...> directive. @@ -22,11 +22,14 @@ TEST_DIR:= ${.PARSEFILE:R}.tmp/sub/sub/sub/workdir CANARY_FILE:= ${.PARSEFILE:R}.tmp/sub/opt-m-canary.mk ACTUAL_FILE:= ${.PARSEFILE:R}.tmp/sub/opt-m-step3.mk +WANTED_FILE:= ${.PARSEFILE:R}.tmp/sub/opt-m-check.mk _!= mkdir -p ${TEST_DIR} _!= > ${CANARY_FILE} _!= cp ${MAKEFILE} ${TEST_DIR}/step2.mk _!= cp ${MAKEFILE} ${ACTUAL_FILE} +_!= echo CHECK=ok > ${WANTED_FILE} +_!= echo CHECK=${WANTED_FILE:T} found in .CURDIR > ${TEST_DIR}/${WANTED_FILE:T} step1: @${.MAKE} -C ${TEST_DIR} -f step2.mk step2 @@ -52,9 +55,10 @@ step1: .elif ${.PARSEFILE:T} == "opt-m-step3.mk" # This file is included by step2.mk. +.include <opt-m-check.mk> step2: - @echo ok + @echo ${CHECK} .else . error diff --git a/unit-tests/var-eval-short.exp b/unit-tests/var-eval-short.exp index 14e3d372f198..6b42c27e22bc 100644 --- a/unit-tests/var-eval-short.exp +++ b/unit-tests/var-eval-short.exp @@ -1,5 +1,6 @@ -make: "var-eval-short.mk" line 46: In the :@ modifier of "", the variable name "${FAIL}" must not contain a dollar +make: "var-eval-short.mk" line 46: while evaluating "${:Uword:@${FAIL}@expr@}": In the :@ modifier, the variable name "${FAIL}" must not contain a dollar make: "var-eval-short.mk" line 46: Malformed conditional (0 && ${:Uword:@${FAIL}@expr@}) +Parsing line 159: .if 0 && ${0:?${FAIL}then:${FAIL}else} CondParser_Eval: 0 && ${0:?${FAIL}then:${FAIL}else} Var_Parse: ${0:?${FAIL}then:${FAIL}else} (parse-only) Parsing modifier ${0:?...} @@ -10,6 +11,7 @@ Modifier part: "${FAIL}else" Result of ${0:?${FAIL}then:${FAIL}else} is "" (parse-only, defined) Parsing line 167: DEFINED= defined Global: DEFINED = defined +Parsing line 168: .if 0 && ${DEFINED:L:?${FAIL}then:${FAIL}else} CondParser_Eval: 0 && ${DEFINED:L:?${FAIL}then:${FAIL}else} Var_Parse: ${DEFINED:L:?${FAIL}then:${FAIL}else} (parse-only) Parsing modifier ${DEFINED:L} diff --git a/unit-tests/var-eval-short.mk b/unit-tests/var-eval-short.mk index 2b25d82e96b8..5a42335a4474 100644 --- a/unit-tests/var-eval-short.mk +++ b/unit-tests/var-eval-short.mk @@ -1,4 +1,4 @@ -# $NetBSD: var-eval-short.mk,v 1.11 2023/10/19 18:24:33 rillig Exp $ +# $NetBSD: var-eval-short.mk,v 1.12 2024/04/20 10:18:55 rillig Exp $ # # Tests for each variable modifier to ensure that they only do the minimum # necessary computations. If the result of the expression is irrelevant, @@ -41,7 +41,7 @@ FAIL= ${:!echo unexpected 1>&2!} # after the loop, when undefining the temporary global loop variable. # Since var.c 1.907 from 2021-04-04, a '$' is no longer allowed in the # variable name. -# expect+2: In the :@ modifier of "", the variable name "${FAIL}" must not contain a dollar +# expect+2: while evaluating "${:Uword:@${FAIL}@expr@}": In the :@ modifier, the variable name "${FAIL}" must not contain a dollar # expect+1: Malformed conditional (0 && ${:Uword:@${FAIL}@expr@}) .if 0 && ${:Uword:@${FAIL}@expr@} .endif diff --git a/unit-tests/var-op-expand.exp b/unit-tests/var-op-expand.exp index 5ea4e6b6954c..0eafc9ae4c39 100644 --- a/unit-tests/var-op-expand.exp +++ b/unit-tests/var-op-expand.exp @@ -1,6 +1,6 @@ -make: "var-op-expand.mk" line 274: Unknown modifier "s,value,replaced," +make: "var-op-expand.mk" line 274: while evaluating variable "indirect": while evaluating variable "later": Unknown modifier "s,value,replaced," make: "var-op-expand.mk" line 278: warning: XXX Neither branch should be taken. -make: "var-op-expand.mk" line 283: Unknown modifier "s,value,replaced," +make: "var-op-expand.mk" line 283: while evaluating variable "indirect": while evaluating variable "later": Unknown modifier "s,value,replaced," make: "var-op-expand.mk" line 285: warning: XXX Neither branch should be taken. make: Fatal errors encountered -- cannot continue make: stopped in unit-tests diff --git a/unit-tests/var-op-expand.mk b/unit-tests/var-op-expand.mk index 76b90bf72b56..fb1e6d2c390f 100644 --- a/unit-tests/var-op-expand.mk +++ b/unit-tests/var-op-expand.mk @@ -1,4 +1,4 @@ -# $NetBSD: var-op-expand.mk,v 1.19 2023/11/19 21:47:52 rillig Exp $ +# $NetBSD: var-op-expand.mk,v 1.20 2024/04/20 10:18:55 rillig Exp $ # # Tests for the := variable assignment operator, which expands its # right-hand side. @@ -270,7 +270,7 @@ later= lowercase-value .undef later INDIRECT:= ${LATER:S,value,replaced,} OK ${LATER:value=sysv} indirect:= ${INDIRECT:tl} -# expect+1: Unknown modifier "s,value,replaced," +# expect+1: while evaluating variable "indirect": while evaluating variable "later": Unknown modifier "s,value,replaced," .if ${indirect} != " ok " . error .else @@ -279,7 +279,7 @@ indirect:= ${INDIRECT:tl} .endif LATER= uppercase-value later= lowercase-value -# expect+1: Unknown modifier "s,value,replaced," +# expect+1: while evaluating variable "indirect": while evaluating variable "later": Unknown modifier "s,value,replaced," .if ${indirect} != "uppercase-replaced ok uppercase-sysv" # expect+1: warning: XXX Neither branch should be taken. . warning XXX Neither branch should be taken. diff --git a/unit-tests/vardebug.exp b/unit-tests/vardebug.exp index a0aa6a301800..86f2ac0b420d 100644 --- a/unit-tests/vardebug.exp +++ b/unit-tests/vardebug.exp @@ -54,7 +54,7 @@ Var_Parse: ${:Uvariable:unknown} (eval-defined) Evaluating modifier ${:U...} on value "" (eval-defined, undefined) Result of ${:Uvariable} is "variable" (eval-defined, defined) Evaluating modifier ${:u...} on value "variable" (eval-defined, defined) -make: "vardebug.mk" line 63: Unknown modifier "unknown" +make: "vardebug.mk" line 63: while evaluating "${:Uvariable:unknown}": Unknown modifier "unknown" Result of ${:unknown} is error (eval-defined, defined) make: "vardebug.mk" line 63: Malformed conditional (${:Uvariable:unknown}) Var_Parse: ${UNDEFINED} (eval-defined) diff --git a/unit-tests/vardebug.mk b/unit-tests/vardebug.mk index b9b094772b54..6c5703cb526f 100644 --- a/unit-tests/vardebug.mk +++ b/unit-tests/vardebug.mk @@ -1,4 +1,4 @@ -# $NetBSD: vardebug.mk,v 1.9 2023/12/20 09:46:00 rillig Exp $ +# $NetBSD: vardebug.mk,v 1.10 2024/04/20 10:18:55 rillig Exp $ # # Demonstrates the debugging output for var.c. @@ -59,7 +59,7 @@ VAR+= 3 # as "is error", without surrounding quotes. # expect: Result of ${:unknown} is error (eval-defined, defined) # expect+2: Malformed conditional (${:Uvariable:unknown}) -# expect+1: Unknown modifier "unknown" +# expect+1: while evaluating "${:Uvariable:unknown}": Unknown modifier "unknown" .if ${:Uvariable:unknown} .endif diff --git a/unit-tests/varmisc.exp b/unit-tests/varmisc.exp index 61e6a49963a0..dd24a419fe75 100644 --- a/unit-tests/varmisc.exp +++ b/unit-tests/varmisc.exp @@ -44,26 +44,26 @@ parse-dynamic: parse-dynamic parse-dynamic before parse-dynamic: parse-dynamic parse-dynamic after parse-dynamic: parse-dynamic parse-dynamic after varerror-unclosed:begin -make: Unclosed variable "" +make: in target "varerror-unclosed": Unclosed variable "" -make: Unclosed variable "UNCLOSED" +make: in target "varerror-unclosed": Unclosed variable "UNCLOSED" -make: Unclosed variable "UNCLOSED" +make: in target "varerror-unclosed": Unclosed variable "UNCLOSED" -make: Unclosed variable "PATTERN" +make: in target "varerror-unclosed": while evaluating variable "UNCLOSED": Unclosed variable "PATTERN" make: Unclosed expression, expecting '}' for modifier "M${PATTERN" of variable "UNCLOSED" with value "" -make: Unclosed variable "param" -make: Unclosed variable "UNCLOSED." +make: in target "varerror-unclosed": Unclosed variable "param" +make: in target "varerror-unclosed": Unclosed variable "UNCLOSED." -make: Unclosed variable "UNCLOSED.1" +make: in target "varerror-unclosed": Unclosed variable "UNCLOSED.1" -make: Unclosed variable "UNCLOSED.2" +make: in target "varerror-unclosed": Unclosed variable "UNCLOSED.2" -make: Unclosed variable "UNCLOSED.3" +make: in target "varerror-unclosed": Unclosed variable "UNCLOSED.3" -make: Unclosed variable "UNCLOSED_ORIG" +make: in target "varerror-unclosed": while evaluating variable "UNCLOSED_INDIR_2": while evaluating variable "UNCLOSED_INDIR_1": Unclosed variable "UNCLOSED_ORIG" varerror-unclosed:end target1-flags: we have: one two diff --git a/unit-tests/varmod-assign.exp b/unit-tests/varmod-assign.exp index f258f92ea05b..db1fa64c8479 100644 --- a/unit-tests/varmod-assign.exp +++ b/unit-tests/varmod-assign.exp @@ -42,7 +42,7 @@ mod-assign-empty: value} make: Bad modifier ":" for variable "" mod-assign-empty: overwritten} mod-assign-empty: VAR=overwritten -make: Unknown modifier ":x" +make: in target "mod-assign-parse": while evaluating variable "ASSIGN": Unknown modifier ":x" sysv:y make: Unfinished modifier for "ASSIGN" ('}' missing) diff --git a/unit-tests/varmod-assign.mk b/unit-tests/varmod-assign.mk index f7112c47c935..17d9df764be1 100644 --- a/unit-tests/varmod-assign.mk +++ b/unit-tests/varmod-assign.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-assign.mk,v 1.19 2024/01/07 11:42:22 rillig Exp $ +# $NetBSD: varmod-assign.mk,v 1.20 2024/04/20 10:18:55 rillig Exp $ # # Tests for the obscure ::= variable modifiers, which perform variable # assignments during evaluation, just like the = operator in C. @@ -90,7 +90,7 @@ mod-assign-empty: mod-assign-parse: # The modifier for assignment operators starts with a ':'. # An 'x' after that is an invalid modifier. - # expect: make: Unknown modifier ":x" + # expect: make: in target "mod-assign-parse": while evaluating variable "ASSIGN": Unknown modifier ":x" @echo ${ASSIGN::x} # When parsing an assignment operator fails because the operator is diff --git a/unit-tests/varmod-edge.exp b/unit-tests/varmod-edge.exp index c2477f16e950..fad5cb2c3c94 100644 --- a/unit-tests/varmod-edge.exp +++ b/unit-tests/varmod-edge.exp @@ -15,10 +15,10 @@ make: "varmod-edge.mk" line 184: ok eq-bs make: Unfinished modifier for "INP.eq-esc" ('=' missing) make: "varmod-edge.mk" line 184: ok eq-esc make: "varmod-edge.mk" line 184: ok colon -make: "varmod-edge.mk" line 167: Unknown modifier ":" -make: "varmod-edge.mk" line 167: Unknown modifier ":" +make: "varmod-edge.mk" line 167: while evaluating variable "MOD.colons": while evaluating variable "INP.colons": Unknown modifier ":" +make: "varmod-edge.mk" line 167: while evaluating variable "MOD.colons": while evaluating variable "INP.colons": Unknown modifier ":" make: "varmod-edge.mk" line 184: ok colons -make: "varmod-edge.mk" line 195: Unknown modifier "Z" +make: "varmod-edge.mk" line 195: while evaluating "${:Z}": Unknown modifier "Z" make: "varmod-edge.mk" line 195: Malformed conditional (${:Z}) make: Unfinished modifier for "" (',' missing) make: "varmod-edge.mk" line 209: Malformed conditional (${:S,}) diff --git a/unit-tests/varmod-edge.mk b/unit-tests/varmod-edge.mk index 91220d99e47d..2f8f8c793de1 100644 --- a/unit-tests/varmod-edge.mk +++ b/unit-tests/varmod-edge.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-edge.mk,v 1.19 2023/11/19 22:06:15 rillig Exp $ +# $NetBSD: varmod-edge.mk,v 1.20 2024/04/20 10:18:55 rillig Exp $ # # Tests for edge cases in variable modifiers. # @@ -162,8 +162,8 @@ MOD.colons= ${INP.colons::::} EXP.colons= # empty .for test in ${TESTS} -# expect+2: Unknown modifier ":" -# expect+1: Unknown modifier ":" +# expect+2: while evaluating variable "MOD.colons": while evaluating variable "INP.colons": Unknown modifier ":" +# expect+1: while evaluating variable "MOD.colons": while evaluating variable "INP.colons": Unknown modifier ":" . if ${MOD.${test}} == ${EXP.${test}} # expect+16: ok M-paren # expect+15: ok M-mixed @@ -191,7 +191,7 @@ EXP.colons= # empty # XXX: The error message should mention the variable name of the expression, # even though that name is empty in this case. # expect+2: Malformed conditional (${:Z}) -# expect+1: Unknown modifier "Z" +# expect+1: while evaluating "${:Z}": Unknown modifier "Z" .if ${:Z} . error .else diff --git a/unit-tests/varmod-gmtime.exp b/unit-tests/varmod-gmtime.exp index bbb8bd547bd5..1b12ead96d85 100644 --- a/unit-tests/varmod-gmtime.exp +++ b/unit-tests/varmod-gmtime.exp @@ -1,12 +1,12 @@ -make: "varmod-gmtime.mk" line 61: Invalid time value "-1" +make: "varmod-gmtime.mk" line 61: while evaluating "${:L:gmtime=-1} != """: Invalid time value "-1" make: "varmod-gmtime.mk" line 61: Malformed conditional (${:L:gmtime=-1} != "") -make: "varmod-gmtime.mk" line 72: Invalid time value " 1" +make: "varmod-gmtime.mk" line 72: while evaluating "${:L:gmtime= 1} != """: Invalid time value " 1" make: "varmod-gmtime.mk" line 72: Malformed conditional (${:L:gmtime= 1} != "") -make: "varmod-gmtime.mk" line 120: Invalid time value "10000000000000000000000000000000" +make: "varmod-gmtime.mk" line 120: while evaluating "${:L:gmtime=10000000000000000000000000000000} != """: Invalid time value "10000000000000000000000000000000" make: "varmod-gmtime.mk" line 120: Malformed conditional (${:L:gmtime=10000000000000000000000000000000} != "") -make: "varmod-gmtime.mk" line 133: Invalid time value "error" +make: "varmod-gmtime.mk" line 133: while evaluating "${:L:gmtime=error} != """: Invalid time value "error" make: "varmod-gmtime.mk" line 133: Malformed conditional (${:L:gmtime=error} != "") -make: "varmod-gmtime.mk" line 144: Invalid time value "100000S,1970,bad," +make: "varmod-gmtime.mk" line 144: while evaluating variable "%Y": Invalid time value "100000S,1970,bad," make: "varmod-gmtime.mk" line 144: Malformed conditional (${%Y:L:gmtime=100000S,1970,bad,} != "bad") make: Fatal errors encountered -- cannot continue make: stopped in unit-tests diff --git a/unit-tests/varmod-gmtime.mk b/unit-tests/varmod-gmtime.mk index c30f5edbecc2..db24b1680c46 100644 --- a/unit-tests/varmod-gmtime.mk +++ b/unit-tests/varmod-gmtime.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-gmtime.mk,v 1.21 2023/11/19 21:47:52 rillig Exp $ +# $NetBSD: varmod-gmtime.mk,v 1.22 2024/04/20 10:18:55 rillig Exp $ # # Tests for the :gmtime variable modifier, which formats a timestamp # using strftime(3) in UTC. @@ -56,7 +56,7 @@ # 1970. Going back 50 years in the past is not a practical use case for # make. Therefore, since var.c 1.631, negative time stamps produce a # parse error. -# expect+2: Invalid time value "-1" +# expect+2: while evaluating "${:L:gmtime=-1} != """: Invalid time value "-1" # expect+1: Malformed conditional (${:L:gmtime=-1} != "") .if ${:L:gmtime=-1} != "" . error @@ -67,7 +67,7 @@ # Spaces were allowed before var.c 1.631 from 2020-10-31 21:40:20, not # because it would make sense but just as a side-effect from using strtoul. -# expect+2: Invalid time value " 1" +# expect+2: while evaluating "${:L:gmtime= 1} != """: Invalid time value " 1" # expect+1: Malformed conditional (${:L:gmtime= 1} != "") .if ${:L:gmtime= 1} != "" . error @@ -115,7 +115,7 @@ # # Since var.c 1.631 from 2020-10-31, the overflow is detected and produces a # parse error. -# expect+2: Invalid time value "10000000000000000000000000000000" +# expect+2: while evaluating "${:L:gmtime=10000000000000000000000000000000} != """: Invalid time value "10000000000000000000000000000000" # expect+1: Malformed conditional (${:L:gmtime=10000000000000000000000000000000} != "") .if ${:L:gmtime=10000000000000000000000000000000} != "" . error @@ -128,7 +128,7 @@ # stopped after the '=', and the remaining string was parsed for more variable # modifiers. Because of the unknown modifier 'e' from the 'error', the whole # variable value was discarded and thus not printed. -# expect+2: Invalid time value "error" +# expect+2: while evaluating "${:L:gmtime=error} != """: Invalid time value "error" # expect+1: Malformed conditional (${:L:gmtime=error} != "") .if ${:L:gmtime=error} != "" . error @@ -139,7 +139,7 @@ # Before var.c 1.1050 from 2023-05-09, the timestamp could be directly # followed by the next modifier, without a ':' separator. This was the same # bug as for the ':L' and ':P' modifiers. -# expect+2: Invalid time value "100000S,1970,bad," +# expect+2: while evaluating variable "%Y": Invalid time value "100000S,1970,bad," # expect+1: Malformed conditional (${%Y:L:gmtime=100000S,1970,bad,} != "bad") .if ${%Y:L:gmtime=100000S,1970,bad,} != "bad" . error diff --git a/unit-tests/varmod-hash.exp b/unit-tests/varmod-hash.exp index 1286b456c6c2..e385c3b3ae11 100644 --- a/unit-tests/varmod-hash.exp +++ b/unit-tests/varmod-hash.exp @@ -1,9 +1,9 @@ -make: Unknown modifier "has" +make: in target "all": while evaluating variable "12345": Unknown modifier "has" 26bb0f5f 12345 -make: Unknown modifier "hasX" +make: in target "all": while evaluating variable "12345": Unknown modifier "hasX" -make: Unknown modifier "hashed" +make: in target "all": while evaluating variable "12345": Unknown modifier "hashed" exit status 0 diff --git a/unit-tests/varmod-ifelse.exp b/unit-tests/varmod-ifelse.exp index 653fe104ddaa..8b9d41bd2427 100644 --- a/unit-tests/varmod-ifelse.exp +++ b/unit-tests/varmod-ifelse.exp @@ -16,7 +16,7 @@ CondParser_Eval: ${VAR} == value Comparing "value" == "value" Comparing "ok" != "ok" make: "varmod-ifelse.mk" line 158: no. -make: "varmod-ifelse.mk" line 162: Comparison with '>=' requires both operands 'no' and '10' to be numeric +make: "varmod-ifelse.mk" line 162: while evaluating variable "string == "literal" || no >= 10": Comparison with '>=' requires both operands 'no' and '10' to be numeric make: Bad conditional expression 'string == "literal" || no >= 10' before '?yes:no' make: "varmod-ifelse.mk" line 162: . make: Bad conditional expression 'string == "literal" && >= 10' before '?yes:no' diff --git a/unit-tests/varmod-ifelse.mk b/unit-tests/varmod-ifelse.mk index 5c8b55d92717..3bf433027950 100644 --- a/unit-tests/varmod-ifelse.mk +++ b/unit-tests/varmod-ifelse.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-ifelse.mk,v 1.26 2023/12/10 20:12:28 rillig Exp $ +# $NetBSD: varmod-ifelse.mk,v 1.28 2024/04/23 22:51:28 rillig Exp $ # # Tests for the ${cond:?then:else} variable modifier, which evaluates either # the then-expression or the else-expression, depending on the condition. @@ -156,7 +156,7 @@ STRING= string NUMBER= no # not really a number # expect+1: no. .info ${${STRING} == "literal" && ${NUMBER} >= 10:?yes:no}. -# expect+3: Comparison with '>=' requires both operands 'no' and '10' to be numeric +# expect+3: while evaluating variable "string == "literal" || no >= 10": Comparison with '>=' requires both operands 'no' and '10' to be numeric # expect: make: Bad conditional expression 'string == "literal" || no >= 10' before '?yes:no' # expect+1: . .info ${${STRING} == "literal" || ${NUMBER} >= 10:?yes:no}. @@ -294,7 +294,7 @@ INDIRECT_COND2= $${DELAYED} == "two" # In the modifier parts for the 'then' and 'else' branches, subexpressions are -# parsed in by inspecting the actual modifiers. In 2008, 2015, 2020, 2022 and +# parsed by inspecting the actual modifiers. In 2008, 2015, 2020, 2022 and # 2023, the exact parsing algorithm switched a few times, counting balanced # braces instead of proper subexpressions, which meant that unbalanced braces # were parsed differently, depending on whether the branch was active or not. diff --git a/unit-tests/varmod-indirect.exp b/unit-tests/varmod-indirect.exp index ecf52033ee4b..376beb8edef9 100644 --- a/unit-tests/varmod-indirect.exp +++ b/unit-tests/varmod-indirect.exp @@ -1,5 +1,5 @@ -make: "varmod-indirect.mk" line 19: Unknown modifier "${" -make: "varmod-indirect.mk" line 52: Unknown modifier "${" +make: "varmod-indirect.mk" line 19: while evaluating variable "value": Unknown modifier "${" +make: "varmod-indirect.mk" line 52: while evaluating variable "value": Unknown modifier "${" make: "varmod-indirect.mk" line 54: warning: FIXME: this expression should have resulted in a parse error rather than returning the unparsed portion of the expression. make: "varmod-indirect.mk" line 143: before make: "varmod-indirect.mk" line 143: after @@ -7,7 +7,7 @@ make: "varmod-indirect.mk" line 151: before make: "varmod-indirect.mk" line 151: after make: "varmod-indirect.mk" line 159: before make: "varmod-indirect.mk" line 159: after -make: "varmod-indirect.mk" line 164: Unknown modifier "Z" +make: "varmod-indirect.mk" line 164: while evaluating variable "UNDEF": Unknown modifier "Z" make: "varmod-indirect.mk" line 167: before make: "varmod-indirect.mk" line 167: after Parsing line 176: _:= before ${UNDEF} after @@ -31,7 +31,7 @@ Parsing line 195: _:= before ${UNDEF:${:UZ}} after Var_Parse: ${UNDEF:${:UZ}} after (eval-keep-dollar-and-undefined) Indirect modifier "Z" from "${:UZ}" Evaluating modifier ${UNDEF:Z} on value "" (eval-keep-dollar-and-undefined, undefined) -make: "varmod-indirect.mk" line 195: Unknown modifier "Z" +make: "varmod-indirect.mk" line 195: while evaluating variable "UNDEF": Unknown modifier "Z" Result of ${UNDEF:Z} is error (eval-keep-dollar-and-undefined, undefined) Global: _ = before ${UNDEF:Z} after Parsing line 197: .MAKEFLAGS: -d0 diff --git a/unit-tests/varmod-indirect.mk b/unit-tests/varmod-indirect.mk index 99e7215aa639..869231d47ebc 100644 --- a/unit-tests/varmod-indirect.mk +++ b/unit-tests/varmod-indirect.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-indirect.mk,v 1.18 2024/02/04 10:03:10 rillig Exp $ +# $NetBSD: varmod-indirect.mk,v 1.19 2024/04/20 10:18:55 rillig Exp $ # # Tests for indirect variable modifiers, such as in ${VAR:${M_modifiers}}. # These can be used for very basic purposes like converting a string to either @@ -15,7 +15,7 @@ # The following expression generates a parse error since its indirect # modifier contains more than a sole expression. # -# expect+1: Unknown modifier "${" +# expect+1: while evaluating variable "value": Unknown modifier "${" .if ${value:L:${:US}${:U,value,replacement,}} != "S,value,replacement,}" . warning unexpected .endif @@ -47,7 +47,7 @@ # error. Because of this parse error, this feature cannot be used reasonably # in practice. # -# expect+2: Unknown modifier "${" +# expect+2: while evaluating variable "value": Unknown modifier "${" #.MAKEFLAGS: -dvc .if ${value:L:${:UM*}S,value,replaced,} == "M*S,value,replaced,}" # expect+1: warning: FIXME: this expression should have resulted in a parse error rather than returning the unparsed portion of the expression. @@ -160,7 +160,7 @@ M_NoPrimes= ${PRIMES:${M_ListToSkip}} .endfor # An error in an indirect modifier. -# expect+1: Unknown modifier "Z" +# expect+1: while evaluating variable "UNDEF": Unknown modifier "Z" .for var in before ${UNDEF:${:UZ}} after # expect+2: before # expect+1: after @@ -191,7 +191,7 @@ _:= before ${UNDEF:${:U}} after # XXX: This expands to ${UNDEF:Z}, which will behave differently if the # variable '_' is used in a context where the expression ${_} is # parsed but not evaluated. -# expect+1: Unknown modifier "Z" +# expect+1: while evaluating variable "UNDEF": Unknown modifier "Z" _:= before ${UNDEF:${:UZ}} after .MAKEFLAGS: -d0 diff --git a/unit-tests/varmod-localtime.exp b/unit-tests/varmod-localtime.exp index a7c3ff6ab932..1bb547289edd 100644 --- a/unit-tests/varmod-localtime.exp +++ b/unit-tests/varmod-localtime.exp @@ -1,12 +1,12 @@ -make: "varmod-localtime.mk" line 61: Invalid time value "-1" +make: "varmod-localtime.mk" line 61: while evaluating "${:L:localtime=-1} != """: Invalid time value "-1" make: "varmod-localtime.mk" line 61: Malformed conditional (${:L:localtime=-1} != "") -make: "varmod-localtime.mk" line 72: Invalid time value " 1" +make: "varmod-localtime.mk" line 72: while evaluating "${:L:localtime= 1} != """: Invalid time value " 1" make: "varmod-localtime.mk" line 72: Malformed conditional (${:L:localtime= 1} != "") -make: "varmod-localtime.mk" line 120: Invalid time value "10000000000000000000000000000000" +make: "varmod-localtime.mk" line 120: while evaluating "${:L:localtime=10000000000000000000000000000000} != """: Invalid time value "10000000000000000000000000000000" make: "varmod-localtime.mk" line 120: Malformed conditional (${:L:localtime=10000000000000000000000000000000} != "") -make: "varmod-localtime.mk" line 133: Invalid time value "error" +make: "varmod-localtime.mk" line 133: while evaluating "${:L:localtime=error} != """: Invalid time value "error" make: "varmod-localtime.mk" line 133: Malformed conditional (${:L:localtime=error} != "") -make: "varmod-localtime.mk" line 144: Invalid time value "100000S,1970,bad," +make: "varmod-localtime.mk" line 144: while evaluating variable "%Y": Invalid time value "100000S,1970,bad," make: "varmod-localtime.mk" line 144: Malformed conditional (${%Y:L:localtime=100000S,1970,bad,} != "bad") make: Fatal errors encountered -- cannot continue make: stopped in unit-tests diff --git a/unit-tests/varmod-localtime.mk b/unit-tests/varmod-localtime.mk index f6fcc61a7fa6..233e556e0c77 100644 --- a/unit-tests/varmod-localtime.mk +++ b/unit-tests/varmod-localtime.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-localtime.mk,v 1.14 2023/11/19 21:47:52 rillig Exp $ +# $NetBSD: varmod-localtime.mk,v 1.15 2024/04/20 10:18:55 rillig Exp $ # # Tests for the :localtime variable modifier, which formats a timestamp # using strftime(3) in local time. @@ -56,7 +56,7 @@ # 1970. Going back 50 years in the past is not a practical use case for # make. Therefore, since var.c 1.631, negative time stamps produce a # parse error. -# expect+2: Invalid time value "-1" +# expect+2: while evaluating "${:L:localtime=-1} != """: Invalid time value "-1" # expect+1: Malformed conditional (${:L:localtime=-1} != "") .if ${:L:localtime=-1} != "" . error @@ -67,7 +67,7 @@ # Spaces were allowed before var.c 1.631 from 2020-10-31 21:40:20, not # because it would make sense but just as a side-effect from using strtoul. -# expect+2: Invalid time value " 1" +# expect+2: while evaluating "${:L:localtime= 1} != """: Invalid time value " 1" # expect+1: Malformed conditional (${:L:localtime= 1} != "") .if ${:L:localtime= 1} != "" . error @@ -115,7 +115,7 @@ # # Since var.c 1.631 from 2020-10-31, the overflow is detected and produces a # parse error. -# expect+2: Invalid time value "10000000000000000000000000000000" +# expect+2: while evaluating "${:L:localtime=10000000000000000000000000000000} != """: Invalid time value "10000000000000000000000000000000" # expect+1: Malformed conditional (${:L:localtime=10000000000000000000000000000000} != "") .if ${:L:localtime=10000000000000000000000000000000} != "" . error @@ -128,7 +128,7 @@ # stopped after the '=', and the remaining string was parsed for more variable # modifiers. Because of the unknown modifier 'e' from the 'error', the whole # variable value was discarded and thus not printed. -# expect+2: Invalid time value "error" +# expect+2: while evaluating "${:L:localtime=error} != """: Invalid time value "error" # expect+1: Malformed conditional (${:L:localtime=error} != "") .if ${:L:localtime=error} != "" . error @@ -139,7 +139,7 @@ # Before var.c 1.1050 from 2023-05-09, the timestamp could be directly # followed by the next modifier, without a ':' separator. This was the same # bug as for the ':L' and ':P' modifiers. -# expect+2: Invalid time value "100000S,1970,bad," +# expect+2: while evaluating variable "%Y": Invalid time value "100000S,1970,bad," # expect+1: Malformed conditional (${%Y:L:localtime=100000S,1970,bad,} != "bad") .if ${%Y:L:localtime=100000S,1970,bad,} != "bad" . error diff --git a/unit-tests/varmod-loop-delete.exp b/unit-tests/varmod-loop-delete.exp index 47a2f74545a3..5c508a7a6420 100644 --- a/unit-tests/varmod-loop-delete.exp +++ b/unit-tests/varmod-loop-delete.exp @@ -1,4 +1,4 @@ -make: "varmod-loop-delete.mk" line 20: Cannot delete variable "VAR" while it is used +make: "varmod-loop-delete.mk" line 20: while evaluating variable "VAR": while evaluating "${:U:@VAR@@} rest of the value": Cannot delete variable "VAR" while it is used make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/unit-tests/varmod-loop-delete.mk b/unit-tests/varmod-loop-delete.mk index 1ec6d361949d..cf0611991194 100644 --- a/unit-tests/varmod-loop-delete.mk +++ b/unit-tests/varmod-loop-delete.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-loop-delete.mk,v 1.3 2023/06/01 20:56:35 rillig Exp $ +# $NetBSD: varmod-loop-delete.mk,v 1.4 2024/04/20 10:18:55 rillig Exp $ # # Tests for the variable modifier ':@', which as a side effect allows to # delete an arbitrary variable. @@ -16,7 +16,7 @@ VAR= ${:U:@VAR@@} rest of the value # In an assignment, the scope is 'Global'. Since the variable 'VAR' is # defined in the global scope, it deletes itself. -# expect+1: Cannot delete variable "VAR" while it is used +# expect+1: while evaluating variable "VAR": while evaluating "${:U:@VAR@@} rest of the value": Cannot delete variable "VAR" while it is used EVAL:= ${VAR} .if ${EVAL} != " rest of the value" . error diff --git a/unit-tests/varmod-loop-varname.exp b/unit-tests/varmod-loop-varname.exp index 2060b51c31df..cefd82093e29 100644 --- a/unit-tests/varmod-loop-varname.exp +++ b/unit-tests/varmod-loop-varname.exp @@ -1,10 +1,10 @@ -make: "varmod-loop-varname.mk" line 18: In the :@ modifier of "", the variable name "${:Ubar:S,b,v,}" must not contain a dollar +make: "varmod-loop-varname.mk" line 18: while evaluating "${:Uone two three:@${:Ubar:S,b,v,}@+${var}+@} != "+one+ +two+ +three+"": In the :@ modifier, the variable name "${:Ubar:S,b,v,}" must not contain a dollar make: "varmod-loop-varname.mk" line 18: Malformed conditional (${:Uone two three:@${:Ubar:S,b,v,}@+${var}+@} != "+one+ +two+ +three+") -make: "varmod-loop-varname.mk" line 89: In the :@ modifier of "1 2 3", the variable name "v$" must not contain a dollar +make: "varmod-loop-varname.mk" line 89: while evaluating variable "1 2 3": In the :@ modifier, the variable name "v$" must not contain a dollar make: "varmod-loop-varname.mk" line 89: Malformed conditional (${1 2 3:L:@v$@($v)@} != "(1) (2) (3)") -make: "varmod-loop-varname.mk" line 96: In the :@ modifier of "1 2 3", the variable name "v$$" must not contain a dollar +make: "varmod-loop-varname.mk" line 96: while evaluating variable "1 2 3": In the :@ modifier, the variable name "v$$" must not contain a dollar make: "varmod-loop-varname.mk" line 96: Malformed conditional (${1 2 3:L:@v$$@($v)@} != "() () ()") -make: "varmod-loop-varname.mk" line 103: In the :@ modifier of "1 2 3", the variable name "v$$$" must not contain a dollar +make: "varmod-loop-varname.mk" line 103: while evaluating variable "1 2 3": In the :@ modifier, the variable name "v$$$" must not contain a dollar make: "varmod-loop-varname.mk" line 103: Malformed conditional (${1 2 3:L:@v$$$@($v)@} != "() () ()") make: Fatal errors encountered -- cannot continue make: stopped in unit-tests diff --git a/unit-tests/varmod-loop-varname.mk b/unit-tests/varmod-loop-varname.mk index 6f7436f277da..7abf8610911a 100644 --- a/unit-tests/varmod-loop-varname.mk +++ b/unit-tests/varmod-loop-varname.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-loop-varname.mk,v 1.6 2023/11/19 21:47:52 rillig Exp $ +# $NetBSD: varmod-loop-varname.mk,v 1.7 2024/04/20 10:18:55 rillig Exp $ # # Tests for the first part of the variable modifier ':@var@...@', which # contains the variable name to use during the loop. @@ -13,7 +13,7 @@ # dynamically. There was no practical use-case for this. # Since var.c 1.907 from 2021-04-04, a '$' is no longer allowed in the # variable name. -# expect+2: In the :@ modifier of "", the variable name "${:Ubar:S,b,v,}" must not contain a dollar +# expect+2: while evaluating "${:Uone two three:@${:Ubar:S,b,v,}@+${var}+@} != "+one+ +two+ +three+"": In the :@ modifier, the variable name "${:Ubar:S,b,v,}" must not contain a dollar # expect+1: Malformed conditional (${:Uone two three:@${:Ubar:S,b,v,}@+${var}+@} != "+one+ +two+ +three+") .if ${:Uone two three:@${:Ubar:S,b,v,}@+${var}+@} != "+one+ +two+ +three+" . error @@ -84,21 +84,21 @@ RES3= 3 # There's no point in allowing a dollar sign in that position. # Since var.c 1.907 from 2021-04-04, a '$' is no longer allowed in the # variable name. -# expect+2: In the :@ modifier of "1 2 3", the variable name "v$" must not contain a dollar +# expect+2: while evaluating variable "1 2 3": In the :@ modifier, the variable name "v$" must not contain a dollar # expect+1: Malformed conditional (${1 2 3:L:@v$@($v)@} != "(1) (2) (3)") .if ${1 2 3:L:@v$@($v)@} != "(1) (2) (3)" . error .else . error .endif -# expect+2: In the :@ modifier of "1 2 3", the variable name "v$$" must not contain a dollar +# expect+2: while evaluating variable "1 2 3": In the :@ modifier, the variable name "v$$" must not contain a dollar # expect+1: Malformed conditional (${1 2 3:L:@v$$@($v)@} != "() () ()") .if ${1 2 3:L:@v$$@($v)@} != "() () ()" . error .else . error .endif -# expect+2: In the :@ modifier of "1 2 3", the variable name "v$$$" must not contain a dollar +# expect+2: while evaluating variable "1 2 3": In the :@ modifier, the variable name "v$$$" must not contain a dollar # expect+1: Malformed conditional (${1 2 3:L:@v$$$@($v)@} != "() () ()") .if ${1 2 3:L:@v$$$@($v)@} != "() () ()" . error diff --git a/unit-tests/varmod-loop.exp b/unit-tests/varmod-loop.exp index 356946f63a9b..6aef3fe86857 100644 --- a/unit-tests/varmod-loop.exp +++ b/unit-tests/varmod-loop.exp @@ -1,7 +1,9 @@ Parsing line 91: USE_8_DOLLARS= ${:U1:@var@${8_DOLLARS}@} ${8_DOLLARS} $$$$$$$$ +Parsing line 92: .if ${USE_8_DOLLARS} != "\$\$\$\$ \$\$\$\$ \$\$\$\$" CondParser_Eval: ${USE_8_DOLLARS} != "\$\$\$\$ \$\$\$\$ \$\$\$\$" Comparing "$$$$ $$$$ $$$$" != "$$$$ $$$$ $$$$" Parsing line 96: SUBST_CONTAINING_LOOP:= ${USE_8_DOLLARS} +Parsing line 118: .if ${SUBST_CONTAINING_LOOP} != "\$\$ \$\$\$\$ \$\$\$\$" CondParser_Eval: ${SUBST_CONTAINING_LOOP} != "\$\$ \$\$\$\$ \$\$\$\$" Comparing "$$ $$$$ $$$$" != "$$ $$$$ $$$$" Parsing line 121: .MAKEFLAGS: -d0 diff --git a/unit-tests/varmod-match-escape.exp b/unit-tests/varmod-match-escape.exp index 9a8f9ccf6082..d6bd804a7e89 100755 --- a/unit-tests/varmod-match-escape.exp +++ b/unit-tests/varmod-match-escape.exp @@ -33,9 +33,9 @@ Comparing ":" != "::" make: "varmod-match-escape.mk" line 43: warning: XXX: Oops Global: .MAKEFLAGS = -r -k -d cv -d Global: .MAKEFLAGS = -r -k -d cv -d 0 -make: "varmod-match-escape.mk" line 69: Dollar followed by nothing -make: "varmod-match-escape.mk" line 110: warning: Unfinished character list in pattern '[A-]' of modifier ':M' -make: "varmod-match-escape.mk" line 110: warning: Unfinished character list in pattern '[^A-]' of modifier ':M' +make: "varmod-match-escape.mk" line 69: while evaluating "${:U\$:M\$} != """: Dollar followed by nothing +make: "varmod-match-escape.mk" line 110: while evaluating variable "WORDS": warning: Unfinished character list in pattern '[A-]' of modifier ':M' +make: "varmod-match-escape.mk" line 110: while evaluating variable "WORDS": warning: Unfinished character list in pattern '[^A-]' of modifier ':M' make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/unit-tests/varmod-match-escape.mk b/unit-tests/varmod-match-escape.mk index 1da3918fe1a5..d39ece1cba2c 100755 --- a/unit-tests/varmod-match-escape.mk +++ b/unit-tests/varmod-match-escape.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-match-escape.mk,v 1.12 2023/11/19 21:47:52 rillig Exp $ +# $NetBSD: varmod-match-escape.mk,v 1.13 2024/04/20 10:18:55 rillig Exp $ # # As of 2020-08-01, the :M and :N modifiers interpret backslashes differently, # depending on whether there was an expression somewhere before the @@ -65,7 +65,7 @@ VALUES= : :: :\: # In lint mode, the case of a lonely '$' is covered with an error message. .MAKEFLAGS: -dL -# expect+1: Dollar followed by nothing +# expect+1: while evaluating "${:U\$:M\$} != """: Dollar followed by nothing .if ${:U\$:M\$} != "" . error .endif @@ -105,8 +105,8 @@ EXP.[^A-]]= a EXP.[^A-]]]= a] .for pattern in [A-] [A-]] [A-]]] [^A-] [^A-]] [^A-]]] -# expect+2: warning: Unfinished character list in pattern '[A-]' of modifier ':M' -# expect+1: warning: Unfinished character list in pattern '[^A-]' of modifier ':M' +# expect+2: while evaluating variable "WORDS": warning: Unfinished character list in pattern '[A-]' of modifier ':M' +# expect+1: while evaluating variable "WORDS": warning: Unfinished character list in pattern '[^A-]' of modifier ':M' . if ${WORDS:M${pattern}} != ${EXP.${pattern}} . warning ${pattern}: ${WORDS:M${pattern}} != ${EXP.${pattern}} . endif diff --git a/unit-tests/varmod-match.exp b/unit-tests/varmod-match.exp index e4e0783a7b15..3425eae2d421 100644 --- a/unit-tests/varmod-match.exp +++ b/unit-tests/varmod-match.exp @@ -1,14 +1,14 @@ -make: "varmod-match.mk" line 289: warning: Unfinished character list in pattern 'a[' of modifier ':M' -make: "varmod-match.mk" line 297: warning: Unfinished character list in pattern 'a[^' of modifier ':M' -make: "varmod-match.mk" line 305: warning: Unfinished character list in pattern '[-x1-3' of modifier ':M' -make: "varmod-match.mk" line 313: warning: Unfinished character list in pattern '*[-x1-3' of modifier ':M' -make: "varmod-match.mk" line 322: warning: Unfinished character list in pattern '[^-x1-3' of modifier ':M' -make: "varmod-match.mk" line 336: warning: Unfinished character list in pattern '?[\' of modifier ':M' -make: "varmod-match.mk" line 344: warning: Unfinished character range in pattern '[x-' of modifier ':M' -make: "varmod-match.mk" line 356: warning: Unfinished character range in pattern '[^x-' of modifier ':M' -make: "varmod-match.mk" line 364: warning: Unfinished character list in pattern '[' of modifier ':M' -make: "varmod-match.mk" line 364: Unknown modifier "]" -make: "varmod-match.mk" line 364: Malformed conditional (${ ${:U\:} ${:U\:\:} :L:M[:]} != ":") +make: "varmod-match.mk" line 290: while evaluating variable "WORDS": warning: Unfinished character list in pattern 'a[' of modifier ':M' +make: "varmod-match.mk" line 298: while evaluating variable "WORDS": warning: Unfinished character list in pattern 'a[^' of modifier ':M' +make: "varmod-match.mk" line 306: while evaluating variable "WORDS": warning: Unfinished character list in pattern '[-x1-3' of modifier ':M' +make: "varmod-match.mk" line 314: while evaluating variable "WORDS": warning: Unfinished character list in pattern '*[-x1-3' of modifier ':M' +make: "varmod-match.mk" line 323: while evaluating variable "WORDS": warning: Unfinished character list in pattern '[^-x1-3' of modifier ':M' +make: "varmod-match.mk" line 337: while evaluating variable "WORDS": warning: Unfinished character list in pattern '?[\' of modifier ':M' +make: "varmod-match.mk" line 345: while evaluating variable "WORDS": warning: Unfinished character range in pattern '[x-' of modifier ':M' +make: "varmod-match.mk" line 357: while evaluating variable "WORDS": warning: Unfinished character range in pattern '[^x-' of modifier ':M' +make: "varmod-match.mk" line 365: while evaluating variable " : :: ": warning: Unfinished character list in pattern '[' of modifier ':M' +make: "varmod-match.mk" line 365: while evaluating variable " : :: ": Unknown modifier "]" +make: "varmod-match.mk" line 365: Malformed conditional (${ ${:U\:} ${:U\:\:} :L:M[:]} != ":") make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/unit-tests/varmod-match.mk b/unit-tests/varmod-match.mk index d93d1839192d..e91ddc7ce04b 100644 --- a/unit-tests/varmod-match.mk +++ b/unit-tests/varmod-match.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-match.mk,v 1.20 2023/12/17 23:19:02 rillig Exp $ +# $NetBSD: varmod-match.mk,v 1.22 2024/04/23 22:51:28 rillig Exp $ # # Tests for the ':M' modifier, which keeps only those words that match the # given pattern. @@ -33,22 +33,22 @@ # The pattern character '?' matches exactly 1 character, the pattern character # '*' matches 0 or more characters. The whole pattern matches all words that # start with 's' and have 3 or more characters. -.if ${One Two Three Four five six seven:L:Ms??*} != "six seven" +.if ${One Two Three Four five six seven so s:L:Ms??*} != "six seven" . error .endif -# Ensure that a pattern without placeholders only matches itself. +# A pattern without placeholders only matches itself. .if ${a aa aaa b ba baa bab:L:Ma} != "a" . error .endif -# Ensure that a pattern that ends with '*' is properly anchored at the +# A pattern that ends with '*' is anchored at the # beginning. .if ${a aa aaa b ba baa bab:L:Ma*} != "a aa aaa" . error .endif -# Ensure that a pattern that starts with '*' is properly anchored at the end. +# A pattern that starts with '*' is anchored at the end. .if ${a aa aaa b ba baa bab:L:M*a} != "a aa aaa ba baa" . error .endif @@ -257,8 +257,9 @@ ${:U*}= asterisk . error .endif -# Without the modifier ':tW', the string is split into words. All whitespace -# around and between the words is normalized to a single space. +# Without the modifier ':tW', the string is split into words. Whitespace +# around the words is discarded, and whitespace between the words is +# normalized to a single space. .if ${ plain string :L:M*} != "plain string" . error .endif @@ -285,7 +286,7 @@ ${:U*}= asterisk # [ Incomplete empty character list, never matches. WORDS= a a[ -# expect+1: warning: Unfinished character list in pattern 'a[' of modifier ':M' +# expect+1: while evaluating variable "WORDS": warning: Unfinished character list in pattern 'a[' of modifier ':M' .if ${WORDS:Ma[} != "" . error .endif @@ -293,7 +294,7 @@ WORDS= a a[ # [^ Incomplete negated empty character list, matches any single # character. WORDS= a a[ aX -# expect+1: warning: Unfinished character list in pattern 'a[^' of modifier ':M' +# expect+1: while evaluating variable "WORDS": warning: Unfinished character list in pattern 'a[^' of modifier ':M' .if ${WORDS:Ma[^} != "a[ aX" . error .endif @@ -301,7 +302,7 @@ WORDS= a a[ aX # [-x1-3 Incomplete character list, matches those elements that can be # parsed without lookahead. WORDS= - + x xx 0 1 2 3 4 [x1-3 -# expect+1: warning: Unfinished character list in pattern '[-x1-3' of modifier ':M' +# expect+1: while evaluating variable "WORDS": warning: Unfinished character list in pattern '[-x1-3' of modifier ':M' .if ${WORDS:M[-x1-3} != "- x 1 2 3" . error .endif @@ -309,7 +310,7 @@ WORDS= - + x xx 0 1 2 3 4 [x1-3 # *[-x1-3 Incomplete character list after a wildcard, matches those # words that end with one of the characters from the list. WORDS= - + x xx 0 1 2 3 4 00 01 10 11 000 001 010 011 100 101 110 111 [x1-3 -# expect+1: warning: Unfinished character list in pattern '*[-x1-3' of modifier ':M' +# expect+1: while evaluating variable "WORDS": warning: Unfinished character list in pattern '*[-x1-3' of modifier ':M' .if ${WORDS:M*[-x1-3} != "- x xx 1 2 3 01 11 001 011 101 111 [x1-3" . warning ${WORDS:M*[-x1-3} .endif @@ -318,7 +319,7 @@ WORDS= - + x xx 0 1 2 3 4 00 01 10 11 000 001 010 011 100 101 110 111 [x1-3 # Incomplete negated character list, matches any character # except those elements that can be parsed without lookahead. WORDS= - + x xx 0 1 2 3 4 [x1-3 -# expect+1: warning: Unfinished character list in pattern '[^-x1-3' of modifier ':M' +# expect+1: while evaluating variable "WORDS": warning: Unfinished character list in pattern '[^-x1-3' of modifier ':M' .if ${WORDS:M[^-x1-3} != "+ 0 4" . error .endif @@ -332,7 +333,7 @@ WORDS= - + x xx 0 1 2 3 4 [x1-3 # '\', as there is no following space that could be escaped. WORDS= \\ \a ${:Ux\\} PATTERN= ${:U?[\\} -# expect+1: warning: Unfinished character list in pattern '?[\' of modifier ':M' +# expect+1: while evaluating variable "WORDS": warning: Unfinished character list in pattern '?[\' of modifier ':M' .if ${WORDS:M${PATTERN}} != "\\\\ x\\" . error .endif @@ -340,7 +341,7 @@ PATTERN= ${:U?[\\} # [x- Incomplete character list containing an incomplete character # range, matches only the 'x'. WORDS= [x- x x- y -# expect+1: warning: Unfinished character range in pattern '[x-' of modifier ':M' +# expect+1: while evaluating variable "WORDS": warning: Unfinished character range in pattern '[x-' of modifier ':M' .if ${WORDS:M[x-} != "x" . error .endif @@ -352,14 +353,14 @@ WORDS= [x- x x- y # XXX: Even matches strings that are longer than a single # character. WORDS= [x- x x- y yyyyy -# expect+1: warning: Unfinished character range in pattern '[^x-' of modifier ':M' +# expect+1: while evaluating variable "WORDS": warning: Unfinished character range in pattern '[^x-' of modifier ':M' .if ${WORDS:M[^x-} != "[x- y yyyyy" . error .endif # [:] matches never since the ':' starts the next modifier -# expect+3: warning: Unfinished character list in pattern '[' of modifier ':M' -# expect+2: Unknown modifier "]" +# expect+3: while evaluating variable " : :: ": warning: Unfinished character list in pattern '[' of modifier ':M' +# expect+2: while evaluating variable " : :: ": Unknown modifier "]" # expect+1: Malformed conditional (${ ${:U\:} ${:U\:\:} :L:M[:]} != ":") .if ${ ${:U\:} ${:U\:\:} :L:M[:]} != ":" . error @@ -372,9 +373,16 @@ WORDS= [x- x x- y yyyyy # Before var.c 1.1031 from 2022-08-24, the following expressions caused an # out-of-bounds read beyond the indirect ':M' modifiers. -.if ${:U:${:UM\\}} # The ':M' pattern need not be unescaped, the -. error # resulting pattern is '\', it never matches -.endif # anything. -.if ${:U:${:UM\\\:\\}} # The ':M' pattern must be unescaped, the -. error # resulting pattern is ':\', it never matches -.endif # anything. +# +# The argument to the inner ':U' is unescaped to 'M\'. +# This 'M\' becomes an # indirect modifier ':M' with the pattern '\'. +# The pattern '\' never matches. +.if ${:U:${:UM\\}} +. error +.endif +# The argument to the inner ':U' is unescaped to 'M\:\'. +# This 'M\:\' becomes an indirect modifier ':M' with the pattern ':\'. +# The pattern ':\' never matches. +.if ${:U:${:UM\\\:\\}} +. error +.endif diff --git a/unit-tests/varmod-mtime.exp b/unit-tests/varmod-mtime.exp index 039173feddc3..87f405573437 100644 --- a/unit-tests/varmod-mtime.exp +++ b/unit-tests/varmod-mtime.exp @@ -1,13 +1,13 @@ -make: "varmod-mtime.mk" line 47: Invalid argument '123x' for modifier ':mtime' +make: "varmod-mtime.mk" line 47: while evaluating variable "no/such/file": Invalid argument '123x' for modifier ':mtime' make: "varmod-mtime.mk" line 47: Malformed conditional (${no/such/file:L:mtime=123x}) -make: "varmod-mtime.mk" line 70: Cannot determine mtime for 'no/such/file1': <ENOENT> -make: "varmod-mtime.mk" line 70: Cannot determine mtime for 'no/such/file2': <ENOENT> +make: "varmod-mtime.mk" line 70: while evaluating variable "no/such/file1 no/such/file2": Cannot determine mtime for 'no/such/file1': <ENOENT> +make: "varmod-mtime.mk" line 70: while evaluating variable "no/such/file1 no/such/file2": Cannot determine mtime for 'no/such/file2': <ENOENT> make: "varmod-mtime.mk" line 70: Malformed conditional (${no/such/file1 no/such/file2:L:mtime=error}) -make: "varmod-mtime.mk" line 81: Invalid argument 'errorhandler-no' for modifier ':mtime' +make: "varmod-mtime.mk" line 81: while evaluating variable "MAKEFILE": Invalid argument 'errorhandler-no' for modifier ':mtime' make: "varmod-mtime.mk" line 81: Malformed conditional (${MAKEFILE:mtime=errorhandler-no} > 0) -make: "varmod-mtime.mk" line 90: Invalid argument 'warn' for modifier ':mtime' +make: "varmod-mtime.mk" line 90: while evaluating variable "MAKEFILE": Invalid argument 'warn' for modifier ':mtime' make: "varmod-mtime.mk" line 90: Malformed conditional (${MAKEFILE:mtime=warn} > 0) -make: "varmod-mtime.mk" line 115: Unknown modifier "mtim" +make: "varmod-mtime.mk" line 115: while evaluating variable "anything": Unknown modifier "mtim" make: "varmod-mtime.mk" line 115: Malformed conditional (${anything:L:mtim}) make: Fatal errors encountered -- cannot continue make: stopped in unit-tests diff --git a/unit-tests/varmod-mtime.mk b/unit-tests/varmod-mtime.mk index 298756e152c1..189bb8cadc9a 100644 --- a/unit-tests/varmod-mtime.mk +++ b/unit-tests/varmod-mtime.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-mtime.mk,v 1.9 2023/12/17 14:07:22 rillig Exp $ +# $NetBSD: varmod-mtime.mk,v 1.10 2024/04/20 10:18:55 rillig Exp $ # # Tests for the ':mtime' variable modifier, which maps each word of the # expression to that file's modification time. @@ -42,7 +42,7 @@ not_found_mtime:= ${no/such/file:L:mtime} # The fallback timestamp must only be an integer, without trailing characters. -# expect+2: Invalid argument '123x' for modifier ':mtime' +# expect+2: while evaluating variable "no/such/file": Invalid argument '123x' for modifier ':mtime' # expect+1: Malformed conditional (${no/such/file:L:mtime=123x}) .if ${no/such/file:L:mtime=123x} . error @@ -64,8 +64,8 @@ _!= rm -f ${COOKIE} # If the optional argument of the ':mtime' modifier is the word 'error', the # modifier fails with an error message, once for each affected file. # -# expect+3: Cannot determine mtime for 'no/such/file1': <ENOENT> -# expect+2: Cannot determine mtime for 'no/such/file2': <ENOENT> +# expect+3: while evaluating variable "no/such/file1 no/such/file2": Cannot determine mtime for 'no/such/file1': <ENOENT> +# expect+2: while evaluating variable "no/such/file1 no/such/file2": Cannot determine mtime for 'no/such/file2': <ENOENT> # expect+1: Malformed conditional (${no/such/file1 no/such/file2:L:mtime=error}) .if ${no/such/file1 no/such/file2:L:mtime=error} . error @@ -76,7 +76,7 @@ _!= rm -f ${COOKIE} # Only the word 'error' is a special argument to the ':mtime' modifier, all # other words result in a parse error. -# expect+2: Invalid argument 'errorhandler-no' for modifier ':mtime' +# expect+2: while evaluating variable "MAKEFILE": Invalid argument 'errorhandler-no' for modifier ':mtime' # expect+1: Malformed conditional (${MAKEFILE:mtime=errorhandler-no} > 0) .if ${MAKEFILE:mtime=errorhandler-no} > 0 .else @@ -85,7 +85,7 @@ _!= rm -f ${COOKIE} # Only the word 'error' can be used as a fallback argument to the modifier. -# expect+2: Invalid argument 'warn' for modifier ':mtime' +# expect+2: while evaluating variable "MAKEFILE": Invalid argument 'warn' for modifier ':mtime' # expect+1: Malformed conditional (${MAKEFILE:mtime=warn} > 0) .if ${MAKEFILE:mtime=warn} > 0 . error @@ -110,7 +110,7 @@ end:= ${%s:L:gmtime} # If there is a typo in the modifier name, it does not match. -# expect+2: Unknown modifier "mtim" +# expect+2: while evaluating variable "anything": Unknown modifier "mtim" # expect+1: Malformed conditional (${anything:L:mtim}) .if ${anything:L:mtim} . error diff --git a/unit-tests/varmod-range.exp b/unit-tests/varmod-range.exp index 9b0dad40a78e..d9848c2ef4f6 100644 --- a/unit-tests/varmod-range.exp +++ b/unit-tests/varmod-range.exp @@ -1,13 +1,13 @@ make: "varmod-range.mk" line 43: Malformed conditional (${:range=5} != "") -make: "varmod-range.mk" line 67: Invalid number "x}Rest" != "Rest"" for ':range' modifier +make: "varmod-range.mk" line 67: while evaluating "${:U:range=x}Rest" != "Rest"": Invalid number "x}Rest" != "Rest"" for ':range' modifier make: "varmod-range.mk" line 67: Malformed conditional ("${:U:range=x}Rest" != "Rest") -make: "varmod-range.mk" line 78: Unknown modifier "x0" +make: "varmod-range.mk" line 78: while evaluating "${:U:range=0x0}Rest" != "Rest"": Unknown modifier "x0" make: "varmod-range.mk" line 78: Malformed conditional ("${:U:range=0x0}Rest" != "Rest") -make: "varmod-range.mk" line 96: Unknown modifier "rang" +make: "varmod-range.mk" line 96: while evaluating variable "a b c": Unknown modifier "rang" make: "varmod-range.mk" line 96: Malformed conditional ("${a b c:L:rang}Rest" != "Rest") -make: "varmod-range.mk" line 105: Unknown modifier "rango" +make: "varmod-range.mk" line 105: while evaluating variable "a b c": Unknown modifier "rango" make: "varmod-range.mk" line 105: Malformed conditional ("${a b c:L:rango}Rest" != "Rest") -make: "varmod-range.mk" line 114: Unknown modifier "ranger" +make: "varmod-range.mk" line 114: while evaluating variable "a b c": Unknown modifier "ranger" make: "varmod-range.mk" line 114: Malformed conditional ("${a b c:L:ranger}Rest" != "Rest") make: Fatal errors encountered -- cannot continue make: stopped in unit-tests diff --git a/unit-tests/varmod-range.mk b/unit-tests/varmod-range.mk index 920001096054..2915100bfb79 100644 --- a/unit-tests/varmod-range.mk +++ b/unit-tests/varmod-range.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-range.mk,v 1.10 2023/12/17 14:07:22 rillig Exp $ +# $NetBSD: varmod-range.mk,v 1.11 2024/04/20 10:18:55 rillig Exp $ # # Tests for the :range variable modifier, which generates sequences # of integers from the given range. @@ -62,7 +62,7 @@ # # Since 2020-11-01, the parser issues a more precise "Invalid number" error # instead. -# expect+2: Invalid number "x}Rest" != "Rest"" for ':range' modifier +# expect+2: while evaluating "${:U:range=x}Rest" != "Rest"": Invalid number "x}Rest" != "Rest"" for ':range' modifier # expect+1: Malformed conditional ("${:U:range=x}Rest" != "Rest") .if "${:U:range=x}Rest" != "Rest" . error @@ -73,7 +73,7 @@ # The upper limit of the range must always be given in decimal. # This parse error stops at the 'x', trying to parse it as a variable # modifier. -# expect+2: Unknown modifier "x0" +# expect+2: while evaluating "${:U:range=0x0}Rest" != "Rest"": Unknown modifier "x0" # expect+1: Malformed conditional ("${:U:range=0x0}Rest" != "Rest") .if "${:U:range=0x0}Rest" != "Rest" . error @@ -91,7 +91,7 @@ #.endif # modifier name too short -# expect+2: Unknown modifier "rang" +# expect+2: while evaluating variable "a b c": Unknown modifier "rang" # expect+1: Malformed conditional ("${a b c:L:rang}Rest" != "Rest") .if "${a b c:L:rang}Rest" != "Rest" . error @@ -100,7 +100,7 @@ .endif # misspelled modifier name -# expect+2: Unknown modifier "rango" +# expect+2: while evaluating variable "a b c": Unknown modifier "rango" # expect+1: Malformed conditional ("${a b c:L:rango}Rest" != "Rest") .if "${a b c:L:rango}Rest" != "Rest" . error @@ -109,7 +109,7 @@ .endif # modifier name too long -# expect+2: Unknown modifier "ranger" +# expect+2: while evaluating variable "a b c": Unknown modifier "ranger" # expect+1: Malformed conditional ("${a b c:L:ranger}Rest" != "Rest") .if "${a b c:L:ranger}Rest" != "Rest" . error diff --git a/unit-tests/varmod-subst-regex.exp b/unit-tests/varmod-subst-regex.exp index a09046ef764c..25626ba18508 100644 --- a/unit-tests/varmod-subst-regex.exp +++ b/unit-tests/varmod-subst-regex.exp @@ -20,7 +20,7 @@ mod-regex-limits:22-ok:1 33 556 mod-regex-limits:capture:ihgfedcbaabcdefghijABCDEFGHIJa0a1a2rest make: Regex compilation error: (details omitted) mod-regex-errors: -make: Unknown modifier "Z" +make: in target "mod-regex-errors": while evaluating variable "word": while evaluating "${:U:Z}y,W}": Unknown modifier "Z" mod-regex-errors: xy unmatched-subexpression.ok: one one 2 3 5 8 one3 2one 34 make: No match for subexpression \2 diff --git a/unit-tests/varmod-subst.exp b/unit-tests/varmod-subst.exp index 97fa2e4f1491..9d88b3d6fa6f 100644 --- a/unit-tests/varmod-subst.exp +++ b/unit-tests/varmod-subst.exp @@ -45,7 +45,7 @@ mod-subst-delimiter: 1 two 3 tilde mod-subst-chain: A B c. -make: Unknown modifier "i" +make: in target "mod-subst-chain": while evaluating "${:Uvalue:S,a,x,i}.": Unknown modifier "i" . mod-subst-dollar:$1: mod-subst-dollar:$2: diff --git a/unit-tests/varmod-to-separator.exp b/unit-tests/varmod-to-separator.exp index a7d4ddb20147..6bdd6f0c2d43 100644 --- a/unit-tests/varmod-to-separator.exp +++ b/unit-tests/varmod-to-separator.exp @@ -1,6 +1,6 @@ -make: "varmod-to-separator.mk" line 155: Invalid character number at "400:tu}" +make: "varmod-to-separator.mk" line 155: while evaluating variable "WORDS": Invalid character number at "400:tu}" make: "varmod-to-separator.mk" line 155: Malformed conditional (${WORDS:[1..3]:ts\400:tu}) -make: "varmod-to-separator.mk" line 171: Invalid character number at "100:tu}" +make: "varmod-to-separator.mk" line 171: while evaluating variable "WORDS": Invalid character number at "100:tu}" make: "varmod-to-separator.mk" line 171: Malformed conditional (${WORDS:[1..3]:ts\x100:tu}) make: Bad modifier ":ts\-300" for variable "WORDS" make: "varmod-to-separator.mk" line 179: Malformed conditional (${WORDS:[1..3]:ts\-300:tu}) @@ -18,7 +18,7 @@ make: Bad modifier ":t\X" for variable "WORDS" make: "varmod-to-separator.mk" line 232: Malformed conditional (${WORDS:t\X} != "anything") make: Bad modifier ":ts\69" for variable "" make: "varmod-to-separator.mk" line 249: Malformed conditional (${:Ua b:ts\69}) -make: "varmod-to-separator.mk" line 258: Invalid character number at "1F60E}" +make: "varmod-to-separator.mk" line 258: while evaluating "${:Ua b:ts\x1F60E}": Invalid character number at "1F60E}" make: "varmod-to-separator.mk" line 258: Malformed conditional (${:Ua b:ts\x1F60E}) make: Fatal errors encountered -- cannot continue make: stopped in unit-tests diff --git a/unit-tests/varmod-to-separator.mk b/unit-tests/varmod-to-separator.mk index 57a7bd84ec44..8b8aeb4d3c33 100644 --- a/unit-tests/varmod-to-separator.mk +++ b/unit-tests/varmod-to-separator.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-to-separator.mk,v 1.13 2023/11/19 21:47:52 rillig Exp $ +# $NetBSD: varmod-to-separator.mk,v 1.14 2024/04/20 10:18:55 rillig Exp $ # # Tests for the :ts variable modifier, which joins the words of the variable # using an arbitrary character as word separator. @@ -150,7 +150,7 @@ WORDS= one two three four five six # for an unsigned character though. # # Since 2020-11-01, these out-of-bounds values are rejected. -# expect+2: Invalid character number at "400:tu}" +# expect+2: while evaluating variable "WORDS": Invalid character number at "400:tu}" # expect+1: Malformed conditional (${WORDS:[1..3]:ts\400:tu}) .if ${WORDS:[1..3]:ts\400:tu} . warning The separator \400 is accepted even though it is out of bounds. @@ -166,7 +166,7 @@ WORDS= one two three four five six # The hexadecimal number must be in the range of an unsigned char. # # Since 2020-11-01, these out-of-bounds values are rejected. -# expect+2: Invalid character number at "100:tu}" +# expect+2: while evaluating variable "WORDS": Invalid character number at "100:tu}" # expect+1: Malformed conditional (${WORDS:[1..3]:ts\x100:tu}) .if ${WORDS:[1..3]:ts\x100:tu} . warning The separator \x100 is accepted even though it is out of bounds. @@ -253,7 +253,7 @@ WORDS= one two three four five six .endif # Try whether bmake is Unicode-ready. -# expect+2: Invalid character number at "1F60E}" +# expect+2: while evaluating "${:Ua b:ts\x1F60E}": Invalid character number at "1F60E}" # expect+1: Malformed conditional (${:Ua b:ts\x1F60E}) .if ${:Ua b:ts\x1F60E} # U+1F60E "smiling face with sunglasses" . error diff --git a/unit-tests/varmod.exp b/unit-tests/varmod.exp index 9ba0cb1d278b..22a7019dfc1a 100644 --- a/unit-tests/varmod.exp +++ b/unit-tests/varmod.exp @@ -1,7 +1,7 @@ make: "varmod.mk" line 101: To escape a dollar, use \$, not $$, at "$$:L} != """ make: "varmod.mk" line 101: Invalid variable name ':', at "$:L} != """ -make: "varmod.mk" line 107: Dollar followed by nothing -make: "varmod.mk" line 117: Missing delimiter ':' after modifier "P" +make: "varmod.mk" line 107: while evaluating "${:Uword:@word@${word}$@} != "word"": Dollar followed by nothing +make: "varmod.mk" line 117: while evaluating variable "VAR": Missing delimiter ':' after modifier "P" make: "varmod.mk" line 119: Missing argument for ".error" make: Fatal errors encountered -- cannot continue make: stopped in unit-tests diff --git a/unit-tests/varmod.mk b/unit-tests/varmod.mk index 45707ab9b886..c749dfb9659d 100644 --- a/unit-tests/varmod.mk +++ b/unit-tests/varmod.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod.mk,v 1.10 2024/02/03 00:20:23 sjg Exp $ +# $NetBSD: varmod.mk,v 1.11 2024/04/20 10:18:56 rillig Exp $ # # Tests for variable modifiers, such as :Q, :S,from,to or :Ufallback. # @@ -103,7 +103,7 @@ DOLLAR2= ${:U\$} .endif # A '$' followed by nothing is an error as well. -# expect+1: Dollar followed by nothing +# expect+1: while evaluating "${:Uword:@word@${word}$@} != "word"": Dollar followed by nothing .if ${:Uword:@word@${word}$@} != "word" . error .endif @@ -113,7 +113,7 @@ DOLLAR2= ${:U\$} # XXX: The .error should not be reached since the expression is # malformed, and this error should be propagated up to Cond_EvalLine. VAR= STOP -# expect+1: Missing delimiter ':' after modifier "P" +# expect+1: while evaluating variable "VAR": Missing delimiter ':' after modifier "P" .if ${VAR:P=RE} != "STORE" # expect+1: Missing argument for ".error" . error diff --git a/unit-tests/varname-dot-shell.exp b/unit-tests/varname-dot-shell.exp index 22c2afe218a9..7d481fdf6ff1 100755 --- a/unit-tests/varname-dot-shell.exp +++ b/unit-tests/varname-dot-shell.exp @@ -6,6 +6,7 @@ Command: .SHELL = (details omitted) Global: ORIG_SHELL = (details omitted) Parsing line 12: .SHELL= overwritten Global: ignoring '.SHELL = overwritten' due to a command line variable of the same name +Parsing line 13: .if ${.SHELL} != ${ORIG_SHELL} CondParser_Eval: ${.SHELL} != ${ORIG_SHELL} Var_Parse: ${.SHELL} != ${ORIG_SHELL} (eval-defined) Var_Parse: ${ORIG_SHELL} (eval-defined) @@ -13,6 +14,7 @@ Comparing "(details omitted)" != "(details omitted)" Parsing line 19: .MAKEFLAGS: .SHELL+=appended ParseDependency(.MAKEFLAGS: .SHELL+=appended) Command: ignoring '.SHELL += appended' as it is read-only +Parsing line 20: .if ${.SHELL} != ${ORIG_SHELL} CondParser_Eval: ${.SHELL} != ${ORIG_SHELL} Var_Parse: ${.SHELL} != ${ORIG_SHELL} (eval-defined) Var_Parse: ${ORIG_SHELL} (eval-defined) @@ -21,6 +23,7 @@ Parsing line 27: .undef .SHELL Global: ignoring delete '.SHELL' as it is not found Parsing line 28: .SHELL= newly overwritten Global: ignoring '.SHELL = newly overwritten' due to a command line variable of the same name +Parsing line 29: .if ${.SHELL} != ${ORIG_SHELL} CondParser_Eval: ${.SHELL} != ${ORIG_SHELL} Var_Parse: ${.SHELL} != ${ORIG_SHELL} (eval-defined) Var_Parse: ${ORIG_SHELL} (eval-defined) diff --git a/unit-tests/varparse-errors.exp b/unit-tests/varparse-errors.exp index 4193bea181c9..20fee23bddae 100644 --- a/unit-tests/varparse-errors.exp +++ b/unit-tests/varparse-errors.exp @@ -1,5 +1,5 @@ -make: "varparse-errors.mk" line 38: Unknown modifier "Z" -make: "varparse-errors.mk" line 47: Unknown modifier "Z" +make: "varparse-errors.mk" line 38: while evaluating "${:U:Z}": Unknown modifier "Z" +make: "varparse-errors.mk" line 47: while evaluating "${:U:Z}post": Unknown modifier "Z" make: Bad modifier ":OX" for variable "" make: "varparse-errors.mk" line 71: Undefined variable "${:U:OX" make: Bad modifier ":OX" for variable "" diff --git a/unit-tests/varparse-errors.mk b/unit-tests/varparse-errors.mk index fc94d9dd3d18..edb02ef0b957 100644 --- a/unit-tests/varparse-errors.mk +++ b/unit-tests/varparse-errors.mk @@ -1,4 +1,4 @@ -# $NetBSD: varparse-errors.mk,v 1.11 2023/11/19 22:32:44 rillig Exp $ +# $NetBSD: varparse-errors.mk,v 1.12 2024/04/20 10:18:56 rillig Exp $ # Tests for parsing and evaluating all kinds of expressions. # @@ -34,7 +34,7 @@ ERR_EVAL= An evaluation error ${:Uvalue:C,.,\3,}. # As of 2020-12-01, errors in the variable name are silently ignored. # Since var.c 1.754 from 2020-12-20, unknown modifiers at parse time result # in an error message and a non-zero exit status. -# expect+1: Unknown modifier "Z" +# expect+1: while evaluating "${:U:Z}": Unknown modifier "Z" VAR.${:U:Z}= unknown modifier in the variable name .if ${VAR.} != "unknown modifier in the variable name" . error @@ -43,7 +43,7 @@ VAR.${:U:Z}= unknown modifier in the variable name # As of 2020-12-01, errors in the variable name are silently ignored. # Since var.c 1.754 from 2020-12-20, unknown modifiers at parse time result # in an error message and a non-zero exit status. -# expect+1: Unknown modifier "Z" +# expect+1: while evaluating "${:U:Z}post": Unknown modifier "Z" VAR.${:U:Z}post= unknown modifier with text in the variable name .if ${VAR.post} != "unknown modifier with text in the variable name" . error |
