diff options
| author | rillig <rillig@NetBSD.org> | 2023-06-01 20:56:35 +0000 |
|---|---|---|
| committer | rillig <rillig@NetBSD.org> | 2023-06-01 20:56:35 +0000 |
| commit | c87a0f0af9217c77a95dfd55b2073f34ae35576d (patch) | |
| tree | bde8967dda0ad0f0f8a7782e2544990b10bfc68b /usr.bin/make | |
| parent | 804ec5ad1c5f82250c9279dcd7fb372399035a51 (diff) | |
tests/make: force line-based diagnostics to be listed in the tests
This way, contradictions between the intended output and the actual
output are closer together and have a better chance of being spotted.
Diffstat (limited to 'usr.bin/make')
174 files changed, 1089 insertions, 722 deletions
diff --git a/usr.bin/make/unit-tests/check-expect.lua b/usr.bin/make/unit-tests/check-expect.lua index 267980b70f8..87290362091 100644 --- a/usr.bin/make/unit-tests/check-expect.lua +++ b/usr.bin/make/unit-tests/check-expect.lua @@ -1,5 +1,5 @@ #! /usr/bin/lua --- $NetBSD: check-expect.lua,v 1.5 2023/06/01 07:27:30 rillig Exp $ +-- $NetBSD: check-expect.lua,v 1.6 2023/06/01 20:56:35 rillig Exp $ --[[ @@ -19,10 +19,6 @@ expected text in the corresponding .exp file. # expect[+-]offset: <message> Each message must occur in the .exp file and refer back to the source line in the .mk file. - -# expect-all - Each message from the .exp file that can be matched by an - 'expect[+-]offset' comment must actually be matched. ]] @@ -79,7 +75,6 @@ local function check_mk(mk_fname) if exp_lines == nil then return end local by_location = collect_lineno_diagnostics(exp_lines) local prev_expect_line = 0 - local match_all = false for mk_lineno, mk_line in ipairs(mk_lines) do for text in mk_line:gmatch("#%s*expect:%s*(.*)") do @@ -122,20 +117,13 @@ local function check_mk(mk_fname) mk_fname, mk_lineno, exp_fname, text) end end - - if mk_line:match("^#%s*expect%-all$") then - match_all = true - end end - if match_all then - -- XXX: The messages are not sorted in any meaningful way. - for location, messages in pairs(by_location) do - for _, message in ipairs(messages) do - if message ~= "" then - print_error("error: %s: missing 'expect' comment for '%s'", - location, message) - end + -- XXX: The messages are not sorted in any meaningful way. + for location, messages in pairs(by_location) do + for _, message in ipairs(messages) do + if message ~= "" and location:find(".mk:") then + print_error("missing: %s: # expect+1: %s", location, message) end end end diff --git a/usr.bin/make/unit-tests/cmdline-undefined.exp b/usr.bin/make/unit-tests/cmdline-undefined.exp index 977ceee6dbf..197f6da6013 100644 --- a/usr.bin/make/unit-tests/cmdline-undefined.exp +++ b/usr.bin/make/unit-tests/cmdline-undefined.exp @@ -1,17 +1,17 @@ The = assignment operator -make: "cmdline-undefined.mk" line 29: From the command line: Undefined is . -make: "cmdline-undefined.mk" line 30: From .MAKEFLAGS '=': Undefined is . -make: "cmdline-undefined.mk" line 31: From .MAKEFLAGS ':=': Undefined is . -make: "cmdline-undefined.mk" line 35: From the command line: Undefined is now defined. -make: "cmdline-undefined.mk" line 36: From .MAKEFLAGS '=': Undefined is now defined. -make: "cmdline-undefined.mk" line 37: From .MAKEFLAGS ':=': Undefined is now defined. +make: "cmdline-undefined.mk" line 31: From the command line: Undefined is . +make: "cmdline-undefined.mk" line 34: From .MAKEFLAGS '=': Undefined is . +make: "cmdline-undefined.mk" line 37: From .MAKEFLAGS ':=': Undefined is . +make: "cmdline-undefined.mk" line 43: From the command line: Undefined is now defined. +make: "cmdline-undefined.mk" line 46: From .MAKEFLAGS '=': Undefined is now defined. +make: "cmdline-undefined.mk" line 49: From .MAKEFLAGS ':=': Undefined is now defined. The := assignment operator -make: "cmdline-undefined.mk" line 29: From the command line: Undefined is . -make: "cmdline-undefined.mk" line 30: From .MAKEFLAGS '=': Undefined is . -make: "cmdline-undefined.mk" line 31: From .MAKEFLAGS ':=': Undefined is . -make: "cmdline-undefined.mk" line 35: From the command line: Undefined is now defined. -make: "cmdline-undefined.mk" line 36: From .MAKEFLAGS '=': Undefined is now defined. -make: "cmdline-undefined.mk" line 37: From .MAKEFLAGS ':=': Undefined is now defined. +make: "cmdline-undefined.mk" line 31: From the command line: Undefined is . +make: "cmdline-undefined.mk" line 34: From .MAKEFLAGS '=': Undefined is . +make: "cmdline-undefined.mk" line 37: From .MAKEFLAGS ':=': Undefined is . +make: "cmdline-undefined.mk" line 43: From the command line: Undefined is now defined. +make: "cmdline-undefined.mk" line 46: From .MAKEFLAGS '=': Undefined is now defined. +make: "cmdline-undefined.mk" line 49: From .MAKEFLAGS ':=': Undefined is now defined. exit status 0 diff --git a/usr.bin/make/unit-tests/cmdline-undefined.mk b/usr.bin/make/unit-tests/cmdline-undefined.mk index 5a3375cbbfb..062449f80df 100644 --- a/usr.bin/make/unit-tests/cmdline-undefined.mk +++ b/usr.bin/make/unit-tests/cmdline-undefined.mk @@ -1,4 +1,4 @@ -# $NetBSD: cmdline-undefined.mk,v 1.2 2020/11/04 04:49:33 rillig Exp $ +# $NetBSD: cmdline-undefined.mk,v 1.3 2023/06/01 20:56:35 rillig Exp $ # # Tests for undefined variable expressions in the command line. @@ -26,14 +26,26 @@ all: .MAKEFLAGS: MAKEFLAGS_ASSIGN='Undefined is $${UNDEFINED}.' .MAKEFLAGS: MAKEFLAGS_SUBST:='Undefined is $${UNDEFINED}.' +# expect+2: From the command line: Undefined is . +# expect+1: From the command line: Undefined is . .info From the command line: ${CMDLINE} +# expect+2: From .MAKEFLAGS '=': Undefined is . +# expect+1: From .MAKEFLAGS '=': Undefined is . .info From .MAKEFLAGS '=': ${MAKEFLAGS_ASSIGN} +# expect+2: From .MAKEFLAGS ':=': Undefined is . +# expect+1: From .MAKEFLAGS ':=': Undefined is . .info From .MAKEFLAGS ':=': ${MAKEFLAGS_SUBST} UNDEFINED?= now defined +# expect+2: From the command line: Undefined is now defined. +# expect+1: From the command line: Undefined is now defined. .info From the command line: ${CMDLINE} +# expect+2: From .MAKEFLAGS '=': Undefined is now defined. +# expect+1: From .MAKEFLAGS '=': Undefined is now defined. .info From .MAKEFLAGS '=': ${MAKEFLAGS_ASSIGN} +# expect+2: From .MAKEFLAGS ':=': Undefined is now defined. +# expect+1: From .MAKEFLAGS ':=': Undefined is now defined. .info From .MAKEFLAGS ':=': ${MAKEFLAGS_SUBST} print-undefined: diff --git a/usr.bin/make/unit-tests/cond-cmp-numeric-eq.exp b/usr.bin/make/unit-tests/cond-cmp-numeric-eq.exp index 72d3d935755..059007f00c8 100644 --- a/usr.bin/make/unit-tests/cond-cmp-numeric-eq.exp +++ b/usr.bin/make/unit-tests/cond-cmp-numeric-eq.exp @@ -1,5 +1,5 @@ -make: "cond-cmp-numeric-eq.mk" line 67: Malformed conditional (!(12345 = 12345)) -make: "cond-cmp-numeric-eq.mk" line 74: Malformed conditional (!(12345 === 12345)) +make: "cond-cmp-numeric-eq.mk" line 68: Malformed conditional (!(12345 = 12345)) +make: "cond-cmp-numeric-eq.mk" line 76: Malformed conditional (!(12345 === 12345)) make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk b/usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk index c6b39876e75..4c5f9b8aa83 100644 --- a/usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk +++ b/usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk @@ -1,4 +1,4 @@ -# $NetBSD: cond-cmp-numeric-eq.mk,v 1.5 2020/11/08 21:47:59 rillig Exp $ +# $NetBSD: cond-cmp-numeric-eq.mk,v 1.6 2023/06/01 20:56:35 rillig Exp $ # # Tests for numeric comparisons with the == operator in .if conditions. @@ -64,6 +64,7 @@ .endif # There is no = operator for numbers. +# expect+1: Malformed conditional (!(12345 = 12345)) .if !(12345 = 12345) . error .else @@ -71,6 +72,7 @@ .endif # There is no === operator for numbers either. +# expect+1: Malformed conditional (!(12345 === 12345)) .if !(12345 === 12345) . error .else diff --git a/usr.bin/make/unit-tests/cond-cmp-unary.exp b/usr.bin/make/unit-tests/cond-cmp-unary.exp index 49fb43b20bb..c5b800122eb 100644 --- a/usr.bin/make/unit-tests/cond-cmp-unary.exp +++ b/usr.bin/make/unit-tests/cond-cmp-unary.exp @@ -1,2 +1,2 @@ -make: "cond-cmp-unary.mk" line 53: This is only reached because of a bug in EvalTruthy. +make: "cond-cmp-unary.mk" line 54: This is only reached because of a bug in EvalTruthy. exit status 0 diff --git a/usr.bin/make/unit-tests/cond-cmp-unary.mk b/usr.bin/make/unit-tests/cond-cmp-unary.mk index efa6da29894..58927e3b494 100644 --- a/usr.bin/make/unit-tests/cond-cmp-unary.mk +++ b/usr.bin/make/unit-tests/cond-cmp-unary.mk @@ -1,4 +1,4 @@ -# $NetBSD: cond-cmp-unary.mk,v 1.4 2023/06/01 07:44:10 rillig Exp $ +# $NetBSD: cond-cmp-unary.mk,v 1.5 2023/06/01 20:56:35 rillig Exp $ # # Tests for unary comparisons in .if conditions, that is, comparisons with # a single operand. If the operand is a number, it is compared to zero, @@ -50,6 +50,7 @@ # a commit from 1992-04-15 saying "A variable is empty when it just contains # spaces". .if ${:U } +# expect+1: This is only reached because of a bug in EvalTruthy. . info This is only reached because of a bug in EvalTruthy. .else . error diff --git a/usr.bin/make/unit-tests/cond-eof.exp b/usr.bin/make/unit-tests/cond-eof.exp index f57dd87a772..58a74d854d9 100644 --- a/usr.bin/make/unit-tests/cond-eof.exp +++ b/usr.bin/make/unit-tests/cond-eof.exp @@ -1,6 +1,6 @@ -make: "cond-eof.mk" line 19: Malformed conditional (0 ${SIDE_EFFECT} ${SIDE_EFFECT2}) -make: "cond-eof.mk" line 22: Malformed conditional (1 ${SIDE_EFFECT} ${SIDE_EFFECT2}) -make: "cond-eof.mk" line 25: Malformed conditional ((0) ${SIDE_EFFECT} ${SIDE_EFFECT2}) +make: "cond-eof.mk" line 17: Malformed conditional (0 ${SIDE_EFFECT} ${SIDE_EFFECT2}) +make: "cond-eof.mk" line 20: Malformed conditional (1 ${SIDE_EFFECT} ${SIDE_EFFECT2}) +make: "cond-eof.mk" line 23: Malformed conditional ((0) ${SIDE_EFFECT} ${SIDE_EFFECT2}) make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/cond-eof.mk b/usr.bin/make/unit-tests/cond-eof.mk index 4920682f4c7..25c6ec5de70 100644 --- a/usr.bin/make/unit-tests/cond-eof.mk +++ b/usr.bin/make/unit-tests/cond-eof.mk @@ -1,10 +1,8 @@ -# $NetBSD: cond-eof.mk,v 1.4 2023/06/01 07:27:30 rillig Exp $ +# $NetBSD: cond-eof.mk,v 1.5 2023/06/01 20:56:35 rillig Exp $ # # Tests for parsing the end of '.if' conditions, which are represented as the # token TOK_EOF. -# expect-all - SIDE_EFFECT= ${:!echo 'side effect' 1>&2!} SIDE_EFFECT2= ${:!echo 'side effect 2' 1>&2!} diff --git a/usr.bin/make/unit-tests/cond-func-defined.exp b/usr.bin/make/unit-tests/cond-func-defined.exp index 878f56de2ec..c2fc78c1a35 100644 --- a/usr.bin/make/unit-tests/cond-func-defined.exp +++ b/usr.bin/make/unit-tests/cond-func-defined.exp @@ -1,8 +1,8 @@ -make: "cond-func-defined.mk" line 23: Missing closing parenthesis for defined() -make: "cond-func-defined.mk" line 33: Missing closing parenthesis for defined() -make: "cond-func-defined.mk" line 45: In .for loops, variable expressions for the loop variables are -make: "cond-func-defined.mk" line 46: substituted at evaluation time. There is no actual variable -make: "cond-func-defined.mk" line 47: involved, even if it feels like it. +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, variable 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/usr.bin/make/unit-tests/cond-func-defined.mk b/usr.bin/make/unit-tests/cond-func-defined.mk index f13e2a9a1f7..10adfde292e 100644 --- a/usr.bin/make/unit-tests/cond-func-defined.mk +++ b/usr.bin/make/unit-tests/cond-func-defined.mk @@ -1,4 +1,4 @@ -# $NetBSD: cond-func-defined.mk,v 1.9 2022/05/08 06:51:27 rillig Exp $ +# $NetBSD: cond-func-defined.mk,v 1.10 2023/06/01 20:56:35 rillig Exp $ # # Tests for the defined() function in .if conditions. @@ -20,6 +20,7 @@ ${:UA B}= variable name with spaces .endif # The argument of a function must not directly contain whitespace. +# expect+1: Missing closing parenthesis for defined() .if !defined(A B) . error .endif @@ -29,7 +30,7 @@ ${:UA B}= variable name with spaces . error .endif -# Parse error: missing closing parenthesis; see ParseWord. +# expect+1: Missing closing parenthesis for defined() .if defined(DEF . error .else @@ -42,8 +43,11 @@ ${:UA B}= variable name with spaces . if defined(var) . error . else +# expect+1: In .for loops, variable expressions for the loop variables are . info In .for loops, variable 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. . endif .endfor diff --git a/usr.bin/make/unit-tests/cond-func-empty.exp b/usr.bin/make/unit-tests/cond-func-empty.exp index 35d83adad5c..5584b406282 100644 --- a/usr.bin/make/unit-tests/cond-func-empty.exp +++ b/usr.bin/make/unit-tests/cond-func-empty.exp @@ -1,5 +1,5 @@ -make: "cond-func-empty.mk" line 153: Unclosed variable "WORD" -make: "cond-func-empty.mk" line 153: Malformed conditional (empty(WORD) +make: "cond-func-empty.mk" line 154: Unclosed variable "WORD" +make: "cond-func-empty.mk" line 154: Malformed conditional (empty(WORD) make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/cond-func-empty.mk b/usr.bin/make/unit-tests/cond-func-empty.mk index 7126605ac9a..69f489efae0 100644 --- a/usr.bin/make/unit-tests/cond-func-empty.mk +++ b/usr.bin/make/unit-tests/cond-func-empty.mk @@ -1,4 +1,4 @@ -# $NetBSD: cond-func-empty.mk,v 1.19 2023/06/01 07:27:30 rillig Exp $ +# $NetBSD: cond-func-empty.mk,v 1.20 2023/06/01 20:56:35 rillig Exp $ # # Tests for the empty() function in .if conditions, which tests a variable # expression for emptiness. @@ -149,7 +149,8 @@ ${:U WORD }= variable name with spaces . error .endif -# Parse error: missing closing parenthesis. +# expect+2: Unclosed variable "WORD" +# expect+1: Malformed conditional (empty(WORD) .if empty(WORD . error .else diff --git a/usr.bin/make/unit-tests/cond-func.exp b/usr.bin/make/unit-tests/cond-func.exp index d0663ea6864..eeaa8944588 100644 --- a/usr.bin/make/unit-tests/cond-func.exp +++ b/usr.bin/make/unit-tests/cond-func.exp @@ -1,12 +1,12 @@ -make: "cond-func.mk" line 36: Missing closing parenthesis for defined() -make: "cond-func.mk" line 51: Missing closing parenthesis for defined() -make: "cond-func.mk" line 54: Missing closing parenthesis for defined() -make: "cond-func.mk" line 94: The empty variable is never defined. -make: "cond-func.mk" line 103: A plain function name is parsed as defined(...). -make: "cond-func.mk" line 110: A plain function name is parsed as defined(...). -make: "cond-func.mk" line 120: Symbols may start with a function name. -make: "cond-func.mk" line 125: Symbols may start with a function name. -make: "cond-func.mk" line 131: Missing closing parenthesis for defined() +make: "cond-func.mk" line 37: Missing closing parenthesis for defined() +make: "cond-func.mk" line 53: Missing closing parenthesis for defined() +make: "cond-func.mk" line 57: Missing closing parenthesis for defined() +make: "cond-func.mk" line 98: The empty variable is never defined. +make: "cond-func.mk" line 108: A plain function name is parsed as defined(...). +make: "cond-func.mk" line 116: A plain function name is parsed as defined(...). +make: "cond-func.mk" line 127: Symbols may start with a function name. +make: "cond-func.mk" line 133: Symbols may start with a function name. +make: "cond-func.mk" line 139: Missing closing parenthesis for defined() make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/cond-func.mk b/usr.bin/make/unit-tests/cond-func.mk index e09b363edb6..2e8a6785b0e 100644 --- a/usr.bin/make/unit-tests/cond-func.mk +++ b/usr.bin/make/unit-tests/cond-func.mk @@ -1,4 +1,4 @@ -# $NetBSD: cond-func.mk,v 1.12 2023/05/10 15:53:32 rillig Exp $ +# $NetBSD: cond-func.mk,v 1.13 2023/06/01 20:56:35 rillig Exp $ # # Tests for those parts of the functions in .if conditions that are common # among several functions. @@ -33,6 +33,7 @@ ${VARNAME_UNBALANCED_BRACES}= variable name with unbalanced braces .endif # The argument of a function must not directly contain whitespace. +# expect+1: Missing closing parenthesis for defined() .if !defined(A B) . error .endif @@ -48,9 +49,11 @@ ${VARNAME_UNBALANCED_BRACES}= variable name with unbalanced braces # # It's not entirely clear why these characters are forbidden. # The most plausible reason seems to be typo detection. +# expect+1: Missing closing parenthesis for defined() .if !defined(A&B) . error .endif +# expect+1: Missing closing parenthesis for defined() .if !defined(A|B) . error .endif @@ -91,6 +94,7 @@ ${VARNAME_UNBALANCED_BRACES}= variable name with unbalanced braces .if defined() . error .else +# expect+1: The empty variable is never defined. . info The empty variable is never defined. .endif @@ -100,6 +104,7 @@ ${VARNAME_UNBALANCED_BRACES}= variable name with unbalanced braces .if defined . error .else +# expect+1: A plain function name is parsed as defined(...). . info A plain function name is parsed as defined(...). .endif @@ -107,6 +112,7 @@ ${VARNAME_UNBALANCED_BRACES}= variable name with unbalanced braces # is interpreted as 'defined(defined)', and the condition evaluates to true. defined= # defined but empty .if defined +# expect+1: A plain function name is parsed as defined(...). . info A plain function name is parsed as defined(...). .else . error @@ -117,17 +123,19 @@ defined= # defined but empty .if defined-var . error .else +# expect+1: Symbols may start with a function name. . info Symbols may start with a function name. .endif defined-var= # defined but empty .if defined-var +# expect+1: Symbols may start with a function name. . info Symbols may start with a function name. .else . error .endif -# Missing closing parenthesis when parsing the function argument. +# expect+1: Missing closing parenthesis for defined() .if defined( . error .else diff --git a/usr.bin/make/unit-tests/cond-op-and-lint.exp b/usr.bin/make/unit-tests/cond-op-and-lint.exp index 8817fd0d658..0f2cdb0028f 100644 --- a/usr.bin/make/unit-tests/cond-op-and-lint.exp +++ b/usr.bin/make/unit-tests/cond-op-and-lint.exp @@ -1,4 +1,4 @@ -make: "cond-op-and-lint.mk" line 9: Unknown operator '&' +make: "cond-op-and-lint.mk" line 10: Unknown operator '&' make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/cond-op-and-lint.mk b/usr.bin/make/unit-tests/cond-op-and-lint.mk index 6262339016f..bac4566314b 100644 --- a/usr.bin/make/unit-tests/cond-op-and-lint.mk +++ b/usr.bin/make/unit-tests/cond-op-and-lint.mk @@ -1,4 +1,4 @@ -# $NetBSD: cond-op-and-lint.mk,v 1.1 2020/11/08 23:54:28 rillig Exp $ +# $NetBSD: cond-op-and-lint.mk,v 1.2 2023/06/01 20:56:35 rillig Exp $ # # Tests for the && operator in .if conditions, in lint mode. @@ -6,6 +6,7 @@ # The '&' operator is not allowed in lint mode. # It is not used in practice anyway. +# expect+1: Unknown operator '&' .if 0 & 0 . error .else diff --git a/usr.bin/make/unit-tests/cond-op-and.exp b/usr.bin/make/unit-tests/cond-op-and.exp index cd6b03a8359..6d5a14b211c 100644 --- a/usr.bin/make/unit-tests/cond-op-and.exp +++ b/usr.bin/make/unit-tests/cond-op-and.exp @@ -1,7 +1,7 @@ -make: "cond-op-and.mk" line 36: Malformed conditional (0 || (${DEF} && ${UNDEF})) -make: "cond-op-and.mk" line 40: Malformed conditional (0 || (${UNDEF} && ${UNDEF})) -make: "cond-op-and.mk" line 42: Malformed conditional (0 || (!${UNDEF} && ${UNDEF})) -make: "cond-op-and.mk" line 71: Malformed conditional (0 &&& 0) +make: "cond-op-and.mk" line 37: Malformed conditional (0 || (${DEF} && ${UNDEF})) +make: "cond-op-and.mk" line 42: Malformed conditional (0 || (${UNDEF} && ${UNDEF})) +make: "cond-op-and.mk" line 45: Malformed conditional (0 || (!${UNDEF} && ${UNDEF})) +make: "cond-op-and.mk" line 75: Malformed conditional (0 &&& 0) make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/cond-op-and.mk b/usr.bin/make/unit-tests/cond-op-and.mk index 83386ed77de..d12c6821f3b 100644 --- a/usr.bin/make/unit-tests/cond-op-and.mk +++ b/usr.bin/make/unit-tests/cond-op-and.mk @@ -1,4 +1,4 @@ -# $NetBSD: cond-op-and.mk,v 1.6 2021/12/10 19:14:35 rillig Exp $ +# $NetBSD: cond-op-and.mk,v 1.7 2023/06/01 20:56:35 rillig Exp $ # # Tests for the && operator in .if conditions. @@ -33,12 +33,15 @@ # Test combinations of outer '||' with inner '&&', to ensure that the operands # of the inner '&&' are only evaluated if necessary. DEF= defined +# expect+1: Malformed conditional (0 || (${DEF} && ${UNDEF}) .if 0 || (${DEF} && ${UNDEF}) .endif .if 0 || (!${DEF} && ${UNDEF}) .endif +# expect+1: Malformed conditional (0 || (${UNDEF} && ${UNDEF}) .if 0 || (${UNDEF} && ${UNDEF}) .endif +# expect+1: Malformed conditional (0 || (!${UNDEF} && ${UNDEF}) .if 0 || (!${UNDEF} && ${UNDEF}) .endif .if 1 || (${DEF} && ${UNDEF}) @@ -68,6 +71,7 @@ DEF= defined .endif # There is no operator &&&. +# expect+1: Malformed conditional (0 &&& 0) .if 0 &&& 0 . error .endif diff --git a/usr.bin/make/unit-tests/cond-op-not.exp b/usr.bin/make/unit-tests/cond-op-not.exp index 440670ca724..fcdceee9af2 100644 --- a/usr.bin/make/unit-tests/cond-op-not.exp +++ b/usr.bin/make/unit-tests/cond-op-not.exp @@ -1,9 +1,9 @@ -make: "cond-op-not.mk" line 29: Not empty evaluates to true. -make: "cond-op-not.mk" line 37: Not space evaluates to false. -make: "cond-op-not.mk" line 41: Not 0 evaluates to true. -make: "cond-op-not.mk" line 49: Not 1 evaluates to false. -make: "cond-op-not.mk" line 55: Not word evaluates to false. -make: "cond-op-not.mk" line 59: Malformed conditional (!) +make: "cond-op-not.mk" line 30: Not empty evaluates to true. +make: "cond-op-not.mk" line 39: Not space evaluates to false. +make: "cond-op-not.mk" line 44: Not 0 evaluates to true. +make: "cond-op-not.mk" line 53: Not 1 evaluates to false. +make: "cond-op-not.mk" line 60: Not word evaluates to false. +make: "cond-op-not.mk" line 65: Malformed conditional (!) make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/cond-op-not.mk b/usr.bin/make/unit-tests/cond-op-not.mk index ffd5bc89e4b..28f835fa3cb 100644 --- a/usr.bin/make/unit-tests/cond-op-not.mk +++ b/usr.bin/make/unit-tests/cond-op-not.mk @@ -1,4 +1,4 @@ -# $NetBSD: cond-op-not.mk,v 1.7 2021/01/19 17:49:13 rillig Exp $ +# $NetBSD: cond-op-not.mk,v 1.8 2023/06/01 20:56:35 rillig Exp $ # # Tests for the ! operator in .if conditions, which negates its argument. @@ -26,6 +26,7 @@ .endif .if !${:U} +# expect+1: Not empty evaluates to true. . info Not empty evaluates to true. .else . info Not empty evaluates to false. @@ -34,10 +35,12 @@ .if !${:U } . info Not space evaluates to true. .else +# expect+1: Not space evaluates to false. . info Not space evaluates to false. .endif .if !${:U0} +# expect+1: Not 0 evaluates to true. . info Not 0 evaluates to true. .else . info Not 0 evaluates to false. @@ -46,16 +49,19 @@ .if !${:U1} . info Not 1 evaluates to true. .else +# expect+1: Not 1 evaluates to false. . info Not 1 evaluates to false. .endif .if !${:Uword} . info Not word evaluates to true. .else +# expect+1: Not word evaluates to false. . info Not word evaluates to false. .endif # A single exclamation mark is a parse error. +# expect+1: Malformed conditional (!) .if ! . error .else diff --git a/usr.bin/make/unit-tests/cond-op-or-lint.exp b/usr.bin/make/unit-tests/cond-op-or-lint.exp index 8abae99b6c4..0fb1d0dae16 100644 --- a/usr.bin/make/unit-tests/cond-op-or-lint.exp +++ b/usr.bin/make/unit-tests/cond-op-or-lint.exp @@ -1,4 +1,4 @@ -make: "cond-op-or-lint.mk" line 9: Unknown operator '|' +make: "cond-op-or-lint.mk" line 10: Unknown operator '|' make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/cond-op-or-lint.mk b/usr.bin/make/unit-tests/cond-op-or-lint.mk index aa29e9a6c2f..9ece9d5c9af 100644 --- a/usr.bin/make/unit-tests/cond-op-or-lint.mk +++ b/usr.bin/make/unit-tests/cond-op-or-lint.mk @@ -1,4 +1,4 @@ -# $NetBSD: cond-op-or-lint.mk,v 1.1 2020/11/08 23:54:28 rillig Exp $ +# $NetBSD: cond-op-or-lint.mk,v 1.2 2023/06/01 20:56:35 rillig Exp $ # # Tests for the || operator in .if conditions, in lint mode. @@ -6,6 +6,7 @@ # The '|' operator is not allowed in lint mode. # It is not used in practice anyway. +# expect+1: Unknown operator '|' .if 0 | 0 . error .else diff --git a/usr.bin/make/unit-tests/cond-op-or.exp b/usr.bin/make/unit-tests/cond-op-or.exp index 43b9a5438a3..b10bc4bf7c5 100644 --- a/usr.bin/make/unit-tests/cond-op-or.exp +++ b/usr.bin/make/unit-tests/cond-op-or.exp @@ -1,7 +1,7 @@ -make: "cond-op-or.mk" line 46: Malformed conditional (1 && (!${DEF} || ${UNDEF})) -make: "cond-op-or.mk" line 48: Malformed conditional (1 && (${UNDEF} || ${UNDEF})) -make: "cond-op-or.mk" line 50: Malformed conditional (1 && (!${UNDEF} || ${UNDEF})) -make: "cond-op-or.mk" line 71: Malformed conditional (0 ||| 0) +make: "cond-op-or.mk" line 47: Malformed conditional (1 && (!${DEF} || ${UNDEF})) +make: "cond-op-or.mk" line 50: Malformed conditional (1 && (${UNDEF} || ${UNDEF})) +make: "cond-op-or.mk" line 53: Malformed conditional (1 && (!${UNDEF} || ${UNDEF})) +make: "cond-op-or.mk" line 75: Malformed conditional (0 ||| 0) make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/cond-op-or.mk b/usr.bin/make/unit-tests/cond-op-or.mk index 0b7ac55e6c3..d0c9f3f2cd8 100644 --- a/usr.bin/make/unit-tests/cond-op-or.mk +++ b/usr.bin/make/unit-tests/cond-op-or.mk @@ -1,4 +1,4 @@ -# $NetBSD: cond-op-or.mk,v 1.8 2021/12/10 19:14:35 rillig Exp $ +# $NetBSD: cond-op-or.mk,v 1.9 2023/06/01 20:56:35 rillig Exp $ # # Tests for the || operator in .if conditions. @@ -43,10 +43,13 @@ DEF= defined .endif .if 1 && (${DEF} || ${UNDEF}) .endif +# expect+1: Malformed conditional (1 && (!${DEF} || ${UNDEF}) .if 1 && (!${DEF} || ${UNDEF}) .endif +# expect+1: Malformed conditional (1 && (${UNDEF} || ${UNDEF}) .if 1 && (${UNDEF} || ${UNDEF}) .endif +# expect+1: Malformed conditional (1 && (!${UNDEF} || ${UNDEF}) .if 1 && (!${UNDEF} || ${UNDEF}) .endif @@ -68,6 +71,7 @@ DEF= defined .endif # There is no operator |||. +# expect+1: Malformed conditional (0 ||| 0) .if 0 ||| 0 . error .endif diff --git a/usr.bin/make/unit-tests/cond-op-parentheses.exp b/usr.bin/make/unit-tests/cond-op-parentheses.exp index c2530f62de6..1daad92b268 100644 --- a/usr.bin/make/unit-tests/cond-op-parentheses.exp +++ b/usr.bin/make/unit-tests/cond-op-parentheses.exp @@ -1,7 +1,7 @@ make: "cond-op-parentheses.mk" line 22: Comparison with '>' requires both operands '3' and '(2' to be numeric make: "cond-op-parentheses.mk" line 25: Malformed conditional ((3) > 2) -make: "cond-op-parentheses.mk" line 43: Malformed conditional (() -make: "cond-op-parentheses.mk" line 56: Malformed conditional ()) +make: "cond-op-parentheses.mk" line 44: Malformed conditional (() +make: "cond-op-parentheses.mk" line 58: Malformed conditional ()) make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/cond-op-parentheses.mk b/usr.bin/make/unit-tests/cond-op-parentheses.mk index 8f8c3ee1e79..b6c9bd3c0e9 100644 --- a/usr.bin/make/unit-tests/cond-op-parentheses.mk +++ b/usr.bin/make/unit-tests/cond-op-parentheses.mk @@ -1,4 +1,4 @@ -# $NetBSD: cond-op-parentheses.mk,v 1.6 2022/09/04 22:55:00 rillig Exp $ +# $NetBSD: cond-op-parentheses.mk,v 1.7 2023/06/01 20:56:35 rillig Exp $ # # Tests for parentheses in .if conditions, which group expressions to override # the precedence of the operators '!', '&&' and '||'. Parentheses cannot be @@ -40,6 +40,7 @@ .endif # An unbalanced opening parenthesis is a parse error. +# expect+1: Malformed conditional (() .if ( . error .else @@ -53,6 +54,7 @@ # TOK_TRUE, TOK_FALSE or TOK_ERROR. In cond.c 1.241, the return type of that # function was changed to a properly restricted enum type, to prevent this bug # from occurring again. +# expect+1: Malformed conditional ()) .if ) . error .else diff --git a/usr.bin/make/unit-tests/cond-op.exp b/usr.bin/make/unit-tests/cond-op.exp index b8f6a430181..33bab484a6c 100644 --- a/usr.bin/make/unit-tests/cond-op.exp +++ b/usr.bin/make/unit-tests/cond-op.exp @@ -1,22 +1,21 @@ -make: "cond-op.mk" line 50: Malformed conditional ("!word" == !word) -make: "cond-op.mk" line 76: Malformed conditional (0 ${ERR::=evaluated}) -make: "cond-op.mk" line 80: A misplaced expression after 0 is not evaluated. -make: "cond-op.mk" line 84: Malformed conditional (1 ${ERR::=evaluated}) -make: "cond-op.mk" line 88: A misplaced expression after 1 is not evaluated. -make: "cond-op.mk" line 92: Parsing continues until here. -make: "cond-op.mk" line 95: A B C => (A || B) && C A || B && C A || (B && C) -make: "cond-op.mk" line 102: 0 0 0 => 0 0 0 -make: "cond-op.mk" line 102: 0 0 1 => 0 0 0 -make: "cond-op.mk" line 102: 0 1 0 => 0 0 0 -make: "cond-op.mk" line 102: 0 1 1 => 1 1 1 -make: "cond-op.mk" line 102: 1 0 0 => 0 1 1 -make: "cond-op.mk" line 102: 1 0 1 => 1 1 1 -make: "cond-op.mk" line 102: 1 1 0 => 0 1 1 -make: "cond-op.mk" line 102: 1 1 1 => 1 1 1 -make: "cond-op.mk" line 113: Malformed conditional (1 &&) -make: "cond-op.mk" line 121: Malformed conditional (0 &&) -make: "cond-op.mk" line 129: Malformed conditional (1 ||) -make: "cond-op.mk" line 138: Malformed conditional (0 ||) +make: "cond-op.mk" line 51: Malformed conditional ("!word" == !word) +make: "cond-op.mk" line 72: Malformed conditional (0 ${ERR::=evaluated}) +make: "cond-op.mk" line 77: A misplaced expression after 0 is not evaluated. +make: "cond-op.mk" line 82: Malformed conditional (1 ${ERR::=evaluated}) +make: "cond-op.mk" line 87: A misplaced expression after 1 is not evaluated. +make: "cond-op.mk" line 93: A B C => (A || B) && C A || B && C A || (B && C) +make: "cond-op.mk" line 108: 0 0 0 => 0 0 0 +make: "cond-op.mk" line 108: 0 0 1 => 0 0 0 +make: "cond-op.mk" line 108: 0 1 0 => 0 0 0 +make: "cond-op.mk" line 108: 0 1 1 => 1 1 1 +make: "cond-op.mk" line 108: 1 0 0 => 0 1 1 +make: "cond-op.mk" line 108: 1 0 1 => 1 1 1 +make: "cond-op.mk" line 108: 1 1 0 => 0 1 1 +make: "cond-op.mk" line 108: 1 1 1 => 1 1 1 +make: "cond-op.mk" line 120: Malformed conditional (1 &&) +make: "cond-op.mk" line 129: Malformed conditional (0 &&) +make: "cond-op.mk" line 138: Malformed conditional (1 ||) +make: "cond-op.mk" line 148: Malformed conditional (0 ||) make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/cond-op.mk b/usr.bin/make/unit-tests/cond-op.mk index c3ab09f7709..6371e4db059 100644 --- a/usr.bin/make/unit-tests/cond-op.mk +++ b/usr.bin/make/unit-tests/cond-op.mk @@ -1,4 +1,4 @@ -# $NetBSD: cond-op.mk,v 1.15 2021/12/10 23:12:44 rillig Exp $ +# $NetBSD: cond-op.mk,v 1.16 2023/06/01 20:56:35 rillig Exp $ # # Tests for operators like &&, ||, ! in .if conditions. # @@ -47,6 +47,7 @@ # appear unquoted. If any, it must be enclosed in quotes. # In any case, it is not interpreted as a negation of an unquoted string. # See CondParser_String. +# expect+1: Malformed conditional ("!word" == !word) .if "!word" == !word . error .endif @@ -66,32 +67,29 @@ # nevertheless, since CondParser_Or and CondParser_And asked for the expanded # next token, even though in this position of the condition, only comparison # operators, TOK_AND, TOK_OR or TOK_RPAREN are allowed. -# -# -# -# -# -# .undef ERR +# expect+1: Malformed conditional (0 ${ERR::=evaluated}) .if 0 ${ERR::=evaluated} . error .endif .if ${ERR:Uundefined} == undefined +# expect+1: A misplaced expression after 0 is not evaluated. . info A misplaced expression after 0 is not evaluated. .endif .undef ERR +# expect+1: Malformed conditional (1 ${ERR::=evaluated}) .if 1 ${ERR::=evaluated} . error .endif .if ${ERR:Uundefined} == undefined +# expect+1: A misplaced expression after 1 is not evaluated. . info A misplaced expression after 1 is not evaluated. .endif -# Just in case that parsing should ever stop on the first error. -.info Parsing continues until here. # Demonstration that '&&' has higher precedence than '||'. +# expect+1: A B C => (A || B) && C A || B && C A || (B && C) .info A B C => (A || B) && C A || B && C A || (B && C) .for a in 0 1 . for b in 0 1 @@ -99,6 +97,14 @@ . for r1 in ${ ($a || $b) && $c :?1:0} . for r2 in ${ $a || $b && $c :?1:0} . for r3 in ${ $a || ($b && $c) :?1:0} +# expect+8: 0 0 0 => 0 0 0 +# expect+7: 0 0 1 => 0 0 0 +# expect+6: 0 1 0 => 0 0 0 +# expect+5: 0 1 1 => 1 1 1 +# expect+4: 1 0 0 => 0 1 1 +# expect+3: 1 0 1 => 1 1 1 +# expect+2: 1 1 0 => 0 1 1 +# expect+1: 1 1 1 => 1 1 1 . info $a $b $c => ${r1} ${r2} ${r3} . endfor . endfor @@ -110,6 +116,7 @@ # This condition is obviously malformed. It is properly detected and also # was properly detected before 2021-01-19, but only because the left hand # side of the '&&' evaluated to true. +# expect+1: Malformed conditional (1 &&) .if 1 && . error .else @@ -118,6 +125,7 @@ # This obviously malformed condition was not detected as such before cond.c # 1.238 from 2021-01-19. +# expect+1: Malformed conditional (0 &&) .if 0 && . error .else @@ -126,6 +134,7 @@ # This obviously malformed condition was not detected as such before cond.c # 1.238 from 2021-01-19. +# expect+1: Malformed conditional (1 ||) .if 1 || . error .else @@ -135,6 +144,7 @@ # This condition is obviously malformed. It is properly detected and also # was properly detected before 2021-01-19, but only because the left hand # side of the '||' evaluated to false. +# expect+1: Malformed conditional (0 ||) .if 0 || . error .else diff --git a/usr.bin/make/unit-tests/cond-token-number.exp b/usr.bin/make/unit-tests/cond-token-number.exp index 1d472b63bc7..d05833b4e01 100644 --- a/usr.bin/make/unit-tests/cond-token-number.exp +++ b/usr.bin/make/unit-tests/cond-token-number.exp @@ -1,7 +1,7 @@ -make: "cond-token-number.mk" line 15: Malformed conditional (-0) -make: "cond-token-number.mk" line 25: Malformed conditional (+0) -make: "cond-token-number.mk" line 35: Malformed conditional (!-1) -make: "cond-token-number.mk" line 45: Malformed conditional (!+1) +make: "cond-token-number.mk" line 16: Malformed conditional (-0) +make: "cond-token-number.mk" line 27: Malformed conditional (+0) +make: "cond-token-number.mk" line 38: Malformed conditional (!-1) +make: "cond-token-number.mk" line 49: Malformed conditional (!+1) make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/cond-token-number.mk b/usr.bin/make/unit-tests/cond-token-number.mk index d1dd7371f44..6cec21cf6c4 100644 --- a/usr.bin/make/unit-tests/cond-token-number.mk +++ b/usr.bin/make/unit-tests/cond-token-number.mk @@ -1,4 +1,4 @@ -# $NetBSD: cond-token-number.mk,v 1.8 2023/03/04 08:07:29 rillig Exp $ +# $NetBSD: cond-token-number.mk,v 1.9 2023/06/01 20:56:35 rillig Exp $ # # Tests for number tokens in .if conditions. # @@ -12,6 +12,7 @@ # accepted by the condition parser. # # See the ch_isdigit call in CondParser_String. +# expect+1: Malformed conditional (-0) .if -0 . error .else @@ -22,6 +23,7 @@ # accepted by the condition parser. # # See the ch_isdigit call in CondParser_String. +# expect+1: Malformed conditional (+0) .if +0 . error .else @@ -32,6 +34,7 @@ # accepted by the condition parser. # # See the ch_isdigit call in CondParser_String. +# expect+1: Malformed conditional (!-1) .if !-1 . error .else @@ -42,6 +45,7 @@ # accepted by the condition parser. # # See the ch_isdigit call in CondParser_String. +# expect+1: Malformed conditional (!+1) .if !+1 . error .else diff --git a/usr.bin/make/unit-tests/cond-token-plain.exp b/usr.bin/make/unit-tests/cond-token-plain.exp index 572e8b3b2c9..a14f6958165 100644 --- a/usr.bin/make/unit-tests/cond-token-plain.exp +++ b/usr.bin/make/unit-tests/cond-token-plain.exp @@ -27,37 +27,37 @@ Comparing "var&&name" != "var&&name" CondParser_Eval: ${:Uvar}||name != "var||name" Comparing "var||name" != "var||name" CondParser_Eval: bare -make: "cond-token-plain.mk" line 105: A bare word is treated like defined(...), and the variable 'bare' is not defined. +make: "cond-token-plain.mk" line 106: A bare word is treated like defined(...), and the variable 'bare' is not defined. CondParser_Eval: VAR -make: "cond-token-plain.mk" line 111: A bare word is treated like defined(...). +make: "cond-token-plain.mk" line 113: A bare word is treated like defined(...). CondParser_Eval: V${:UA}R -make: "cond-token-plain.mk" line 118: ok +make: "cond-token-plain.mk" line 121: ok CondParser_Eval: V${UNDEF}AR -make: "cond-token-plain.mk" line 126: Undefined variables in bare words expand to an empty string. +make: "cond-token-plain.mk" line 130: Undefined variables in bare words expand to an empty string. CondParser_Eval: 0${:Ux00} -make: "cond-token-plain.mk" line 134: Numbers can be composed from literals and variable expressions. +make: "cond-token-plain.mk" line 139: Numbers can be composed from literals and variable expressions. CondParser_Eval: 0${:Ux01} -make: "cond-token-plain.mk" line 138: Numbers can be composed from literals and variable expressions. +make: "cond-token-plain.mk" line 144: Numbers can be composed from literals and variable expressions. CondParser_Eval: "" == -make: "cond-token-plain.mk" line 144: Missing right-hand side of operator '==' +make: "cond-token-plain.mk" line 151: Missing right-hand side of operator '==' CondParser_Eval: == "" -make: "cond-token-plain.mk" line 152: Malformed conditional (== "") +make: "cond-token-plain.mk" line 160: Malformed conditional (== "") CondParser_Eval: \\ -make: "cond-token-plain.mk" line 167: The variable '\\' is not defined. +make: "cond-token-plain.mk" line 176: The variable '\\' is not defined. CondParser_Eval: \\ -make: "cond-token-plain.mk" line 172: Now the variable '\\' is defined. +make: "cond-token-plain.mk" line 182: Now the variable '\\' is defined. CondParser_Eval: "unquoted\"quoted" != unquoted"quoted Comparing "unquoted"quoted" != "unquoted"quoted" CondParser_Eval: $$$$$$$$ != "" -make: "cond-token-plain.mk" line 186: Malformed conditional ($$$$$$$$ != "") +make: "cond-token-plain.mk" line 197: Malformed conditional ($$$$$$$$ != "") CondParser_Eval: left == right -make: "cond-token-plain.mk" line 195: Malformed conditional (left == right) +make: "cond-token-plain.mk" line 206: Malformed conditional (left == right) CondParser_Eval: ${0:?:} || left == right CondParser_Eval: 0 -make: "cond-token-plain.mk" line 201: Malformed conditional (${0:?:} || left == right) +make: "cond-token-plain.mk" line 212: Malformed conditional (${0:?:} || left == right) CondParser_Eval: left == right || ${0:?:} -make: "cond-token-plain.mk" line 206: Malformed conditional (left == right || ${0:?:}) -make: "cond-token-plain.mk" line 225: Malformed conditional (VAR.${IF_COUNT::+=1} != "") +make: "cond-token-plain.mk" line 217: Malformed conditional (left == right || ${0:?:}) +make: "cond-token-plain.mk" line 236: Malformed conditional (VAR.${IF_COUNT::+=1} != "") make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/cond-token-plain.mk b/usr.bin/make/unit-tests/cond-token-plain.mk index 54bdd4fbf62..b6444e8ac1d 100644 --- a/usr.bin/make/unit-tests/cond-token-plain.mk +++ b/usr.bin/make/unit-tests/cond-token-plain.mk @@ -1,4 +1,4 @@ -# $NetBSD: cond-token-plain.mk,v 1.17 2023/02/14 20:49:09 rillig Exp $ +# $NetBSD: cond-token-plain.mk,v 1.18 2023/06/01 20:56:35 rillig Exp $ # # Tests for plain tokens (that is, string literals without quotes) # in .if conditions. These are also called bare words. @@ -102,12 +102,14 @@ .if bare . error .else +# expect+1: A bare word is treated like defined(...), and the variable 'bare' is not defined. . info A bare word is treated like defined(...), and the variable $\ 'bare' is not defined. .endif VAR= defined .if VAR +# expect+1: A bare word is treated like defined(...). . info A bare word is treated like defined(...). .else . error @@ -115,6 +117,7 @@ VAR= defined # Bare words may be intermixed with variable expressions. .if V${:UA}R +# expect+1: ok . info ok .else . error @@ -123,6 +126,7 @@ VAR= defined # In bare words, even undefined variables are allowed. Without the bare # words, undefined variables are not allowed. That feels inconsistent. .if V${UNDEF}AR +# expect+1: Undefined variables in bare words expand to an empty string. . info Undefined variables in bare words expand to an empty string. .else . error @@ -131,16 +135,19 @@ VAR= defined .if 0${:Ux00} . error .else +# expect+1: Numbers can be composed from literals and variable expressions. . info Numbers can be composed from literals and variable expressions. .endif .if 0${:Ux01} +# expect+1: Numbers can be composed from literals and variable expressions. . info Numbers can be composed from literals and variable expressions. .else . error .endif # If the right-hand side is missing, it's a parse error. +# expect+1: Missing right-hand side of operator '==' .if "" == . error .else @@ -149,6 +156,7 @@ VAR= defined # If the left-hand side is missing, it's a parse error as well, but without # a specific error message. +# expect+1: Malformed conditional (== "") .if == "" . error .else @@ -164,11 +172,13 @@ VAR= defined .if \\ . error .else +# expect+1: The variable '\\' is not defined. . info The variable '\\' is not defined. .endif ${:U\\\\}= backslash .if \\ +# expect+1: Now the variable '\\' is defined. . info Now the variable '\\' is defined. .else . error @@ -183,6 +193,7 @@ ${:U\\\\}= backslash # FIXME: In CondParser_String, Var_Parse returns var_Error without a # corresponding error message. +# expect+1: Malformed conditional ($$$$$$$$ != "") .if $$$$$$$$ != "" . error .else diff --git a/usr.bin/make/unit-tests/cond-token-string.exp b/usr.bin/make/unit-tests/cond-token-string.exp index 854de02b731..959effba090 100644 --- a/usr.bin/make/unit-tests/cond-token-string.exp +++ b/usr.bin/make/unit-tests/cond-token-string.exp @@ -1,18 +1,18 @@ -make: "cond-token-string.mk" line 13: Unknown modifier "Z" -make: "cond-token-string.mk" line 13: Malformed conditional ("" != "${:Uvalue:Z}") -make: "cond-token-string.mk" line 22: xvalue is not defined. -make: "cond-token-string.mk" line 28: Malformed conditional (x${:Uvalue} == "") -make: "cond-token-string.mk" line 37: Expected. +make: "cond-token-string.mk" line 15: 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} == "") +make: "cond-token-string.mk" line 42: Expected. CondParser_Eval: "UNDEF" -make: "cond-token-string.mk" line 46: The string literal "UNDEF" is not empty. +make: "cond-token-string.mk" line 52: The string literal "UNDEF" is not empty. CondParser_Eval: " " -make: "cond-token-string.mk" line 54: The string literal " " is not empty, even though it consists of whitespace only. +make: "cond-token-string.mk" line 61: The string literal " " is not empty, even though it consists of whitespace only. CondParser_Eval: "${UNDEF}" -make: "cond-token-string.mk" line 63: An undefined variable in quotes expands to an empty string, which then evaluates to false. +make: "cond-token-string.mk" line 71: An undefined variable in quotes expands to an empty string, which then evaluates to false. CondParser_Eval: "${:Uvalue}" -make: "cond-token-string.mk" line 68: A nonempty variable expression evaluates to true. +make: "cond-token-string.mk" line 77: A nonempty variable expression evaluates to true. CondParser_Eval: "${:U}" -make: "cond-token-string.mk" line 76: An empty variable evaluates to false. +make: "cond-token-string.mk" line 86: An empty variable evaluates to false. CondParser_Eval: ("${VAR}") CondParser_Eval: "quoted" == quoted Comparing "quoted" == "quoted" diff --git a/usr.bin/make/unit-tests/cond-token-string.mk b/usr.bin/make/unit-tests/cond-token-string.mk index e4144a8bad8..7ecf3059e30 100644 --- a/usr.bin/make/unit-tests/cond-token-string.mk +++ b/usr.bin/make/unit-tests/cond-token-string.mk @@ -1,4 +1,4 @@ -# $NetBSD: cond-token-string.mk,v 1.7 2023/06/01 07:27:30 rillig Exp $ +# $NetBSD: cond-token-string.mk,v 1.8 2023/06/01 20:56:35 rillig Exp $ # # Tests for quoted string literals in .if conditions. # @@ -10,6 +10,8 @@ # 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" .if "" != "${:Uvalue:Z}" . error .else @@ -19,12 +21,14 @@ .if x${:Uvalue} . error .else +# expect+1: xvalue is not defined. . info xvalue is not defined. .endif # The 'x' produces a "Malformed conditional" since the left-hand side of a # comparison in an .if directive must be either a variable expression, a # quoted string literal or a number that starts with a digit. +# expect+1: Malformed conditional (x${:Uvalue} == "") .if x${:Uvalue} == "" . error .else @@ -34,6 +38,7 @@ # In plain words, a '\' can be used to escape any character, just as in # double-quoted string literals. See CondParser_String. .if \x${:Uvalue} == "xvalue" +# expect+1: Expected. . info Expected. .else . error @@ -43,6 +48,7 @@ # A string in quotes is checked whether it is not empty. .if "UNDEF" +# expect+1: The string literal "UNDEF" is not empty. . info The string literal "UNDEF" is not empty. .else . error @@ -51,6 +57,7 @@ # A space is not empty as well. # This differs from many other places where whitespace is trimmed. .if " " +# expect+1: The string literal " " is not empty, even though it consists of whitespace only. . info The string literal " " is not empty, even though it consists of $\ whitespace only. .else @@ -60,11 +67,13 @@ .if "${UNDEF}" . error .else +# expect+1: An undefined variable in quotes expands to an empty string, which then evaluates to false. . info An undefined variable in quotes expands to an empty string, which $\ then evaluates to false. .endif .if "${:Uvalue}" +# expect+1: A nonempty variable expression evaluates to true. . info A nonempty variable expression evaluates to true. .else . error @@ -73,6 +82,7 @@ .if "${:U}" . error .else +# expect+1: An empty variable evaluates to false. . info An empty variable evaluates to false. .endif diff --git a/usr.bin/make/unit-tests/cond-token-var.exp b/usr.bin/make/unit-tests/cond-token-var.exp index fcd92d12a3d..d84ca56e981 100644 --- a/usr.bin/make/unit-tests/cond-token-var.exp +++ b/usr.bin/make/unit-tests/cond-token-var.exp @@ -1,7 +1,7 @@ -make: "cond-token-var.mk" line 20: ok -make: "cond-token-var.mk" line 27: Malformed conditional (${UNDEF} == ${DEF}) -make: "cond-token-var.mk" line 33: Malformed conditional (${DEF} == ${UNDEF}) -make: "cond-token-var.mk" line 42: Malformed conditional (${UNDEF}) +make: "cond-token-var.mk" line 21: ok +make: "cond-token-var.mk" line 28: Malformed conditional (${UNDEF} == ${DEF}) +make: "cond-token-var.mk" line 34: Malformed conditional (${DEF} == ${UNDEF}) +make: "cond-token-var.mk" line 44: Malformed conditional (${UNDEF}) make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/cond-token-var.mk b/usr.bin/make/unit-tests/cond-token-var.mk index 168c63c46ac..b50c0439c12 100644 --- a/usr.bin/make/unit-tests/cond-token-var.mk +++ b/usr.bin/make/unit-tests/cond-token-var.mk @@ -1,4 +1,4 @@ -# $NetBSD: cond-token-var.mk,v 1.6 2021/04/25 21:05:38 rillig Exp $ +# $NetBSD: cond-token-var.mk,v 1.7 2023/06/01 20:56:35 rillig Exp $ # # Tests for variable expressions in .if conditions. # @@ -17,19 +17,20 @@ DEF= defined # A defined variable may appear on either side of the comparison. .if ${DEF} == ${DEF} +# expect+1: ok . info ok .else . error .endif # A variable that appears on the left-hand side must be defined. -# The following line thus generates a parse error. +# expect+1: Malformed conditional (${UNDEF} == ${DEF}) .if ${UNDEF} == ${DEF} . error .endif # A variable that appears on the right-hand side must be defined. -# The following line thus generates a parse error. +# expect+1: Malformed conditional (${DEF} == ${UNDEF}) .if ${DEF} == ${UNDEF} . error .endif @@ -39,6 +40,7 @@ DEF= defined .endif # An undefined variable on its own generates a parse error. +# expect+1: Malformed conditional (${UNDEF}) .if ${UNDEF} .endif diff --git a/usr.bin/make/unit-tests/cond-undef-lint.exp b/usr.bin/make/unit-tests/cond-undef-lint.exp index 55073b2116c..efab46113f6 100644 --- a/usr.bin/make/unit-tests/cond-undef-lint.exp +++ b/usr.bin/make/unit-tests/cond-undef-lint.exp @@ -1,10 +1,10 @@ -make: "cond-undef-lint.mk" line 23: Variable "UNDEF" is undefined -make: "cond-undef-lint.mk" line 23: Malformed conditional (${UNDEF}) -make: "cond-undef-lint.mk" line 38: Variable "UNDEF" is undefined -make: "cond-undef-lint.mk" line 38: Variable "VAR." is undefined -make: "cond-undef-lint.mk" line 38: Malformed conditional (${VAR.${UNDEF}}) -make: "cond-undef-lint.mk" line 49: Variable "VAR.defined" is undefined -make: "cond-undef-lint.mk" line 49: Malformed conditional (${VAR.${DEF}}) +make: "cond-undef-lint.mk" line 25: Variable "UNDEF" is undefined +make: "cond-undef-lint.mk" line 25: Malformed conditional (${UNDEF}) +make: "cond-undef-lint.mk" line 43: Variable "UNDEF" is undefined +make: "cond-undef-lint.mk" line 43: Variable "VAR." is undefined +make: "cond-undef-lint.mk" line 43: Malformed conditional (${VAR.${UNDEF}}) +make: "cond-undef-lint.mk" line 56: Variable "VAR.defined" is undefined +make: "cond-undef-lint.mk" line 56: Malformed conditional (${VAR.${DEF}}) make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/cond-undef-lint.mk b/usr.bin/make/unit-tests/cond-undef-lint.mk index 9dfd1bd5325..6fd353dc60e 100644 --- a/usr.bin/make/unit-tests/cond-undef-lint.mk +++ b/usr.bin/make/unit-tests/cond-undef-lint.mk @@ -1,4 +1,4 @@ -# $NetBSD: cond-undef-lint.mk,v 1.3 2020/11/15 14:58:14 rillig Exp $ +# $NetBSD: cond-undef-lint.mk,v 1.4 2023/06/01 20:56:35 rillig Exp $ # # Tests for defined and undefined variables in .if conditions, in lint mode. # @@ -20,6 +20,8 @@ DEF= defined .endif # Since the condition fails to evaluate, neither of the branches is taken. +# expect+2: Malformed conditional (${UNDEF}) +# expect+1: Variable "UNDEF" is undefined .if ${UNDEF} . error .else @@ -35,6 +37,9 @@ DEF= defined # # TODO: Suppress the error message "Variable VAR. is undefined". That part # of the expression must not be evaluated at all. +# expect+3: Variable "UNDEF" is undefined +# expect+2: Variable "VAR." is undefined +# expect+1: Malformed conditional (${VAR.${UNDEF}}) .if ${VAR.${UNDEF}} . error .else @@ -46,6 +51,8 @@ DEF= defined # TODO: This pattern looks a lot like CFLAGS.${OPSYS}, which is at least # debatable. Or would any practical use of CFLAGS.${OPSYS} be via an indirect # expression, as in the next example? +# expect+2: Variable "VAR.defined" is undefined +# expect+1: Malformed conditional (${VAR.${DEF}}) .if ${VAR.${DEF}} . error .else diff --git a/usr.bin/make/unit-tests/dep-colon-bug-cross-file.exp b/usr.bin/make/unit-tests/dep-colon-bug-cross-file.exp index 855b575c48b..a8ef9d0707a 100644 --- a/usr.bin/make/unit-tests/dep-colon-bug-cross-file.exp +++ b/usr.bin/make/unit-tests/dep-colon-bug-cross-file.exp @@ -1,4 +1,4 @@ -make: "dep-colon-bug-cross-file.mk" line 31: warning: duplicate script for target "all" ignored -make: "dep-colon-bug-cross-file.mk" line 40: warning: using previous script for "all" defined here +make: "dep-colon-bug-cross-file.mk" line 32: warning: duplicate script for target "all" ignored +make: "dep-colon-bug-cross-file.mk" line 42: warning: using previous script for "all" defined here : pass 1 exit status 0 diff --git a/usr.bin/make/unit-tests/dep-colon-bug-cross-file.mk b/usr.bin/make/unit-tests/dep-colon-bug-cross-file.mk index 57fbf478163..930358af287 100644 --- a/usr.bin/make/unit-tests/dep-colon-bug-cross-file.mk +++ b/usr.bin/make/unit-tests/dep-colon-bug-cross-file.mk @@ -1,4 +1,4 @@ -# $NetBSD: dep-colon-bug-cross-file.mk,v 1.4 2020/09/27 09:53:41 rillig Exp $ +# $NetBSD: dep-colon-bug-cross-file.mk,v 1.5 2023/06/01 20:56:35 rillig Exp $ # # Until 2020-09-25, the very last dependency group of a top-level makefile # was not finished properly. This made it possible to add further commands @@ -28,6 +28,7 @@ PASS?= 1 .if ${PASS} == 2 all: +# expect+1: warning: duplicate script for target "all" ignored : pass 2 .endif @@ -37,5 +38,6 @@ PASS= 2 .MAKEFLAGS: -f ${.PARSEDIR:q}/${.PARSEFILE:q} all: +# expect+1: warning: using previous script for "all" defined here : pass 1 .endif diff --git a/usr.bin/make/unit-tests/deptgt-begin.exp b/usr.bin/make/unit-tests/deptgt-begin.exp index abc80afe996..db4c7d7dfa1 100644 --- a/usr.bin/make/unit-tests/deptgt-begin.exp +++ b/usr.bin/make/unit-tests/deptgt-begin.exp @@ -1,5 +1,5 @@ -make: "deptgt-begin.mk" line 17: warning: duplicate script for target ".BEGIN" ignored -make: "deptgt-begin.mk" line 8: warning: using previous script for ".BEGIN" defined here +make: "deptgt-begin.mk" line 19: warning: duplicate script for target ".BEGIN" ignored +make: "deptgt-begin.mk" line 9: warning: using previous script for ".BEGIN" defined here : parse time : Making before-begin before .BEGIN. : .BEGIN diff --git a/usr.bin/make/unit-tests/deptgt-begin.mk b/usr.bin/make/unit-tests/deptgt-begin.mk index 543e377c05d..8b9842641a2 100644 --- a/usr.bin/make/unit-tests/deptgt-begin.mk +++ b/usr.bin/make/unit-tests/deptgt-begin.mk @@ -1,9 +1,10 @@ -# $NetBSD: deptgt-begin.mk,v 1.6 2022/05/07 08:01:20 rillig Exp $ +# $NetBSD: deptgt-begin.mk,v 1.7 2023/06/01 20:56:35 rillig Exp $ # # Tests for the special target .BEGIN in dependency declarations, # which is a container for commands that are run before any other # commands from the shell lines. +# expect+2: warning: using previous script for ".BEGIN" defined here .BEGIN: : $@ @@ -13,6 +14,7 @@ # add its commands after this. # # There are several ways to resolve this situation, which are detailed below. +# expect+2: warning: duplicate script for target ".BEGIN" ignored .BEGIN: : Making another $@. diff --git a/usr.bin/make/unit-tests/deptgt-delete_on_error.mk b/usr.bin/make/unit-tests/deptgt-delete_on_error.mk index e6d0610f467..2309e67c01a 100644 --- a/usr.bin/make/unit-tests/deptgt-delete_on_error.mk +++ b/usr.bin/make/unit-tests/deptgt-delete_on_error.mk @@ -1,4 +1,4 @@ - # $NetBSD: deptgt-delete_on_error.mk,v 1.3 2020/10/25 21:31:00 rillig Exp $ +# $NetBSD: deptgt-delete_on_error.mk,v 1.4 2023/06/01 20:56:35 rillig Exp $ # # Tests for the special target .DELETE_ON_ERROR in dependency declarations, # which controls whether the target is deleted if a shell command fails or diff --git a/usr.bin/make/unit-tests/deptgt.exp b/usr.bin/make/unit-tests/deptgt.exp index 73d4a7f0c33..00d312685de 100644 --- a/usr.bin/make/unit-tests/deptgt.exp +++ b/usr.bin/make/unit-tests/deptgt.exp @@ -1,17 +1,17 @@ -make: "deptgt.mk" line 10: warning: Extra target '.PHONY' ignored -make: "deptgt.mk" line 28: Unassociated shell command ": command3 # parse error, since targets == NULL" -Parsing line 34: ${:U}: empty-source -ParseDependency(: empty-source) -Parsing line 35: : command for empty targets list -Parsing line 36: : empty-source +make: "deptgt.mk" line 11: warning: Extra target '.PHONY' ignored +make: "deptgt.mk" line 30: Unassociated shell command ": command3 # parse error, since targets == NULL" +Parsing line 36: ${:U}: empty-source ParseDependency(: empty-source) Parsing line 37: : command for empty targets list -Parsing line 38: .MAKEFLAGS: -d0 +Parsing line 38: : empty-source +ParseDependency(: empty-source) +Parsing line 39: : command for empty targets list +Parsing line 40: .MAKEFLAGS: -d0 ParseDependency(.MAKEFLAGS: -d0) -make: "deptgt.mk" line 46: Unknown modifier "Z" -make: "deptgt.mk" line 49: warning: Extra target 'ordinary' ignored -make: "deptgt.mk" line 52: warning: Extra target (ordinary) ignored -make: "deptgt.mk" line 55: warning: Special and mundane targets don't mix. Mundane ones ignored +make: "deptgt.mk" line 49: 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 make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/deptgt.mk b/usr.bin/make/unit-tests/deptgt.mk index 7d43220e888..67c47e4909e 100644 --- a/usr.bin/make/unit-tests/deptgt.mk +++ b/usr.bin/make/unit-tests/deptgt.mk @@ -1,4 +1,4 @@ -# $NetBSD: deptgt.mk,v 1.13 2023/01/03 00:00:45 rillig Exp $ +# $NetBSD: deptgt.mk,v 1.14 2023/06/01 20:56:35 rillig Exp $ # # Tests for special targets like .BEGIN or .SUFFIXES in dependency # declarations. @@ -7,6 +7,7 @@ # Just in case anyone tries to compile several special targets in a single # dependency line: That doesn't work, and make immediately rejects it. +# expect+1: warning: Extra target '.PHONY' ignored .SUFFIXES .PHONY: .c.o # The following lines demonstrate how 'targets' is set and reset during @@ -25,6 +26,7 @@ target1 target2: sources # targets := [target1, target2] : command1 # targets == [target1, target2] : command2 # targets == [target1, target2] VAR=value # targets := NULL +# expect+1: Unassociated shell command ": command3 # parse error, since targets == NULL" : command3 # parse error, since targets == NULL # In a dependency declaration, the list of targets can be empty. @@ -43,6 +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" $$$$$$$${:U:Z}: # expect+1: warning: Extra target 'ordinary' ignored diff --git a/usr.bin/make/unit-tests/directive-elif.exp b/usr.bin/make/unit-tests/directive-elif.exp index 6856494023d..15dd6bf1430 100644 --- a/usr.bin/make/unit-tests/directive-elif.exp +++ b/usr.bin/make/unit-tests/directive-elif.exp @@ -1,21 +1,21 @@ -make: "directive-elif.mk" line 47: Unknown directive "elsif" -make: "directive-elif.mk" line 52: This branch is taken. -make: "directive-elif.mk" line 60: Unknown directive "elsif" -make: "directive-elif.mk" line 63: This branch is taken. -make: "directive-elif.mk" line 69: This branch is taken. -make: "directive-elif.mk" line 89: Unknown directive "elsif" -make: "directive-elif.mk" line 90: This misspelling is detected. -make: "directive-elif.mk" line 91: This branch is taken because of the .else. -make: "directive-elif.mk" line 109: What happens on misspelling in a skipped branch? -make: "directive-elif.mk" line 119: else -make: "directive-elif.mk" line 122: What happens on misspelling in a taken branch? -make: "directive-elif.mk" line 124: 1-then -make: "directive-elif.mk" line 125: Unknown directive "elsif" -make: "directive-elif.mk" line 126: 1-elsif -make: "directive-elif.mk" line 127: Unknown directive "elsif" -make: "directive-elif.mk" line 128: 2-elsif -make: "directive-elif.mk" line 134: if-less elif -make: "directive-elif.mk" line 139: warning: extra elif +make: "directive-elif.mk" line 48: Unknown directive "elsif" +make: "directive-elif.mk" line 54: This branch is taken. +make: "directive-elif.mk" line 62: Unknown directive "elsif" +make: "directive-elif.mk" line 66: This branch is taken. +make: "directive-elif.mk" line 73: This branch is taken. +make: "directive-elif.mk" line 94: Unknown directive "elsif" +make: "directive-elif.mk" line 96: This misspelling is detected. +make: "directive-elif.mk" line 98: This branch is taken because of the .else. +make: "directive-elif.mk" line 117: What happens on misspelling in a skipped branch? +make: "directive-elif.mk" line 128: else +make: "directive-elif.mk" line 132: What happens on misspelling in a taken branch? +make: "directive-elif.mk" line 135: 1-then +make: "directive-elif.mk" line 137: Unknown directive "elsif" +make: "directive-elif.mk" line 139: 1-elsif +make: "directive-elif.mk" line 141: Unknown directive "elsif" +make: "directive-elif.mk" line 143: 2-elsif +make: "directive-elif.mk" line 149: if-less elif +make: "directive-elif.mk" line 154: warning: extra elif make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/directive-elif.mk b/usr.bin/make/unit-tests/directive-elif.mk index e7b89beec4e..d6500cc1e87 100644 --- a/usr.bin/make/unit-tests/directive-elif.mk +++ b/usr.bin/make/unit-tests/directive-elif.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-elif.mk,v 1.7 2020/12/19 19:49:01 rillig Exp $ +# $NetBSD: directive-elif.mk,v 1.8 2023/06/01 20:56:35 rillig Exp $ # # Tests for the .elif directive. # @@ -44,28 +44,32 @@ # Misspelling '.elsif' below an .if branch that is taken. .if 1 # This misspelling is in an active branch and is therefore detected. +# expect+1: Unknown directive "elsif" .elsif 0 # The only thing that make detects here is a misspelled directive, make # doesn't recognize that it was meant to be a conditional directive. # Therefore the branch continues here, even though the '.elsif' condition # evaluates to false. +# expect+1: This branch is taken. . info This branch is taken. .endif # Misspelling '.elsif' below an .if branch that is taken. .if 1 -# As of 2020-12-19, the misspelling is in an active branch and is therefore -# detected. +# The misspelling is in an active branch and is therefore detected. +# expect+1: Unknown directive "elsif" .elsif 1 # Since both conditions evaluate to true, this branch is taken no matter # whether make detects a misspelling or not. +# expect+1: This branch is taken. . info This branch is taken. .endif # Misspelling '.elsif' in a skipped branch below a branch that was taken. .if 1 +# expect+1: This branch is taken. . info This branch is taken. .elif 0 . info This branch is not taken. @@ -86,8 +90,11 @@ # Misspelling '.elsif' in an .else branch that is taken. .if 0 .else +# expect+1: Unknown directive "elsif" .elsif 1 +# expect+1: This misspelling is detected. . info This misspelling is detected. +# expect+1: This branch is taken because of the .else. . info This branch is taken because of the .else. .endif @@ -106,6 +113,7 @@ .endif +# expect+1: What happens on misspelling in a skipped branch? .info What happens on misspelling in a skipped branch? .if 0 . info 0-then @@ -116,26 +124,33 @@ . info XXX: This misspelling is not detected. . info 2-elsif .else +# expect+1: else . info else .endif +# expect+1: What happens on misspelling in a taken branch? .info What happens on misspelling in a taken branch? .if 1 +# expect+1: 1-then . info 1-then +# expect+1: Unknown directive "elsif" .elsif 1 +# expect+1: 1-elsif . info 1-elsif +# expect+1: Unknown directive "elsif" .elsif 2 +# expect+1: 2-elsif . info 2-elsif .else . info else .endif -# Expect: "if-less elif" +# expect+1: if-less elif .elif 0 .if 1 .else -# Expect: "warning: extra elif" +# expect+1: warning: extra elif .elif .endif diff --git a/usr.bin/make/unit-tests/directive-else.exp b/usr.bin/make/unit-tests/directive-else.exp index 17d5571ba74..992b60e9308 100644 --- a/usr.bin/make/unit-tests/directive-else.exp +++ b/usr.bin/make/unit-tests/directive-else.exp @@ -1,11 +1,11 @@ make: "directive-else.mk" line 14: The .else directive does not take arguments -make: "directive-else.mk" line 15: ok -make: "directive-else.mk" line 19: ok -make: "directive-else.mk" line 21: The .else directive does not take arguments -make: "directive-else.mk" line 26: if-less else -make: "directive-else.mk" line 32: ok -make: "directive-else.mk" line 33: warning: extra else -make: "directive-else.mk" line 45: The .else directive does not take arguments +make: "directive-else.mk" line 16: ok +make: "directive-else.mk" line 21: ok +make: "directive-else.mk" line 23: The .else directive does not take arguments +make: "directive-else.mk" line 29: if-less else +make: "directive-else.mk" line 36: ok +make: "directive-else.mk" line 38: warning: extra else +make: "directive-else.mk" line 51: The .else directive does not take arguments make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/directive-else.mk b/usr.bin/make/unit-tests/directive-else.mk index 794057110ef..41b38a14a6c 100644 --- a/usr.bin/make/unit-tests/directive-else.mk +++ b/usr.bin/make/unit-tests/directive-else.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-else.mk,v 1.7 2020/12/14 22:17:11 rillig Exp $ +# $NetBSD: directive-else.mk,v 1.8 2023/06/01 20:56:35 rillig Exp $ # # Tests for the .else directive. # @@ -10,26 +10,31 @@ .if 0 . warning must not be reached -# The .else directive does not take any arguments. +# expect+1: The .else directive does not take arguments .else 123 +# expect+1: ok . info ok .endif .if 1 +# expect+1: ok . info ok -# The .else directive does not take any arguments. +# expect+1: The .else directive does not take arguments .else 123 . warning must not be reached .endif # An .else without a corresponding .if is an error. +# expect+1: if-less else .else # Accidental extra .else directives are detected too. .if 0 . warning must not be reached .else +# expect+1: ok . info ok +# expect+1: warning: extra else .else . info After an extra .else, everything is skipped. .endif @@ -42,6 +47,7 @@ # A variable expression does count as an argument, even if it is empty. .if 0 +# expect+1: The .else directive does not take arguments .else ${:U} .endif diff --git a/usr.bin/make/unit-tests/directive-endfor.exp b/usr.bin/make/unit-tests/directive-endfor.exp index 7e243a8f67e..8b77c0b3130 100644 --- a/usr.bin/make/unit-tests/directive-endfor.exp +++ b/usr.bin/make/unit-tests/directive-endfor.exp @@ -1,4 +1,4 @@ -make: "directive-endfor.mk" line 9: for-less endfor +make: "directive-endfor.mk" line 10: for-less endfor make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/directive-endfor.mk b/usr.bin/make/unit-tests/directive-endfor.mk index b0c37f38850..93119156fb8 100644 --- a/usr.bin/make/unit-tests/directive-endfor.mk +++ b/usr.bin/make/unit-tests/directive-endfor.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-endfor.mk,v 1.1 2020/12/30 14:50:08 rillig Exp $ +# $NetBSD: directive-endfor.mk,v 1.2 2023/06/01 20:56:35 rillig Exp $ # # Test for the directive .endfor, which ends a .for loop. # @@ -6,4 +6,5 @@ # directive-for.mk # An .endfor without a corresponding .for is a parse error. +# expect+1: for-less endfor .endfor diff --git a/usr.bin/make/unit-tests/directive-endif.exp b/usr.bin/make/unit-tests/directive-endif.exp index 4b4b5ae88d4..c88cc97c44c 100644 --- a/usr.bin/make/unit-tests/directive-endif.exp +++ b/usr.bin/make/unit-tests/directive-endif.exp @@ -1,8 +1,8 @@ -make: "directive-endif.mk" line 18: The .endif directive does not take arguments -make: "directive-endif.mk" line 23: The .endif directive does not take arguments -make: "directive-endif.mk" line 34: The .endif directive does not take arguments -make: "directive-endif.mk" line 41: The .endif directive does not take arguments -make: "directive-endif.mk" line 46: Unknown directive "endifx" +make: "directive-endif.mk" line 16: The .endif directive does not take arguments +make: "directive-endif.mk" line 21: The .endif directive does not take arguments +make: "directive-endif.mk" line 32: The .endif directive does not take arguments +make: "directive-endif.mk" line 39: The .endif directive does not take arguments +make: "directive-endif.mk" line 44: Unknown directive "endifx" make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/directive-endif.mk b/usr.bin/make/unit-tests/directive-endif.mk index 7d707e7c779..5e01382af5f 100644 --- a/usr.bin/make/unit-tests/directive-endif.mk +++ b/usr.bin/make/unit-tests/directive-endif.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-endif.mk,v 1.6 2023/06/01 07:27:30 rillig Exp $ +# $NetBSD: directive-endif.mk,v 1.7 2023/06/01 20:56:35 rillig Exp $ # # Tests for the .endif directive. # @@ -8,8 +8,6 @@ # See also: # Cond_EvalLine -# expect-all - .MAKEFLAGS: -dL .if 0 diff --git a/usr.bin/make/unit-tests/directive-error.exp b/usr.bin/make/unit-tests/directive-error.exp index bad12326a51..8ce33160e67 100644 --- a/usr.bin/make/unit-tests/directive-error.exp +++ b/usr.bin/make/unit-tests/directive-error.exp @@ -1,4 +1,4 @@ -make: "directive-error.mk" line 13: message +make: "directive-error.mk" line 14: message make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/directive-error.mk b/usr.bin/make/unit-tests/directive-error.mk index 135db2159dd..f35a9da3a01 100644 --- a/usr.bin/make/unit-tests/directive-error.mk +++ b/usr.bin/make/unit-tests/directive-error.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-error.mk,v 1.5 2021/01/27 00:02:38 rillig Exp $ +# $NetBSD: directive-error.mk,v 1.6 2023/06/01 20:56:35 rillig Exp $ # # Tests for the .error directive, which prints an error message and exits # immediately, unlike other "fatal" parse errors, which continue to parse @@ -10,4 +10,5 @@ # Before parse.c 1.532 from 2021-01-27, the ".error" issued an irrelevant # message saying "parsing warnings being treated as errors". .MAKEFLAGS: -W +# expect+1: message .error message diff --git a/usr.bin/make/unit-tests/directive-for-break.exp b/usr.bin/make/unit-tests/directive-for-break.exp index 94549576668..64941448141 100644 --- a/usr.bin/make/unit-tests/directive-for-break.exp +++ b/usr.bin/make/unit-tests/directive-for-break.exp @@ -1,5 +1,5 @@ -make: "directive-for-break.mk" line 47: break outside of for loop -make: "directive-for-break.mk" line 67: The .break directive does not take arguments +make: "directive-for-break.mk" line 45: break outside of for loop +make: "directive-for-break.mk" line 65: The .break directive does not take arguments make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/directive-for-break.mk b/usr.bin/make/unit-tests/directive-for-break.mk index f9d1b527475..d9290d38c21 100644 --- a/usr.bin/make/unit-tests/directive-for-break.mk +++ b/usr.bin/make/unit-tests/directive-for-break.mk @@ -1,10 +1,8 @@ -# $NetBSD: directive-for-break.mk,v 1.4 2023/06/01 06:25:34 rillig Exp $ +# $NetBSD: directive-for-break.mk,v 1.5 2023/06/01 20:56:35 rillig Exp $ # # Tests for .break in .for loops, which immediately terminates processing of # the surrounding .for loop. -# expect-all - # .break terminates the loop early. # This is usually done within a conditional. diff --git a/usr.bin/make/unit-tests/directive-for-empty.exp b/usr.bin/make/unit-tests/directive-for-empty.exp index b20a3d3e9a1..5cc3ac846b3 100644 --- a/usr.bin/make/unit-tests/directive-for-empty.exp +++ b/usr.bin/make/unit-tests/directive-for-empty.exp @@ -1,7 +1,7 @@ -make: "directive-for-empty.mk" line 21: 2 -make: "directive-for-empty.mk" line 34: Missing argument for ".error" -make: "directive-for-empty.mk" line 34: Missing argument for ".error" -make: "directive-for-empty.mk" line 34: Missing argument for ".error" +make: "directive-for-empty.mk" line 22: 2 +make: "directive-for-empty.mk" line 38: Missing argument for ".error" +make: "directive-for-empty.mk" line 38: Missing argument for ".error" +make: "directive-for-empty.mk" line 38: Missing argument for ".error" For: end for 1 For: loop body with i = value: # The identifier 'empty' can only be used in conditions such as .if, .ifdef or diff --git a/usr.bin/make/unit-tests/directive-for-empty.mk b/usr.bin/make/unit-tests/directive-for-empty.mk index 7f22a822ef7..52a65b39bee 100644 --- a/usr.bin/make/unit-tests/directive-for-empty.mk +++ b/usr.bin/make/unit-tests/directive-for-empty.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-for-empty.mk,v 1.1 2022/05/23 22:33:56 rillig Exp $ +# $NetBSD: directive-for-empty.mk,v 1.2 2023/06/01 20:56:35 rillig Exp $ # # Tests for .for loops containing conditions of the form 'empty(var:...)'. # @@ -18,6 +18,7 @@ # when in fact they aren't. .for i in 11 12 13 . if ${i:M*2*} +# expect+1: 2 .info 2 . endif .endfor @@ -31,6 +32,9 @@ # Asking for an empty iteration variable does not make sense as the .for loop # splits the iteration items into words, and such a word cannot be empty. . if empty(i) +# expect+3: Missing argument for ".error" +# expect+2: Missing argument for ".error" +# expect+1: Missing argument for ".error" . error # due to the leaky abstraction . endif # The typical way of using 'empty' with variables from .for loops is pattern diff --git a/usr.bin/make/unit-tests/directive-for-errors.exp b/usr.bin/make/unit-tests/directive-for-errors.exp index 36ed569c793..115a6af5b06 100644 --- a/usr.bin/make/unit-tests/directive-for-errors.exp +++ b/usr.bin/make/unit-tests/directive-for-errors.exp @@ -1,17 +1,17 @@ -make: "directive-for-errors.mk" line 11: Unknown directive "fori" -make: "directive-for-errors.mk" line 12: warning: <> -make: "directive-for-errors.mk" line 13: for-less endfor -make: "directive-for-errors.mk" line 27: Unknown directive "for" -make: "directive-for-errors.mk" line 28: warning: <> -make: "directive-for-errors.mk" line 29: for-less endfor -make: "directive-for-errors.mk" line 46: invalid character '$' in .for loop variable name -make: "directive-for-errors.mk" line 54: no iteration variables in for -make: "directive-for-errors.mk" line 66: Wrong number of words (5) in .for substitution list with 3 variables -make: "directive-for-errors.mk" line 80: missing `in' in for -make: "directive-for-errors.mk" line 91: Unknown modifier "Z" -make: "directive-for-errors.mk" line 92: warning: Should not be reached. -make: "directive-for-errors.mk" line 92: warning: Should not be reached. -make: "directive-for-errors.mk" line 92: warning: Should not be reached. +make: "directive-for-errors.mk" line 9: Unknown directive "fori" +make: "directive-for-errors.mk" line 10: warning: <> +make: "directive-for-errors.mk" line 11: for-less endfor +make: "directive-for-errors.mk" line 25: Unknown directive "for" +make: "directive-for-errors.mk" line 26: warning: <> +make: "directive-for-errors.mk" line 27: for-less endfor +make: "directive-for-errors.mk" line 44: invalid character '$' in .for loop variable name +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 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. make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/directive-for-errors.mk b/usr.bin/make/unit-tests/directive-for-errors.mk index 24df5e13183..0af65350e64 100644 --- a/usr.bin/make/unit-tests/directive-for-errors.mk +++ b/usr.bin/make/unit-tests/directive-for-errors.mk @@ -1,9 +1,7 @@ -# $NetBSD: directive-for-errors.mk,v 1.5 2023/05/09 19:43:12 rillig Exp $ +# $NetBSD: directive-for-errors.mk,v 1.6 2023/06/01 20:56:35 rillig Exp $ # # Tests for error handling in .for loops. -# expect-all - # A .for directive must be followed by whitespace, everything else results # in a parse error. diff --git a/usr.bin/make/unit-tests/directive-for-escape.exp b/usr.bin/make/unit-tests/directive-for-escape.exp index e12c7226906..1f6c6bcc310 100644 --- a/usr.bin/make/unit-tests/directive-for-escape.exp +++ b/usr.bin/make/unit-tests/directive-for-escape.exp @@ -2,28 +2,28 @@ For: end for 1 For: loop body with chars = !"#$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~: . info ${:U!"#$%&'()*+,-./0-9\:;<=>?@A-Z[\\]_^a-z{|\}~} make: Unclosed variable expression, expecting '}' for modifier "U!"" of variable "" with value "!"" -make: "directive-for-escape.mk" line 21: !" +make: "directive-for-escape.mk" line 19: !" For: end for 1 For: loop body with chars = !"\\#$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~: . info ${:U!"\\\\#$%&'()*+,-./0-9\:;<=>?@A-Z[\\]_^a-z{|\}~} make: Unclosed variable expression, expecting '}' for modifier "U!"\\\\" of variable "" with value "!"\\" -make: "directive-for-escape.mk" line 32: !"\\ +make: "directive-for-escape.mk" line 30: !"\\ For: end for 1 For: loop body with i = $: . info ${:U\$} -make: "directive-for-escape.mk" line 47: $ +make: "directive-for-escape.mk" line 45: $ For: loop body with i = ${V}: . info ${:U${V}} -make: "directive-for-escape.mk" line 47: value +make: "directive-for-escape.mk" line 45: value For: loop body with i = ${V:=-with-modifier}: . info ${:U${V:=-with-modifier}} -make: "directive-for-escape.mk" line 47: value-with-modifier +make: "directive-for-escape.mk" line 45: value-with-modifier For: loop body with i = $(V): . info ${:U$(V)} -make: "directive-for-escape.mk" line 47: value +make: "directive-for-escape.mk" line 45: value For: loop body with i = $(V:=-with-modifier): . info ${:U$(V:=-with-modifier)} -make: "directive-for-escape.mk" line 47: value-with-modifier +make: "directive-for-escape.mk" line 45: value-with-modifier For: end for 1 For: loop body with i = ${UNDEF:U\$\$: # ${:U\${UNDEF\:U\\$\\$} @@ -34,24 +34,24 @@ For: loop body with i = end}: For: end for 1 For: loop body with i = ${UNDEF:U\$\$: . info ${:U\${UNDEF\:U\\$\\$} -make: "directive-for-escape.mk" line 101: ${UNDEF:U\backslash$ +make: "directive-for-escape.mk" line 99: ${UNDEF:U\backslash$ For: loop body with i = {{}}: . info ${:U{{\}\}} -make: "directive-for-escape.mk" line 101: {{}} +make: "directive-for-escape.mk" line 99: {{}} For: loop body with i = end}: . info ${:Uend\}} -make: "directive-for-escape.mk" line 101: end} +make: "directive-for-escape.mk" line 99: end} For: end for 1 For: loop body with i = begin<${UNDEF:Ufallback:N{{{}}}}>end: . info ${:Ubegin<${UNDEF:Ufallback:N{{{}}}}>end} -make: "directive-for-escape.mk" line 122: begin<fallback>end +make: "directive-for-escape.mk" line 120: begin<fallback>end For: end for 1 For: loop body with i = $: . info ${:U\$} -make: "directive-for-escape.mk" line 131: $ -make: "directive-for-escape.mk" line 140: invalid character ':' in .for loop variable name +make: "directive-for-escape.mk" line 129: $ +make: "directive-for-escape.mk" line 138: invalid character ':' in .for loop variable name For: end for 1 -make: "directive-for-escape.mk" line 150: invalid character '}' in .for loop variable name +make: "directive-for-escape.mk" line 148: invalid character '}' in .for loop variable name For: end for 1 For: end for 1 For: loop body with i = inner: @@ -65,45 +65,45 @@ For: loop body with i = inner: . info . $${i2}: ${i2} . info . $${i,}: ${i,} . info . adjacent: ${:Uinner}${:Uinner}${:Uinner:M*}${:Uinner} -make: "directive-for-escape.mk" line 159: . $i: inner -make: "directive-for-escape.mk" line 160: . ${i}: inner -make: "directive-for-escape.mk" line 161: . ${i:M*}: inner -make: "directive-for-escape.mk" line 162: . $(i): inner -make: "directive-for-escape.mk" line 163: . $(i:M*): inner -make: "directive-for-escape.mk" line 164: . ${i${:U}}: outer -make: "directive-for-escape.mk" line 165: . ${i\}}: inner} -make: "directive-for-escape.mk" line 166: . ${i2}: two -make: "directive-for-escape.mk" line 167: . ${i,}: comma -make: "directive-for-escape.mk" line 168: . adjacent: innerinnerinnerinner -make: "directive-for-escape.mk" line 187: invalid character '$' in .for loop variable name -For: end for 1 -make: "directive-for-escape.mk" line 199: eight and no cents. -For: end for 1 -make: "directive-for-escape.mk" line 212: newline in .for value -make: "directive-for-escape.mk" line 212: newline in .for value +make: "directive-for-escape.mk" line 157: . $i: inner +make: "directive-for-escape.mk" line 158: . ${i}: inner +make: "directive-for-escape.mk" line 159: . ${i:M*}: inner +make: "directive-for-escape.mk" line 160: . $(i): inner +make: "directive-for-escape.mk" line 161: . $(i:M*): inner +make: "directive-for-escape.mk" line 162: . ${i${:U}}: outer +make: "directive-for-escape.mk" line 163: . ${i\}}: inner} +make: "directive-for-escape.mk" line 164: . ${i2}: two +make: "directive-for-escape.mk" line 165: . ${i,}: comma +make: "directive-for-escape.mk" line 166: . adjacent: innerinnerinnerinner +make: "directive-for-escape.mk" line 185: invalid character '$' in .for loop variable name +For: end for 1 +make: "directive-for-escape.mk" line 197: eight and no cents. +For: end for 1 +make: "directive-for-escape.mk" line 210: newline in .for value +make: "directive-for-escape.mk" line 210: newline in .for value For: loop body with i = " ": . info short: ${:U" "} . info long: ${:U" "} -make: "directive-for-escape.mk" line 213: short: " " -make: "directive-for-escape.mk" line 214: long: " " +make: "directive-for-escape.mk" line 211: short: " " +make: "directive-for-escape.mk" line 212: long: " " For: end for 1 For: loop body with i = " ": For: end for 1 -Parse_PushInput: .for loop in directive-for-escape.mk, line 230 -make: "directive-for-escape.mk" line 230: newline in .for value - in .for loop from directive-for-escape.mk:230 with i = " +Parse_PushInput: .for loop in directive-for-escape.mk, line 228 +make: "directive-for-escape.mk" line 228: newline in .for value + in .for loop from directive-for-escape.mk:228 with i = " " For: loop body with i = " ": : ${:U" "} SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `directive-for-escape.mk' -Parsing line 231: : ${:U" "} +Parsing line 229: : ${:U" "} ParseDependency(: " ") -ParseEOF: returning to file directive-for-escape.mk, line 233 +ParseEOF: returning to file directive-for-escape.mk, line 231 SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `directive-for-escape.mk' -Parsing line 233: .MAKEFLAGS: -d0 +Parsing line 231: .MAKEFLAGS: -d0 ParseDependency(.MAKEFLAGS: -d0) For: end for 1 For: loop body with i = #: diff --git a/usr.bin/make/unit-tests/directive-for-escape.mk b/usr.bin/make/unit-tests/directive-for-escape.mk index 5bb676eb1ea..aa0d2504f94 100644 --- a/usr.bin/make/unit-tests/directive-for-escape.mk +++ b/usr.bin/make/unit-tests/directive-for-escape.mk @@ -1,11 +1,9 @@ -# $NetBSD: directive-for-escape.mk,v 1.19 2023/06/01 09:02:14 rillig Exp $ +# $NetBSD: directive-for-escape.mk,v 1.20 2023/06/01 20:56:35 rillig Exp $ # # Test escaping of special characters in the iteration values of a .for loop. # These values get expanded later using the :U variable modifier, and this # escaping and unescaping must pass all characters and strings unmodified. -# expect-all - .MAKEFLAGS: -df # Even though the .for loops take quotes into account when splitting the diff --git a/usr.bin/make/unit-tests/directive-for-generating-endif.exp b/usr.bin/make/unit-tests/directive-for-generating-endif.exp index 5f57f89c250..ecdeb096220 100644 --- a/usr.bin/make/unit-tests/directive-for-generating-endif.exp +++ b/usr.bin/make/unit-tests/directive-for-generating-endif.exp @@ -1,7 +1,7 @@ -make: "directive-for-generating-endif.mk" line 21: if-less endif -make: "directive-for-generating-endif.mk" line 21: if-less endif -make: "directive-for-generating-endif.mk" line 21: if-less endif -make: "directive-for-generating-endif.mk" line 26: 3 open conditionals +make: "directive-for-generating-endif.mk" line 24: if-less endif +make: "directive-for-generating-endif.mk" line 24: if-less endif +make: "directive-for-generating-endif.mk" line 24: if-less endif +make: "directive-for-generating-endif.mk" line 30: 3 open conditionals make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/directive-for-generating-endif.mk b/usr.bin/make/unit-tests/directive-for-generating-endif.mk index b4d70955100..3079ad3353c 100644 --- a/usr.bin/make/unit-tests/directive-for-generating-endif.mk +++ b/usr.bin/make/unit-tests/directive-for-generating-endif.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-for-generating-endif.mk,v 1.1 2020/08/29 18:50:25 rillig Exp $ +# $NetBSD: directive-for-generating-endif.mk,v 1.2 2023/06/01 20:56:35 rillig Exp $ # # Test whether a .for loop can be used to generate multiple .endif # directives to close nested .if directives. Depending on the exact @@ -18,8 +18,12 @@ . if 2 . if 3 .for i in 3 2 1 +# expect+3: if-less endif +# expect+2: if-less endif +# expect+1: if-less endif .endif .endfor all: @:; +# expect+1: 3 open conditionals diff --git a/usr.bin/make/unit-tests/directive-for-if.exp b/usr.bin/make/unit-tests/directive-for-if.exp index 85bfc484856..f30171f4db8 100644 --- a/usr.bin/make/unit-tests/directive-for-if.exp +++ b/usr.bin/make/unit-tests/directive-for-if.exp @@ -1,6 +1,6 @@ -make: "directive-for-if.mk" line 48: if-less endif -make: "directive-for-if.mk" line 48: if-less endif -make: "directive-for-if.mk" line 48: if-less endif +make: "directive-for-if.mk" line 51: if-less endif +make: "directive-for-if.mk" line 51: if-less endif +make: "directive-for-if.mk" line 51: if-less endif VAR1 VAR3 make: Fatal errors encountered -- cannot continue diff --git a/usr.bin/make/unit-tests/directive-for-if.mk b/usr.bin/make/unit-tests/directive-for-if.mk index 8d73e8ae8c4..f2d0b550c69 100644 --- a/usr.bin/make/unit-tests/directive-for-if.mk +++ b/usr.bin/make/unit-tests/directive-for-if.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-for-if.mk,v 1.1 2021/08/30 17:08:13 rillig Exp $ +# $NetBSD: directive-for-if.mk,v 1.2 2023/06/01 20:56:35 rillig Exp $ # # Test for a .for directive that contains an .if directive. # @@ -45,6 +45,9 @@ # expanded to their bare textual value. .for directive in if ifdef ifndef . ${directive} "1" != "0" +# expect+3: if-less endif +# expect+2: if-less endif +# expect+1: if-less endif . endif .endfor # In 2021, the above code does not generate an error message, even though the diff --git a/usr.bin/make/unit-tests/directive-for-lines.exp b/usr.bin/make/unit-tests/directive-for-lines.exp index 7aeaaa4a700..857b4829083 100644 --- a/usr.bin/make/unit-tests/directive-for-lines.exp +++ b/usr.bin/make/unit-tests/directive-for-lines.exp @@ -1,9 +1,9 @@ -make: "directive-for-lines.mk" line 23: expect 23 -make: "directive-for-lines.mk" line 23: expect 23 -make: "directive-for-lines.mk" line 30: expect 30 -make: "directive-for-lines.mk" line 23: expect 23 -make: "directive-for-lines.mk" line 23: expect 23 -make: "directive-for-lines.mk" line 30: expect 30 +make: "directive-for-lines.mk" line 27: expect 23 +make: "directive-for-lines.mk" line 27: expect 23 +make: "directive-for-lines.mk" line 36: expect 30 +make: "directive-for-lines.mk" line 27: expect 23 +make: "directive-for-lines.mk" line 27: expect 23 +make: "directive-for-lines.mk" line 36: expect 30 make: no target to make. make: stopped in unit-tests diff --git a/usr.bin/make/unit-tests/directive-for-lines.mk b/usr.bin/make/unit-tests/directive-for-lines.mk index 648c6112daf..cae4e0a3889 100644 --- a/usr.bin/make/unit-tests/directive-for-lines.mk +++ b/usr.bin/make/unit-tests/directive-for-lines.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-for-lines.mk,v 1.4 2022/05/08 06:51:27 rillig Exp $ +# $NetBSD: directive-for-lines.mk,v 1.5 2023/06/01 20:56:35 rillig Exp $ # # Tests for the line numbers that are reported in .for loops. # @@ -20,6 +20,10 @@ VAR= \ multi-line +# expect+4: expect 23 +# expect+3: expect 23 +# expect+2: expect 23 +# expect+1: expect 23 .info expect 23 .endfor @@ -27,6 +31,8 @@ VAR= \ # comment \ # continued comment +# expect+2: expect 30 +# expect+1: expect 30 .info expect 30 .endfor diff --git a/usr.bin/make/unit-tests/directive-for.exp b/usr.bin/make/unit-tests/directive-for.exp index e3184ebe7b8..7f37da4ef36 100644 --- a/usr.bin/make/unit-tests/directive-for.exp +++ b/usr.bin/make/unit-tests/directive-for.exp @@ -1,30 +1,30 @@ -make: "directive-for.mk" line 119: outer -make: "directive-for.mk" line 137: a:\ a:\file.txt -make: "directive-for.mk" line 137: d:\\ -make: "directive-for.mk" line 137: d:\\file.txt -make: "directive-for.mk" line 148: ( ( ( -make: "directive-for.mk" line 148: [ [ [ -make: "directive-for.mk" line 148: { { { -make: "directive-for.mk" line 148: ) ) ) -make: "directive-for.mk" line 148: ] ] ] -make: "directive-for.mk" line 148: } } } -make: "directive-for.mk" line 148: (()) (()) (()) -make: "directive-for.mk" line 148: [[]] [[]] [[]] -make: "directive-for.mk" line 148: {{}} {{}} {{}} -make: "directive-for.mk" line 148: )( )( )( -make: "directive-for.mk" line 148: ][ ][ ][ -make: "directive-for.mk" line 148: }{ }{ }{ -make: "directive-for.mk" line 168: invalid character ':' in .for loop variable name -make: "directive-for.mk" line 175: invalid character '$' in .for loop variable name -make: "directive-for.mk" line 187: invalid character '$' in .for loop variable name -make: "directive-for.mk" line 198: Unknown modifier "Z" -make: "directive-for.mk" line 199: XXX: Not reached word1 -make: "directive-for.mk" line 199: XXX: Not reached word3 -make: "directive-for.mk" line 206: no iteration variables in for -make: "directive-for.mk" line 232: 1 open conditional -make: "directive-for.mk" line 248: for-less endfor -make: "directive-for.mk" line 249: if-less endif -make: "directive-for.mk" line 257: if-less endif +make: "directive-for.mk" line 117: outer +make: "directive-for.mk" line 135: a:\ a:\file.txt +make: "directive-for.mk" line 135: d:\\ +make: "directive-for.mk" line 135: d:\\file.txt +make: "directive-for.mk" line 146: ( ( ( +make: "directive-for.mk" line 146: [ [ [ +make: "directive-for.mk" line 146: { { { +make: "directive-for.mk" line 146: ) ) ) +make: "directive-for.mk" line 146: ] ] ] +make: "directive-for.mk" line 146: } } } +make: "directive-for.mk" line 146: (()) (()) (()) +make: "directive-for.mk" line 146: [[]] [[]] [[]] +make: "directive-for.mk" line 146: {{}} {{}} {{}} +make: "directive-for.mk" line 146: )( )( )( +make: "directive-for.mk" line 146: ][ ][ ][ +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 196: Unknown modifier "Z" +make: "directive-for.mk" line 197: XXX: Not reached word1 +make: "directive-for.mk" line 197: XXX: Not reached word3 +make: "directive-for.mk" line 204: no iteration variables in for +make: "directive-for.mk" line 230: 1 open conditional +make: "directive-for.mk" line 246: for-less endfor +make: "directive-for.mk" line 247: if-less endif +make: "directive-for.mk" line 255: if-less endif For: new loop 2 For: end for 2 For: end for 1 @@ -35,7 +35,7 @@ For: loop body with outer = o: endfor For: end for 1 For: loop body with inner = i: -make: "directive-for.mk" line 305: newline-item=(a) +make: "directive-for.mk" line 303: newline-item=(a) make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/directive-for.mk b/usr.bin/make/unit-tests/directive-for.mk index e90e32dc0c4..22b9f78e5fe 100644 --- a/usr.bin/make/unit-tests/directive-for.mk +++ b/usr.bin/make/unit-tests/directive-for.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-for.mk,v 1.21 2023/06/01 07:27:30 rillig Exp $ +# $NetBSD: directive-for.mk,v 1.22 2023/06/01 20:56:35 rillig Exp $ # # Tests for the .for directive. # @@ -12,8 +12,6 @@ # See also: # varmod-loop.mk The ':@var@...@' modifier -# expect-all - # A typical use case for a .for loop is to populate a variable with a list of # values depending on other variables. In simple cases, the same effect can # be achieved using the ':@var@${var}@' modifier. diff --git a/usr.bin/make/unit-tests/directive-if.exp b/usr.bin/make/unit-tests/directive-if.exp index 5682df501e9..34ba63d034d 100644 --- a/usr.bin/make/unit-tests/directive-if.exp +++ b/usr.bin/make/unit-tests/directive-if.exp @@ -1,18 +1,18 @@ -make: "directive-if.mk" line 13: 0 evaluates to false. -make: "directive-if.mk" line 17: 1 evaluates to true. -make: "directive-if.mk" line 41: Unknown directive "ifx" -make: "directive-if.mk" line 43: This is not conditional. -make: "directive-if.mk" line 45: if-less else -make: "directive-if.mk" line 47: This is not conditional. -make: "directive-if.mk" line 49: if-less endif -make: "directive-if.mk" line 53: Malformed conditional () -make: "directive-if.mk" line 63: Quotes in plain words are probably a mistake. -make: "directive-if.mk" line 72: Don't do this, always put a space after a directive. +make: "directive-if.mk" line 14: 0 evaluates to false. +make: "directive-if.mk" line 19: 1 evaluates to true. +make: "directive-if.mk" line 43: Unknown directive "ifx" +make: "directive-if.mk" line 45: This is not conditional. +make: "directive-if.mk" line 47: if-less else +make: "directive-if.mk" line 49: This is not conditional. +make: "directive-if.mk" line 51: if-less endif +make: "directive-if.mk" line 55: Malformed conditional () +make: "directive-if.mk" line 66: Quotes in plain words are probably a mistake. make: "directive-if.mk" line 76: Don't do this, always put a space after a directive. -make: "directive-if.mk" line 82: Don't do this, always put a space around comparison operators. -make: "directive-if.mk" line 88: Don't do this, always put a space after a directive. -make: "directive-if.mk" line 92: Don't do this, always put a space after a directive. -make: "directive-if.mk" line 100: Unknown directive "ifn" +make: "directive-if.mk" line 81: Don't do this, always put a space after a directive. +make: "directive-if.mk" line 88: Don't do this, always put a space around comparison operators. +make: "directive-if.mk" line 95: Don't do this, always put a space after a directive. +make: "directive-if.mk" line 100: Don't do this, always put a space after a directive. +make: "directive-if.mk" line 108: Unknown directive "ifn" make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/directive-if.mk b/usr.bin/make/unit-tests/directive-if.mk index 1acd5c95800..7a68c004141 100644 --- a/usr.bin/make/unit-tests/directive-if.mk +++ b/usr.bin/make/unit-tests/directive-if.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-if.mk,v 1.11 2022/01/23 21:48:59 rillig Exp $ +# $NetBSD: directive-if.mk,v 1.12 2023/06/01 20:56:35 rillig Exp $ # # Tests for the .if directive. # @@ -10,10 +10,12 @@ .if 0 . error .else +# expect+1: 0 evaluates to false. . info 0 evaluates to false. .endif .if 1 +# expect+1: 1 evaluates to true. . info 1 evaluates to true. .else . error @@ -60,6 +62,7 @@ # though, which are kept. The quotes need not be balanced. The next space # ends the word, and the remaining " || 1" is parsed as "or true". .if ${:Uplain"""""} == plain""""" || 1 +# expect+1: Quotes in plain words are probably a mistake. . info Quotes in plain words are probably a mistake. # XXX: Accepting quotes in plain words is probably a mistake as well. .else @@ -69,26 +72,31 @@ .if0 . error .else +# expect+1: Don't do this, always put a space after a directive. . info Don't do this, always put a space after a directive. .endif .if${:U-3} +# expect+1: Don't do this, always put a space after a directive. . info Don't do this, always put a space after a directive. .else . error .endif .if${:U-3}>-4 +# expect+1: Don't do this, always put a space around comparison operators. . info Don't do this, always put a space around comparison operators. .else . error .endif .if(1) +# expect+1: Don't do this, always put a space after a directive. . info Don't do this, always put a space after a directive. .endif .if!0 +# expect+1: Don't do this, always put a space after a directive. . info Don't do this, always put a space after a directive. .endif diff --git a/usr.bin/make/unit-tests/directive-ifmake.exp b/usr.bin/make/unit-tests/directive-ifmake.exp index bf4ded97911..e607726fd87 100644 --- a/usr.bin/make/unit-tests/directive-ifmake.exp +++ b/usr.bin/make/unit-tests/directive-ifmake.exp @@ -1,10 +1,10 @@ -make: "directive-ifmake.mk" line 13: ok: positive condition works -make: "directive-ifmake.mk" line 24: ok: negation works -make: "directive-ifmake.mk" line 33: ok: double negation works -make: "directive-ifmake.mk" line 40: ok: both mentioned -make: "directive-ifmake.mk" line 47: ok: only those mentioned -make: "directive-ifmake.mk" line 57: Targets can even be added at parse time. -make: "directive-ifmake.mk" line 75: ok +make: "directive-ifmake.mk" line 14: ok: positive condition works +make: "directive-ifmake.mk" line 26: ok: negation works +make: "directive-ifmake.mk" line 36: ok: double negation works +make: "directive-ifmake.mk" line 44: ok: both mentioned +make: "directive-ifmake.mk" line 52: ok: only those mentioned +make: "directive-ifmake.mk" line 63: Targets can even be added at parse time. +make: "directive-ifmake.mk" line 82: ok : first : second : late-target diff --git a/usr.bin/make/unit-tests/directive-ifmake.mk b/usr.bin/make/unit-tests/directive-ifmake.mk index a1ff3aef682..2a0cedda463 100644 --- a/usr.bin/make/unit-tests/directive-ifmake.mk +++ b/usr.bin/make/unit-tests/directive-ifmake.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-ifmake.mk,v 1.10 2022/02/09 21:09:24 rillig Exp $ +# $NetBSD: directive-ifmake.mk,v 1.11 2023/06/01 20:56:35 rillig Exp $ # # Tests for the .ifmake directive, which provides a shortcut for asking # whether a certain target is requested to be made from the command line. @@ -10,6 +10,7 @@ # This is the most basic form. .ifmake first +# expect+1: ok: positive condition works . info ok: positive condition works .else . warning positive condition fails @@ -21,6 +22,7 @@ .ifmake !first . warning unexpected .else +# expect+1: ok: negation works . info ok: negation works .endif @@ -30,6 +32,7 @@ # exclamation mark were part of the name instead, the name would be '!!first', # and such a target was not requested to be made. .ifmake !!first +# expect+1: ok: double negation works . info ok: double negation works .else . warning double negation fails @@ -37,6 +40,7 @@ # Multiple targets can be combined using the && and || operators. .ifmake first && second +# expect+1: ok: both mentioned . info ok: both mentioned .else . warning && does not work as expected @@ -44,6 +48,7 @@ # Negation also works in complex conditions. .ifmake first && !unmentioned +# expect+1: ok: only those mentioned . info ok: only those mentioned .else . warning && with ! does not work as expected @@ -54,6 +59,7 @@ # possible to extend the targets to be made. .MAKEFLAGS: late-target .ifmake late-target +# expect+1: Targets can even be added at parse time. . info Targets can even be added at parse time. .else . info No, targets cannot be added at parse time anymore. @@ -72,6 +78,7 @@ # A condition that consists of a variable expression only (without any # comparison operator) can be used with .if and the other .ifxxx directives. .ifmake ${:Ufirst} +# expect+1: ok . info ok .else . error diff --git a/usr.bin/make/unit-tests/directive-ifndef.exp b/usr.bin/make/unit-tests/directive-ifndef.exp index c653f634442..4d16acd3357 100644 --- a/usr.bin/make/unit-tests/directive-ifndef.exp +++ b/usr.bin/make/unit-tests/directive-ifndef.exp @@ -1,2 +1,2 @@ -make: "directive-ifndef.mk" line 10: guarded section +make: "directive-ifndef.mk" line 11: guarded section exit status 0 diff --git a/usr.bin/make/unit-tests/directive-ifndef.mk b/usr.bin/make/unit-tests/directive-ifndef.mk index bf509ef8075..16db9764d7f 100644 --- a/usr.bin/make/unit-tests/directive-ifndef.mk +++ b/usr.bin/make/unit-tests/directive-ifndef.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-ifndef.mk,v 1.6 2020/10/24 08:46:08 rillig Exp $ +# $NetBSD: directive-ifndef.mk,v 1.7 2023/06/01 20:56:35 rillig Exp $ # # Tests for the .ifndef directive, which can be used for multiple-inclusion # guards. In contrast to C, where #ifndef and #define nicely line up the @@ -7,6 +7,7 @@ .ifndef GUARD GUARD= # defined +# expect+1: guarded section . info guarded section .endif diff --git a/usr.bin/make/unit-tests/directive-include-fatal.exp b/usr.bin/make/unit-tests/directive-include-fatal.exp index c8ca97a0fd5..cae0fc97a59 100644 --- a/usr.bin/make/unit-tests/directive-include-fatal.exp +++ b/usr.bin/make/unit-tests/directive-include-fatal.exp @@ -1,4 +1,4 @@ -make: "directive-include-fatal.mk" line 13: Malformed conditional (${UNDEF}) +make: "directive-include-fatal.mk" line 14: Malformed conditional (${UNDEF}) make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/directive-include-fatal.mk b/usr.bin/make/unit-tests/directive-include-fatal.mk index 6744f9e80e5..d4ed26f2a4a 100644 --- a/usr.bin/make/unit-tests/directive-include-fatal.mk +++ b/usr.bin/make/unit-tests/directive-include-fatal.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-include-fatal.mk,v 1.3 2021/02/01 22:16:57 rillig Exp $ +# $NetBSD: directive-include-fatal.mk,v 1.4 2023/06/01 20:56:35 rillig Exp $ # # Test for the .include directive combined with fatal errors. # @@ -10,6 +10,7 @@ # the "fatals" counter. # Using an undefined variable in a condition generates a fatal error. +# expect+1: Malformed conditional (${UNDEF}) .if ${UNDEF} .endif diff --git a/usr.bin/make/unit-tests/directive-include.exp b/usr.bin/make/unit-tests/directive-include.exp index 0ddf40a75d2..161f1750f7a 100644 --- a/usr.bin/make/unit-tests/directive-include.exp +++ b/usr.bin/make/unit-tests/directive-include.exp @@ -2,12 +2,12 @@ CondParser_Eval: ${.MAKE.MAKEFILES:T} != "${.PARSEFILE} null" Comparing "directive-include.mk null" != "directive-include.mk null" CondParser_Eval: ${.MAKE.MAKEFILES:T} != "${.PARSEFILE} null" Comparing "directive-include.mk null" != "directive-include.mk null" -make: "directive-include.mk" line 25: Could not find nonexistent.mk -make: "directive-include.mk" line 47: Could not find " -make: "directive-include.mk" line 52: Unknown modifier "Z" -make: "directive-include.mk" line 52: Could not find nonexistent.mk -make: "directive-include.mk" line 57: Cannot open /nonexistent -make: "directive-include.mk" line 62: Invalid line type +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: Could not find nonexistent.mk +make: "directive-include.mk" line 61: Cannot open /nonexistent +make: "directive-include.mk" line 66: Invalid line type make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/directive-include.mk b/usr.bin/make/unit-tests/directive-include.mk index edf27d02483..404730a0cb6 100644 --- a/usr.bin/make/unit-tests/directive-include.mk +++ b/usr.bin/make/unit-tests/directive-include.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-include.mk,v 1.11 2022/01/15 12:35:18 rillig Exp $ +# $NetBSD: directive-include.mk,v 1.12 2023/06/01 20:56:35 rillig Exp $ # # Tests for the .include directive, which includes another file. @@ -22,6 +22,7 @@ . error .endif +# expect+1: Could not find nonexistent.mk .include "nonexistent.mk" .include "/dev/null" # size 0 # including a directory technically succeeds, but shouldn't. @@ -44,11 +45,14 @@ DEV= null # would be empty, and the closing '"' would be in the trailing part of the # line, which is ignored as of 2021-12-03. DQUOT= " +# expect+1: Could not find " .include "${DQUOT}" # When the expression in a filename cannot be evaluated, the failing # 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" .include "nonexistent${:U123:Z}.mk" # The traditional include directive is seldom used. diff --git a/usr.bin/make/unit-tests/directive-info.exp b/usr.bin/make/unit-tests/directive-info.exp index 70def02441d..397d9d31ef3 100644 --- a/usr.bin/make/unit-tests/directive-info.exp +++ b/usr.bin/make/unit-tests/directive-info.exp @@ -1,15 +1,15 @@ -make: "directive-info.mk" line 11: begin .info tests -make: "directive-info.mk" line 12: Unknown directive "inf" -make: "directive-info.mk" line 13: Missing argument for ".info" -make: "directive-info.mk" line 14: message -make: "directive-info.mk" line 15: indented message -make: "directive-info.mk" line 16: Unknown directive "information" -make: "directive-info.mk" line 17: Unknown directive "information" -make: "directive-info.mk" line 22: Missing argument for ".info" -make: "directive-info.mk" line 23: Missing argument for ".info" -make: "directive-info.mk" line 26: Unknown directive "info-message" -make: "directive-info.mk" line 27: no-target: no-source -make: "directive-info.mk" line 35: expect line 35 for multi-line message +make: "directive-info.mk" line 12: begin .info tests +make: "directive-info.mk" line 14: Unknown directive "inf" +make: "directive-info.mk" line 16: Missing argument for ".info" +make: "directive-info.mk" line 18: message +make: "directive-info.mk" line 20: indented message +make: "directive-info.mk" line 22: Unknown directive "information" +make: "directive-info.mk" line 24: Unknown directive "information" +make: "directive-info.mk" line 30: Missing argument for ".info" +make: "directive-info.mk" line 32: Missing argument for ".info" +make: "directive-info.mk" line 36: Unknown directive "info-message" +make: "directive-info.mk" line 38: no-target: no-source +make: "directive-info.mk" line 47: expect line 35 for multi-line message make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/directive-info.mk b/usr.bin/make/unit-tests/directive-info.mk index 327ff63e7f9..ab550555d44 100644 --- a/usr.bin/make/unit-tests/directive-info.mk +++ b/usr.bin/make/unit-tests/directive-info.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-info.mk,v 1.10 2022/05/08 06:51:27 rillig Exp $ +# $NetBSD: directive-info.mk,v 1.11 2023/06/01 20:56:35 rillig Exp $ # # Tests for the .info directive. # @@ -8,22 +8,33 @@ # TODO: Implementation +# expect+1: begin .info tests .info begin .info tests +# expect+1: Unknown directive "inf" .inf # misspelled -.info # "Missing argument" +# expect+1: Missing argument for ".info" +.info +# expect+1: message .info message +# expect+1: indented message .info indented message +# expect+1: Unknown directive "information" .information +# expect+1: Unknown directive "information" .information message # Accepted before 2020-12-13 01:07:54. .info.man: # not a message, but possibly a suffix rule # Even if lines would have trailing whitespace, this would be trimmed by # ParseRawLine. +# expect+1: Missing argument for ".info" .info +# expect+1: Missing argument for ".info" .info # comment .info: message # This is a dependency declaration. +# expect+1: Unknown directive "info-message" .info-message # This is an unknown directive. +# expect+1: no-target: no-source .info no-target: no-source # This is a .info directive, not a dependency. # See directive.mk for more tests of this kind. @@ -32,9 +43,7 @@ # number of completely read lines. For the following multi-line directive, # this meant that the reported line number was the one of the last line, not # of the first line. +# expect+1: expect line 35 for multi-line message .info expect line 35 for\ multi$\ -line message - -all: - @:; diff --git a/usr.bin/make/unit-tests/directive-misspellings.exp b/usr.bin/make/unit-tests/directive-misspellings.exp index e51d8473b30..a0061592674 100644 --- a/usr.bin/make/unit-tests/directive-misspellings.exp +++ b/usr.bin/make/unit-tests/directive-misspellings.exp @@ -1,45 +1,45 @@ -make: "directive-misspellings.mk" line 12: Unknown directive "dinclud" -make: "directive-misspellings.mk" line 14: Unknown directive "dincludx" -make: "directive-misspellings.mk" line 15: .include filename must be delimited by '"' or '<' -make: "directive-misspellings.mk" line 17: Unknown directive "erro" -make: "directive-misspellings.mk" line 18: Unknown directive "errox" -make: "directive-misspellings.mk" line 22: Unknown directive "expor" -make: "directive-misspellings.mk" line 24: Unknown directive "exporx" -make: "directive-misspellings.mk" line 25: Unknown directive "exports" -make: "directive-misspellings.mk" line 27: Unknown directive "export-en" -make: "directive-misspellings.mk" line 30: Unknown directive "export-environment" -make: "directive-misspellings.mk" line 32: Unknown directive "export-litera" -make: "directive-misspellings.mk" line 34: Unknown directive "export-literax" -make: "directive-misspellings.mk" line 35: Unknown directive "export-literally" -make: "directive-misspellings.mk" line 37: Unknown directive "-includ" -make: "directive-misspellings.mk" line 39: Unknown directive "-includx" -make: "directive-misspellings.mk" line 40: .include filename must be delimited by '"' or '<' -make: "directive-misspellings.mk" line 42: Unknown directive "includ" -make: "directive-misspellings.mk" line 43: Could not find file -make: "directive-misspellings.mk" line 44: Unknown directive "includx" -make: "directive-misspellings.mk" line 45: .include filename must be delimited by '"' or '<' -make: "directive-misspellings.mk" line 47: Unknown directive "inf" -make: "directive-misspellings.mk" line 48: msg -make: "directive-misspellings.mk" line 49: Unknown directive "infx" -make: "directive-misspellings.mk" line 50: Unknown directive "infos" -make: "directive-misspellings.mk" line 52: Unknown directive "sinclud" -make: "directive-misspellings.mk" line 54: Unknown directive "sincludx" -make: "directive-misspellings.mk" line 55: .include filename must be delimited by '"' or '<' -make: "directive-misspellings.mk" line 57: Unknown directive "unde" -make: "directive-misspellings.mk" line 59: Unknown directive "undex" -make: "directive-misspellings.mk" line 60: Unknown directive "undefs" -make: "directive-misspellings.mk" line 62: Unknown directive "unexpor" -make: "directive-misspellings.mk" line 64: Unknown directive "unexporx" -make: "directive-misspellings.mk" line 65: Unknown directive "unexports" -make: "directive-misspellings.mk" line 67: Unknown directive "unexport-en" -make: "directive-misspellings.mk" line 69: The directive .unexport-env does not take arguments -make: "directive-misspellings.mk" line 70: Unknown directive "unexport-enx" -make: "directive-misspellings.mk" line 71: Unknown directive "unexport-envs" -make: "directive-misspellings.mk" line 73: Unknown directive "warn" -make: "directive-misspellings.mk" line 74: Unknown directive "warnin" -make: "directive-misspellings.mk" line 75: warning: msg -make: "directive-misspellings.mk" line 76: Unknown directive "warninx" -make: "directive-misspellings.mk" line 77: Unknown directive "warnings" +make: "directive-misspellings.mk" line 13: Unknown directive "dinclud" +make: "directive-misspellings.mk" line 16: Unknown directive "dincludx" +make: "directive-misspellings.mk" line 18: .include filename must be delimited by '"' or '<' +make: "directive-misspellings.mk" line 21: Unknown directive "erro" +make: "directive-misspellings.mk" line 23: Unknown directive "errox" +make: "directive-misspellings.mk" line 28: Unknown directive "expor" +make: "directive-misspellings.mk" line 31: Unknown directive "exporx" +make: "directive-misspellings.mk" line 33: Unknown directive "exports" +make: "directive-misspellings.mk" line 36: Unknown directive "export-en" +make: "directive-misspellings.mk" line 40: Unknown directive "export-environment" +make: "directive-misspellings.mk" line 43: Unknown directive "export-litera" +make: "directive-misspellings.mk" line 46: Unknown directive "export-literax" +make: "directive-misspellings.mk" line 48: Unknown directive "export-literally" +make: "directive-misspellings.mk" line 51: Unknown directive "-includ" +make: "directive-misspellings.mk" line 54: Unknown directive "-includx" +make: "directive-misspellings.mk" line 56: .include filename must be delimited by '"' or '<' +make: "directive-misspellings.mk" line 59: Unknown directive "includ" +make: "directive-misspellings.mk" line 61: Could not find file +make: "directive-misspellings.mk" line 63: Unknown directive "includx" +make: "directive-misspellings.mk" line 65: .include filename must be delimited by '"' or '<' +make: "directive-misspellings.mk" line 68: Unknown directive "inf" +make: "directive-misspellings.mk" line 70: msg +make: "directive-misspellings.mk" line 72: Unknown directive "infx" +make: "directive-misspellings.mk" line 74: Unknown directive "infos" +make: "directive-misspellings.mk" line 77: Unknown directive "sinclud" +make: "directive-misspellings.mk" line 80: Unknown directive "sincludx" +make: "directive-misspellings.mk" line 82: .include filename must be delimited by '"' or '<' +make: "directive-misspellings.mk" line 85: Unknown directive "unde" +make: "directive-misspellings.mk" line 88: Unknown directive "undex" +make: "directive-misspellings.mk" line 90: Unknown directive "undefs" +make: "directive-misspellings.mk" line 93: Unknown directive "unexpor" +make: "directive-misspellings.mk" line 96: Unknown directive "unexporx" +make: "directive-misspellings.mk" line 98: Unknown directive "unexports" +make: "directive-misspellings.mk" line 101: Unknown directive "unexport-en" +make: "directive-misspellings.mk" line 104: The directive .unexport-env does not take arguments +make: "directive-misspellings.mk" line 106: Unknown directive "unexport-enx" +make: "directive-misspellings.mk" line 108: Unknown directive "unexport-envs" +make: "directive-misspellings.mk" line 111: Unknown directive "warn" +make: "directive-misspellings.mk" line 113: Unknown directive "warnin" +make: "directive-misspellings.mk" line 115: warning: msg +make: "directive-misspellings.mk" line 117: Unknown directive "warninx" +make: "directive-misspellings.mk" line 119: Unknown directive "warnings" make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/directive-misspellings.mk b/usr.bin/make/unit-tests/directive-misspellings.mk index 5f479f03b7f..0014076d041 100644 --- a/usr.bin/make/unit-tests/directive-misspellings.mk +++ b/usr.bin/make/unit-tests/directive-misspellings.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-misspellings.mk,v 1.3 2020/12/13 01:10:22 rillig Exp $ +# $NetBSD: directive-misspellings.mk,v 1.4 2023/06/01 20:56:35 rillig Exp $ # # Tests for misspelled directives. # @@ -9,71 +9,111 @@ # ".information" were aliases to ".info" since the code for these diagnostic # directives just skipped any letters following the "error", "warn" or "info". +# expect+1: Unknown directive "dinclud" .dinclud "file" .dinclude "file" +# expect+1: Unknown directive "dincludx" .dincludx "file" +# expect+1: .include filename must be delimited by '"' or '<' .dincludes "file" # XXX: the 's' is not meant to be a filename +# expect+1: Unknown directive "erro" .erro msg +# expect+1: Unknown directive "errox" .errox msg # no .error since that would exit immediately # no .errors since that would exit immediately, even with the typo +# expect+1: Unknown directive "expor" .expor varname .export varname +# expect+1: Unknown directive "exporx" .exporx varname +# expect+1: Unknown directive "exports" .exports varname # Accepted before 2020-12-13 01:07:54. +# expect+1: Unknown directive "export-en" .export-en # Accepted before 2020-12-13 01:07:54. .export-env .export-env extra argument # XXX: undetected extra argument +# expect+1: Unknown directive "export-environment" .export-environment # Accepted before 2020-12-13 01:07:54. +# expect+1: Unknown directive "export-litera" .export-litera varname # Accepted before 2020-12-13 01:07:54. .export-literal varname +# expect+1: Unknown directive "export-literax" .export-literax varname # Accepted before 2020-12-13 01:07:54. +# expect+1: Unknown directive "export-literally" .export-literally varname # Accepted before 2020-12-13 01:07:54. +# expect+1: Unknown directive "-includ" .-includ "file" .-include "file" +# expect+1: Unknown directive "-includx" .-includx "file" +# expect+1: .include filename must be delimited by '"' or '<' .-includes "file" # XXX: the 's' is not meant to be a filename +# expect+1: Unknown directive "includ" .includ "file" +# expect+1: Could not find file .include "file" +# expect+1: Unknown directive "includx" .includx "file" +# expect+1: .include filename must be delimited by '"' or '<' .includex "file" # XXX: the 's' is not meant to be a filename +# expect+1: Unknown directive "inf" .inf msg +# expect+1: msg .info msg +# expect+1: Unknown directive "infx" .infx msg +# expect+1: Unknown directive "infos" .infos msg # Accepted before 2020-12-13 01:07:54. +# expect+1: Unknown directive "sinclud" .sinclud "file" .sinclude "file" +# expect+1: Unknown directive "sincludx" .sincludx "file" +# expect+1: .include filename must be delimited by '"' or '<' .sincludes "file" # XXX: the 's' is not meant to be a filename +# expect+1: Unknown directive "unde" .unde varname .undef varname +# expect+1: Unknown directive "undex" .undex varname +# expect+1: Unknown directive "undefs" .undefs varname # Accepted before 2020-12-13 01:07:54. +# expect+1: Unknown directive "unexpor" .unexpor varname .unexport varname +# expect+1: Unknown directive "unexporx" .unexporx varname +# expect+1: Unknown directive "unexports" .unexports varname # Accepted before 2020-12-12 18:00:18. +# expect+1: Unknown directive "unexport-en" .unexport-en # Accepted before 2020-12-12 18:11:42. .unexport-env +# expect+1: The directive .unexport-env does not take arguments .unexport-env extra argument # Accepted before 2020-12-12 18:00:18. +# expect+1: Unknown directive "unexport-enx" .unexport-enx # Accepted before 2020-12-12 18:00:18. +# expect+1: Unknown directive "unexport-envs" .unexport-envs # Accepted before 2020-12-12 18:00:18. +# expect+1: Unknown directive "warn" .warn msg +# expect+1: Unknown directive "warnin" .warnin msg +# expect+1: warning: msg .warning msg +# expect+1: Unknown directive "warninx" .warninx msg +# expect+1: Unknown directive "warnings" .warnings msg # Accepted before 2020-12-13 01:07:54. - -all: diff --git a/usr.bin/make/unit-tests/directive-undef.exp b/usr.bin/make/unit-tests/directive-undef.exp index 20df58a8dc7..f3957a990e1 100644 --- a/usr.bin/make/unit-tests/directive-undef.exp +++ b/usr.bin/make/unit-tests/directive-undef.exp @@ -1,6 +1,6 @@ -make: "directive-undef.mk" line 29: The .undef directive requires an argument -make: "directive-undef.mk" line 86: Unknown modifier "Z" -make: "directive-undef.mk" line 102: warning: UT_EXPORTED is still listed in .MAKE.EXPORTED even though spaceit is not exported anymore. +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 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 exit status 1 diff --git a/usr.bin/make/unit-tests/directive-undef.mk b/usr.bin/make/unit-tests/directive-undef.mk index 5ac7d939c71..ef047fefe17 100644 --- a/usr.bin/make/unit-tests/directive-undef.mk +++ b/usr.bin/make/unit-tests/directive-undef.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-undef.mk,v 1.12 2022/03/26 12:44:57 rillig Exp $ +# $NetBSD: directive-undef.mk,v 1.13 2023/06/01 20:56:35 rillig Exp $ # # Tests for the .undef directive. # @@ -26,6 +26,7 @@ # to delete the variable with the empty name, which never exists; see # varname-empty.mk. Since var.c 1.737 from 2020-12-19, .undef complains # about a missing argument. +# expect+1: The .undef directive requires an argument .undef @@ -83,6 +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" .undef ${VARNAMES:L:Z} @@ -99,6 +101,7 @@ UT_EXPORTED= exported-value . error .endif .if ${.MAKE.EXPORTED:MUT_EXPORTED} +# expect+1: warning: UT_EXPORTED is still listed in .MAKE.EXPORTED even though spaceit is not exported anymore. . warning UT_EXPORTED is still listed in .MAKE.EXPORTED even though $\ it is not exported anymore. .endif diff --git a/usr.bin/make/unit-tests/directive-unexport-env.exp b/usr.bin/make/unit-tests/directive-unexport-env.exp index 22528c31c3a..663034cee12 100644 --- a/usr.bin/make/unit-tests/directive-unexport-env.exp +++ b/usr.bin/make/unit-tests/directive-unexport-env.exp @@ -1,9 +1,9 @@ -make: "directive-unexport-env.mk" line 13: Unknown directive "unexport-en" -make: "directive-unexport-env.mk" line 15: Unknown directive "unexport-environment" +make: "directive-unexport-env.mk" line 14: Unknown directive "unexport-en" +make: "directive-unexport-env.mk" line 17: Unknown directive "unexport-environment" Global: UT_EXPORTED = value Global: UT_UNEXPORTED = value Global: .MAKE.EXPORTED = UT_EXPORTED -make: "directive-unexport-env.mk" line 21: The directive .unexport-env does not take arguments +make: "directive-unexport-env.mk" line 24: The directive .unexport-env does not take arguments Var_Parse: ${.MAKE.EXPORTED:O:u} (eval) Evaluating modifier ${.MAKE.EXPORTED:O} on value "UT_EXPORTED" Result of ${.MAKE.EXPORTED:O} is "UT_EXPORTED" diff --git a/usr.bin/make/unit-tests/directive-unexport-env.mk b/usr.bin/make/unit-tests/directive-unexport-env.mk index e9620684dfc..e56e4786501 100644 --- a/usr.bin/make/unit-tests/directive-unexport-env.mk +++ b/usr.bin/make/unit-tests/directive-unexport-env.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-unexport-env.mk,v 1.8 2022/01/23 16:09:38 rillig Exp $ +# $NetBSD: directive-unexport-env.mk,v 1.9 2023/06/01 20:56:35 rillig Exp $ # # Tests for the .unexport-env directive. # @@ -10,14 +10,17 @@ # TODO: Implementation +# expect+1: Unknown directive "unexport-en" .unexport-en # misspelled .unexport-env # ok +# expect+1: Unknown directive "unexport-environment" .unexport-environment # misspelled .MAKEFLAGS: -dv UT_EXPORTED= value UT_UNEXPORTED= value .export UT_EXPORTED +# expect+1: The directive .unexport-env does not take arguments .unexport-env UT_EXPORTED UT_UNEXPORTED .MAKEFLAGS: -d0 diff --git a/usr.bin/make/unit-tests/directive-unexport.exp b/usr.bin/make/unit-tests/directive-unexport.exp index d59fb471325..b084daf5d14 100644 --- a/usr.bin/make/unit-tests/directive-unexport.exp +++ b/usr.bin/make/unit-tests/directive-unexport.exp @@ -1,5 +1,5 @@ -make: "directive-unexport.mk" line 18: UT_A=a UT_B=b UT_C=c -make: "directive-unexport.mk" line 19: UT_A UT_B UT_C -make: "directive-unexport.mk" line 27: UT_A=a UT_B=b UT_C=c -make: "directive-unexport.mk" line 28: +make: "directive-unexport.mk" line 19: UT_A=a UT_B=b UT_C=c +make: "directive-unexport.mk" line 21: UT_A UT_B UT_C +make: "directive-unexport.mk" line 30: UT_A=a UT_B=b UT_C=c +make: "directive-unexport.mk" line 31: exit status 0 diff --git a/usr.bin/make/unit-tests/directive-unexport.mk b/usr.bin/make/unit-tests/directive-unexport.mk index efc103efedf..e759fe3e35f 100644 --- a/usr.bin/make/unit-tests/directive-unexport.mk +++ b/usr.bin/make/unit-tests/directive-unexport.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-unexport.mk,v 1.7 2020/12/13 01:07:54 rillig Exp $ +# $NetBSD: directive-unexport.mk,v 1.8 2023/06/01 20:56:35 rillig Exp $ # # Tests for the .unexport directive. # @@ -15,7 +15,9 @@ UT_C= c .export UT_A UT_B UT_C # Show the exported variables and their values. +# expect+1: UT_A=a UT_B=b UT_C=c .info ${:!env|sort|grep '^UT_'!} +# expect+1: UT_A UT_B UT_C .info ${.MAKE.EXPORTED} # XXX: Now try to unexport all of them. The variables are still exported @@ -24,6 +26,7 @@ UT_C= c *= asterisk .unexport * +# expect+1: UT_A=a UT_B=b UT_C=c .info ${:!env|sort|grep '^UT_'!} .info ${.MAKE.EXPORTED} diff --git a/usr.bin/make/unit-tests/directive-warning.exp b/usr.bin/make/unit-tests/directive-warning.exp index 932b88a151e..6fbeed91df0 100644 --- a/usr.bin/make/unit-tests/directive-warning.exp +++ b/usr.bin/make/unit-tests/directive-warning.exp @@ -1,11 +1,11 @@ -make: "directive-warning.mk" line 9: Unknown directive "warn" make: "directive-warning.mk" line 10: Unknown directive "warn" -make: "directive-warning.mk" line 11: Unknown directive "warnin" -make: "directive-warning.mk" line 12: Unknown directive "warnin" -make: "directive-warning.mk" line 13: Missing argument for ".warning" -make: "directive-warning.mk" line 14: warning: message -make: "directive-warning.mk" line 15: Unknown directive "warnings" -make: "directive-warning.mk" line 16: Unknown directive "warnings" +make: "directive-warning.mk" line 12: Unknown directive "warn" +make: "directive-warning.mk" line 14: Unknown directive "warnin" +make: "directive-warning.mk" line 16: Unknown directive "warnin" +make: "directive-warning.mk" line 18: Missing argument for ".warning" +make: "directive-warning.mk" line 19: warning: message +make: "directive-warning.mk" line 21: Unknown directive "warnings" +make: "directive-warning.mk" line 23: Unknown directive "warnings" make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/directive-warning.mk b/usr.bin/make/unit-tests/directive-warning.mk index 9d5cec1ff0b..b4c8f4730b7 100644 --- a/usr.bin/make/unit-tests/directive-warning.mk +++ b/usr.bin/make/unit-tests/directive-warning.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-warning.mk,v 1.7 2022/01/23 16:09:38 rillig Exp $ +# $NetBSD: directive-warning.mk,v 1.8 2023/06/01 20:56:35 rillig Exp $ # # Tests for the .warning directive. # @@ -6,13 +6,20 @@ # produced the wrong error message "Unknown directive". Since parse.c 1.503 # from 2020-12-19, the correct "Missing argument" is produced. +# expect+1: Unknown directive "warn" .warn # misspelled +# expect+1: Unknown directive "warn" .warn message # misspelled +# expect+1: Unknown directive "warnin" .warnin # misspelled +# expect+1: Unknown directive "warnin" .warnin message # misspelled +# expect+1: Missing argument for ".warning" .warning # "Missing argument" .warning message # expect+0: message +# expect+1: Unknown directive "warnings" .warnings # misspelled +# expect+1: Unknown directive "warnings" .warnings messages # Accepted before 2020-12-13 01:07:54. all: .PHONY diff --git a/usr.bin/make/unit-tests/doterror.mk b/usr.bin/make/unit-tests/doterror.mk index d46fb3581a2..0f3698ad5cf 100644 --- a/usr.bin/make/unit-tests/doterror.mk +++ b/usr.bin/make/unit-tests/doterror.mk @@ -1,4 +1,4 @@ -# $NetBSD: doterror.mk,v 1.2 2020/10/24 08:34:59 rillig Exp $ +# $NetBSD: doterror.mk,v 1.3 2023/06/01 20:56:35 rillig Exp $ .BEGIN: @@ -17,4 +17,3 @@ happy: sad: @echo and now: $@; exit 1 - diff --git a/usr.bin/make/unit-tests/error.exp b/usr.bin/make/unit-tests/error.exp index 3adc099a462..e782664498b 100644 --- a/usr.bin/make/unit-tests/error.exp +++ b/usr.bin/make/unit-tests/error.exp @@ -1,6 +1,6 @@ -make: "error.mk" line 6: just FYI -make: "error.mk" line 7: warning: this could be serious -make: "error.mk" line 8: this is fatal +make: "error.mk" line 7: just FYI +make: "error.mk" line 9: warning: this could be serious +make: "error.mk" line 11: this is fatal make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/error.mk b/usr.bin/make/unit-tests/error.mk index 0029b3bc6aa..2383e60da6f 100644 --- a/usr.bin/make/unit-tests/error.mk +++ b/usr.bin/make/unit-tests/error.mk @@ -1,10 +1,13 @@ -# $NetBSD: error.mk,v 1.3 2020/11/03 17:38:45 rillig Exp $ +# $NetBSD: error.mk,v 1.4 2023/06/01 20:56:35 rillig Exp $ # # Demonstrate that the .error directive exits immediately, without # continuing parsing until the end of the file. +# expect+1: just FYI .info just FYI +# expect+1: warning: this could be serious .warning this could be serious +# expect+1: this is fatal .error this is fatal .info this is not reached because of the .error above diff --git a/usr.bin/make/unit-tests/export-env.mk b/usr.bin/make/unit-tests/export-env.mk index 1605b1a71d6..80653f4bb3c 100644 --- a/usr.bin/make/unit-tests/export-env.mk +++ b/usr.bin/make/unit-tests/export-env.mk @@ -1,4 +1,4 @@ -# $NetBSD: export-env.mk,v 1.4 2020/10/24 08:50:17 rillig Exp $ +# $NetBSD: export-env.mk,v 1.5 2023/06/01 20:56:35 rillig Exp $ # our normal .export, subsequent changes affect the environment UT_TEST= this @@ -21,7 +21,3 @@ UT_LIT= literal ${UT_TEST} all: @echo make:; ${UT_TEST UT_ENV UT_EXP UT_LIT:L:@v@echo $v=${$v};@} @echo env:; ${UT_TEST UT_ENV UT_EXP UT_LIT:L:@v@echo $v=$${$v};@} - - - - diff --git a/usr.bin/make/unit-tests/include-main.exp b/usr.bin/make/unit-tests/include-main.exp index f58870486f8..fcc38247109 100644 --- a/usr.bin/make/unit-tests/include-main.exp +++ b/usr.bin/make/unit-tests/include-main.exp @@ -1,5 +1,5 @@ -make: "include-main.mk" line 14: main-before-ok -make: "include-main.mk" line 21: main-before-for-ok +make: "include-main.mk" line 15: main-before-ok +make: "include-main.mk" line 23: main-before-for-ok make: "include-sub.inc" line 4: sub-before-ok make: "include-sub.inc" line 14: sub-before-for-ok Parsing line 5: . info subsub-ok @@ -7,11 +7,11 @@ make: "include-subsub.inc" line 5: subsub-ok in .for loop from include-sub.inc:31 with i = include in .for loop from include-sub.inc:30 with i = nested in .for loop from include-sub.inc:29 with i = deeply - in include-main.mk:27 + in include-main.mk:29 Parsing line 6: .MAKEFLAGS: -d0 ParseDependency(.MAKEFLAGS: -d0) make: "include-sub.inc" line 38: sub-after-ok make: "include-sub.inc" line 45: sub-after-for-ok -make: "include-main.mk" line 30: main-after-ok -make: "include-main.mk" line 37: main-after-for-ok +make: "include-main.mk" line 33: main-after-ok +make: "include-main.mk" line 41: main-after-for-ok exit status 0 diff --git a/usr.bin/make/unit-tests/include-main.mk b/usr.bin/make/unit-tests/include-main.mk index 50be0587348..373bbdea172 100644 --- a/usr.bin/make/unit-tests/include-main.mk +++ b/usr.bin/make/unit-tests/include-main.mk @@ -1,4 +1,4 @@ -# $NetBSD: include-main.mk,v 1.8 2023/01/19 23:26:14 rillig Exp $ +# $NetBSD: include-main.mk,v 1.9 2023/06/01 20:56:35 rillig Exp $ # # Until 2020-09-05, the .INCLUDEDFROMFILE magic variable did not behave # as described in the manual page. @@ -11,6 +11,7 @@ # properly handle nested includes and even .for loops. .if !defined(.INCLUDEDFROMFILE) +# expect+1: main-before-ok . info main-before-ok .else . warning main-before-fail(${.INCLUDEDFROMFILE}) @@ -18,6 +19,7 @@ .for i in once . if !defined(.INCLUDEDFROMFILE) +# expect+1: main-before-for-ok . info main-before-for-ok . else . warning main-before-for-fail(${.INCLUDEDFROMFILE}) @@ -27,6 +29,7 @@ .include "include-sub.inc" .if !defined(.INCLUDEDFROMFILE) +# expect+1: main-after-ok . info main-after-ok .else . warning main-after-fail(${.INCLUDEDFROMFILE}) @@ -34,6 +37,7 @@ .for i in once . if !defined(.INCLUDEDFROMFILE) +# expect+1: main-after-for-ok . info main-after-for-ok . else . warning main-after-for-fail(${.INCLUDEDFROMFILE}) diff --git a/usr.bin/make/unit-tests/opt-debug-file.exp b/usr.bin/make/unit-tests/opt-debug-file.exp index 712686f60b3..8bdaca61231 100644 --- a/usr.bin/make/unit-tests/opt-debug-file.exp +++ b/usr.bin/make/unit-tests/opt-debug-file.exp @@ -1,6 +1,6 @@ -make: "opt-debug-file.mk" line 43: This goes to stderr only, once. -make: "opt-debug-file.mk" line 45: This goes to stderr only, once. -make: "opt-debug-file.mk" line 47: This goes to stderr, and in addition to the debug log. +make: "opt-debug-file.mk" line 44: This goes to stderr only, once. +make: "opt-debug-file.mk" line 47: This goes to stderr only, once. +make: "opt-debug-file.mk" line 50: This goes to stderr, and in addition to the debug log. CondParser_Eval: ${:!cat opt-debug-file.debuglog!:Maddition:[#]} != 1 Comparing 1.000000 != 1.000000 make: Missing delimiter for modifier ':S' diff --git a/usr.bin/make/unit-tests/opt-debug-file.mk b/usr.bin/make/unit-tests/opt-debug-file.mk index b878c2bcf73..a8190b2f1b5 100644 --- a/usr.bin/make/unit-tests/opt-debug-file.mk +++ b/usr.bin/make/unit-tests/opt-debug-file.mk @@ -1,4 +1,4 @@ -# $NetBSD: opt-debug-file.mk,v 1.8 2022/01/11 19:47:34 rillig Exp $ +# $NetBSD: opt-debug-file.mk,v 1.9 2023/06/01 20:56:35 rillig Exp $ # # Tests for the -dF command line option, which redirects the debug log # to a file instead of writing it to stderr. @@ -40,10 +40,13 @@ DEBUG_OUTPUT:= ${:!cat opt-debug-file.debuglog!} # See Parse_Error. .MAKEFLAGS: -dFstdout +# expect+1: This goes to stderr only, once. . info This goes to stderr only, once. .MAKEFLAGS: -dFstderr +# expect+1: This goes to stderr only, once. . info This goes to stderr only, once. .MAKEFLAGS: -dFopt-debug-file.debuglog +# expect+1: This goes to stderr, and in addition to the debug log. . info This goes to stderr, and in addition to the debug log. .MAKEFLAGS: -dFstderr -d0c .if ${:!cat opt-debug-file.debuglog!:Maddition:[#]} != 1 diff --git a/usr.bin/make/unit-tests/opt-debug-hash.exp b/usr.bin/make/unit-tests/opt-debug-hash.exp index b239399ec44..194b08daa5f 100644 --- a/usr.bin/make/unit-tests/opt-debug-hash.exp +++ b/usr.bin/make/unit-tests/opt-debug-hash.exp @@ -1,4 +1,4 @@ -make: "opt-debug-hash.mk" line 11: Missing argument for ".error" +make: "opt-debug-hash.mk" line 12: Missing argument for ".error" make: Fatal errors encountered -- cannot continue HashTable targets: size=16 numEntries=0 maxchain=0 HashTable Global variables: size=16 numEntries=<entries> maxchain=3 diff --git a/usr.bin/make/unit-tests/opt-debug-hash.mk b/usr.bin/make/unit-tests/opt-debug-hash.mk index 8b757ff3f29..a1b21e145bf 100644 --- a/usr.bin/make/unit-tests/opt-debug-hash.mk +++ b/usr.bin/make/unit-tests/opt-debug-hash.mk @@ -1,4 +1,4 @@ -# $NetBSD: opt-debug-hash.mk,v 1.3 2022/01/22 18:59:24 rillig Exp $ +# $NetBSD: opt-debug-hash.mk,v 1.4 2023/06/01 20:56:35 rillig Exp $ # # Tests for the -dh command line option, which adds debug logging for # hash tables. Even more detailed logging is available by compiling @@ -8,4 +8,5 @@ # Force a parse error, to demonstrate the newline character in the diagnostic # that had been missing before parse.c 1.655 from 2022-01-22. +# expect+1: Missing argument for ".error" .error diff --git a/usr.bin/make/unit-tests/opt-debug-lint.exp b/usr.bin/make/unit-tests/opt-debug-lint.exp index 83643e9a877..5a6510bd029 100644 --- a/usr.bin/make/unit-tests/opt-debug-lint.exp +++ b/usr.bin/make/unit-tests/opt-debug-lint.exp @@ -1,10 +1,10 @@ -make: "opt-debug-lint.mk" line 19: Variable "X" is undefined -make: "opt-debug-lint.mk" line 19: Malformed conditional ($X) -make: "opt-debug-lint.mk" line 41: Variable "UNDEF" is undefined -make: "opt-debug-lint.mk" line 41: Malformed conditional (${UNDEF}) -make: "opt-debug-lint.mk" line 61: Missing delimiter ':' after modifier "L" -make: "opt-debug-lint.mk" line 61: Missing delimiter ':' after modifier "P" -make: "opt-debug-lint.mk" line 69: Unknown modifier "${" +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: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/opt-debug-lint.mk b/usr.bin/make/unit-tests/opt-debug-lint.mk index 155e1a3de3b..0fcaf8b102a 100644 --- a/usr.bin/make/unit-tests/opt-debug-lint.mk +++ b/usr.bin/make/unit-tests/opt-debug-lint.mk @@ -1,4 +1,4 @@ -# $NetBSD: opt-debug-lint.mk,v 1.14 2021/03/14 10:57:12 rillig Exp $ +# $NetBSD: opt-debug-lint.mk,v 1.15 2023/06/01 20:56:35 rillig Exp $ # # Tests for the -dL command line option, which runs additional checks # to catch common mistakes, such as unclosed variable expressions. @@ -16,6 +16,8 @@ # # See also: # cond-undef-lint.mk +# expect+2: Malformed conditional ($X) +# expect+1: Variable "X" is undefined .if $X . error .endif @@ -38,6 +40,8 @@ # hoping for the caller to print an error message. This resulted in the # well-known "Malformed conditional" error message, even though the # conditional was well-formed and the only error was an undefined variable. +# expect+2: Malformed conditional (${UNDEF}) +# expect+1: Variable "UNDEF" is undefined .if ${UNDEF} . error .endif @@ -58,6 +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" .if ${value:LPL} != "value" . error .endif @@ -66,6 +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 "${" .if ${value:${:UL}PL} != "LPL}" # FIXME: "LPL}" is unexpected here. . error ${value:${:UL}PL} .endif diff --git a/usr.bin/make/unit-tests/opt-debug-parse.exp b/usr.bin/make/unit-tests/opt-debug-parse.exp index 0e11024647a..811c6b45dce 100644 --- a/usr.bin/make/unit-tests/opt-debug-parse.exp +++ b/usr.bin/make/unit-tests/opt-debug-parse.exp @@ -1,26 +1,26 @@ Parse_PushInput: .for loop in opt-debug-parse.mk, line 16 SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `opt-debug-parse.mk' -Parsing line 20: .info trace with multi-line .for loop head -make: "opt-debug-parse.mk" line 20: trace with multi-line .for loop head +Parsing line 21: .info trace with multi-line .for loop head +make: "opt-debug-parse.mk" line 21: trace with multi-line .for loop head in .for loop from opt-debug-parse.mk:16 with var = value -ParseEOF: returning to file opt-debug-parse.mk, line 22 +ParseEOF: returning to file opt-debug-parse.mk, line 23 SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `opt-debug-parse.mk' -Parsing line 25: .include "/dev/null" +Parsing line 26: .include "/dev/null" Parse_PushInput: file /dev/null, line 1 SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `null' SetFilenameVars: ${.INCLUDEDFROMDIR} = <some-dir> ${.INCLUDEDFROMFILE} = `opt-debug-parse.mk' -ParseEOF: returning to file opt-debug-parse.mk, line 26 +ParseEOF: returning to file opt-debug-parse.mk, line 27 SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `opt-debug-parse.mk' -Parse_PushInput: .for loop in opt-debug-parse.mk, line 30 +Parse_PushInput: .for loop in opt-debug-parse.mk, line 31 SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `opt-debug-parse.mk' -Parsing line 31: .info trace -make: "opt-debug-parse.mk" line 31: trace - in .for loop from opt-debug-parse.mk:30 with a = 1, b = 2, c = 3 -Parsing line 31: .info trace -make: "opt-debug-parse.mk" line 31: trace - in .for loop from opt-debug-parse.mk:30 with a = 4, b = 5, c = 6 -ParseEOF: returning to file opt-debug-parse.mk, line 33 +Parsing line 34: .info trace +make: "opt-debug-parse.mk" line 34: trace + in .for loop from opt-debug-parse.mk:31 with a = 1, b = 2, c = 3 +Parsing line 34: .info trace +make: "opt-debug-parse.mk" line 34: trace + in .for loop from opt-debug-parse.mk:31 with a = 4, b = 5, c = 6 +ParseEOF: returning to file opt-debug-parse.mk, line 36 SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `opt-debug-parse.mk' -Parsing line 35: .MAKEFLAGS: -d0 +Parsing line 38: .MAKEFLAGS: -d0 ParseDependency(.MAKEFLAGS: -d0) exit status 0 diff --git a/usr.bin/make/unit-tests/opt-debug-parse.mk b/usr.bin/make/unit-tests/opt-debug-parse.mk index 9517bb62b97..347537015b5 100644 --- a/usr.bin/make/unit-tests/opt-debug-parse.mk +++ b/usr.bin/make/unit-tests/opt-debug-parse.mk @@ -1,4 +1,4 @@ -# $NetBSD: opt-debug-parse.mk,v 1.7 2022/02/09 21:09:24 rillig Exp $ +# $NetBSD: opt-debug-parse.mk,v 1.8 2023/06/01 20:56:35 rillig Exp $ # # Tests for the -dp command line option, which adds debug logging about # makefile parsing. @@ -17,6 +17,7 @@ var \ in \ value +# expect+1: trace with multi-line .for loop head .info trace with multi-line .for loop head .endfor @@ -28,6 +29,8 @@ # In .for loops with multiple variables, the variable details are included in # the stack trace, just as with a single variable. .for a b c in 1 2 3 ${:U4 5 6} +# expect+2: trace +# expect+1: trace .info trace .endfor diff --git a/usr.bin/make/unit-tests/opt-warnings-as-errors.exp b/usr.bin/make/unit-tests/opt-warnings-as-errors.exp index 1db56b753be..87d1db249a2 100644 --- a/usr.bin/make/unit-tests/opt-warnings-as-errors.exp +++ b/usr.bin/make/unit-tests/opt-warnings-as-errors.exp @@ -1,6 +1,6 @@ -make: "opt-warnings-as-errors.mk" line 12: warning: message 1 +make: "opt-warnings-as-errors.mk" line 13: warning: message 1 make: parsing warnings being treated as errors -make: "opt-warnings-as-errors.mk" line 13: warning: message 2 +make: "opt-warnings-as-errors.mk" line 15: warning: message 2 parsing continues make: Fatal errors encountered -- cannot continue make: stopped in unit-tests diff --git a/usr.bin/make/unit-tests/opt-warnings-as-errors.mk b/usr.bin/make/unit-tests/opt-warnings-as-errors.mk index c29343f960a..3896dad10f1 100644 --- a/usr.bin/make/unit-tests/opt-warnings-as-errors.mk +++ b/usr.bin/make/unit-tests/opt-warnings-as-errors.mk @@ -1,4 +1,4 @@ -# $NetBSD: opt-warnings-as-errors.mk,v 1.5 2021/01/27 00:02:38 rillig Exp $ +# $NetBSD: opt-warnings-as-errors.mk,v 1.6 2023/06/01 20:56:35 rillig Exp $ # # Tests for the -W command line option, which turns warnings into errors. # @@ -9,7 +9,9 @@ .MAKEFLAGS: -W +# expect+1: warning: message 1 .warning message 1 +# expect+1: warning: message 2 .warning message 2 _!= echo 'parsing continues' 1>&2 diff --git a/usr.bin/make/unit-tests/parse.exp b/usr.bin/make/unit-tests/parse.exp index a11de0c194a..694e35e3b6e 100644 --- a/usr.bin/make/unit-tests/parse.exp +++ b/usr.bin/make/unit-tests/parse.exp @@ -1,6 +1,6 @@ make: "parse.mk" line 7: Makefile appears to contain unresolved CVS/RCS/??? merge conflicts make: "parse.mk" line 14: Makefile appears to contain unresolved CVS/RCS/??? merge conflicts -make: "parse.mk" line 24: Invalid line type +make: "parse.mk" line 25: Invalid line type make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/parse.mk b/usr.bin/make/unit-tests/parse.mk index 551dc98aaf2..296c19f5cd9 100644 --- a/usr.bin/make/unit-tests/parse.mk +++ b/usr.bin/make/unit-tests/parse.mk @@ -1,4 +1,4 @@ -# $NetBSD: parse.mk,v 1.4 2023/04/28 13:09:48 rillig Exp $ +# $NetBSD: parse.mk,v 1.5 2023/06/01 20:56:35 rillig Exp $ # # Test those parts of the parsing that do not belong in any of the other # categories. @@ -21,6 +21,7 @@ # the expanded line's terminating '\0'. # # https://bugs.freebsd.org/265119 +# expect+1: Invalid line type one-target ${:U } diff --git a/usr.bin/make/unit-tests/recursive.exp b/usr.bin/make/unit-tests/recursive.exp index 36cd1c98953..dc50fe03496 100644 --- a/usr.bin/make/unit-tests/recursive.exp +++ b/usr.bin/make/unit-tests/recursive.exp @@ -1,5 +1,5 @@ -make: "recursive.mk" line 36: Unclosed variable "MISSING_PAREN" -make: "recursive.mk" line 37: Unclosed variable "MISSING_BRACE" +make: "recursive.mk" line 37: Unclosed variable "MISSING_PAREN" +make: "recursive.mk" line 39: Unclosed variable "MISSING_BRACE" make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/recursive.mk b/usr.bin/make/unit-tests/recursive.mk index 5265cec59a2..307515d70a0 100644 --- a/usr.bin/make/unit-tests/recursive.mk +++ b/usr.bin/make/unit-tests/recursive.mk @@ -1,4 +1,4 @@ -# $NetBSD: recursive.mk,v 1.5 2021/03/15 12:15:03 rillig Exp $ +# $NetBSD: recursive.mk,v 1.6 2023/06/01 20:56:35 rillig Exp $ # # In -dL mode, a variable may get expanded before it makes sense. # This would stop make from doing anything since the "recursive" error @@ -33,6 +33,8 @@ AM_DEFAULT_VERBOSITY= 1 # therefore that's acceptable. In most practical cases, the missing # brace would be detected directly in the line where it is produced. MISSING_BRACE_INDIRECT:= ${:U\${MISSING_BRACE} +# expect+1: Unclosed variable "MISSING_PAREN" UNCLOSED= $(MISSING_PAREN +# expect+1: Unclosed variable "MISSING_BRACE" UNCLOSED= ${MISSING_BRACE UNCLOSED= ${MISSING_BRACE_INDIRECT} diff --git a/usr.bin/make/unit-tests/var-eval-short.exp b/usr.bin/make/unit-tests/var-eval-short.exp index ea6e0d7485f..14e3d372f19 100644 --- a/usr.bin/make/unit-tests/var-eval-short.exp +++ b/usr.bin/make/unit-tests/var-eval-short.exp @@ -1,5 +1,5 @@ -make: "var-eval-short.mk" line 44: In the :@ modifier of "", the variable name "${FAIL}" must not contain a dollar -make: "var-eval-short.mk" line 44: Malformed conditional (0 && ${:Uword:@${FAIL}@expr@}) +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: Malformed conditional (0 && ${:Uword:@${FAIL}@expr@}) CondParser_Eval: 0 && ${0:?${FAIL}then:${FAIL}else} Var_Parse: ${0:?${FAIL}then:${FAIL}else} (parse-only) Parsing modifier ${0:?...} @@ -8,7 +8,7 @@ Modifier part: "${FAIL}then" Var_Parse: ${FAIL}else} (parse-only) Modifier part: "${FAIL}else" Result of ${0:?${FAIL}then:${FAIL}else} is "" (parse-only, defined) -Parsing line 165: DEFINED= defined +Parsing line 167: DEFINED= defined Global: DEFINED = defined CondParser_Eval: 0 && ${DEFINED:L:?${FAIL}then:${FAIL}else} Var_Parse: ${DEFINED:L:?${FAIL}then:${FAIL}else} (parse-only) @@ -20,7 +20,7 @@ Modifier part: "${FAIL}then" Var_Parse: ${FAIL}else} (parse-only) Modifier part: "${FAIL}else" Result of ${DEFINED:?${FAIL}then:${FAIL}else} is "defined" (parse-only, regular) -Parsing line 168: .MAKEFLAGS: -d0 +Parsing line 170: .MAKEFLAGS: -d0 ParseDependency(.MAKEFLAGS: -d0) Global: .MAKEFLAGS = -r -k -d cpv -d Global: .MAKEFLAGS = -r -k -d cpv -d 0 diff --git a/usr.bin/make/unit-tests/var-eval-short.mk b/usr.bin/make/unit-tests/var-eval-short.mk index 7faf1cc5d15..aa8bf79dece 100644 --- a/usr.bin/make/unit-tests/var-eval-short.mk +++ b/usr.bin/make/unit-tests/var-eval-short.mk @@ -1,4 +1,4 @@ -# $NetBSD: var-eval-short.mk,v 1.9 2023/05/09 16:27:00 rillig Exp $ +# $NetBSD: var-eval-short.mk,v 1.10 2023/06/01 20:56:35 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,6 +41,8 @@ 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+1: Malformed conditional (0 && ${:Uword:@${FAIL}@expr@}) .if 0 && ${:Uword:@${FAIL}@expr@} .endif diff --git a/usr.bin/make/unit-tests/var-op-assign.exp b/usr.bin/make/unit-tests/var-op-assign.exp index 73e580403d7..593dfa4b904 100644 --- a/usr.bin/make/unit-tests/var-op-assign.exp +++ b/usr.bin/make/unit-tests/var-op-assign.exp @@ -1,6 +1,6 @@ this will be evaluated later -make: "var-op-assign.mk" line 59: Invalid line type -make: "var-op-assign.mk" line 93: Parsing still continues until here. +make: "var-op-assign.mk" line 60: Invalid line type +make: "var-op-assign.mk" line 95: Parsing still continues until here. make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/var-op-assign.mk b/usr.bin/make/unit-tests/var-op-assign.mk index 18ecf8d0d5e..0a1c686fe5c 100644 --- a/usr.bin/make/unit-tests/var-op-assign.mk +++ b/usr.bin/make/unit-tests/var-op-assign.mk @@ -1,4 +1,4 @@ -# $NetBSD: var-op-assign.mk,v 1.8 2021/03/15 19:15:04 rillig Exp $ +# $NetBSD: var-op-assign.mk,v 1.9 2023/06/01 20:56:35 rillig Exp $ # # Tests for the = variable assignment operator, which overwrites an existing # variable or creates it. @@ -56,6 +56,7 @@ VAR= ${:! echo 'this will be evaluated later' 1>&2 !} # In a variable assignment, the variable name must consist of a single word. # The following line therefore generates a parse error. +# expect+1: Invalid line type VARIABLE NAME= variable value # But if the whitespace appears inside parentheses or braces, everything is @@ -90,6 +91,7 @@ VARNAME_BRACES= VAR{spaces in braces} # unexpected variable values. # # Therefore, just output an info message. +# expect+1: Parsing still continues until here. .info Parsing still continues until here. all: diff --git a/usr.bin/make/unit-tests/var-op-expand.exp b/usr.bin/make/unit-tests/var-op-expand.exp index 4916336c040..5ea4e6b6954 100644 --- a/usr.bin/make/unit-tests/var-op-expand.exp +++ b/usr.bin/make/unit-tests/var-op-expand.exp @@ -1,7 +1,7 @@ make: "var-op-expand.mk" line 274: Unknown modifier "s,value,replaced," -make: "var-op-expand.mk" line 277: warning: XXX Neither branch should be taken. -make: "var-op-expand.mk" line 282: Unknown modifier "s,value,replaced," -make: "var-op-expand.mk" line 283: warning: XXX Neither branch should be taken. +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 285: warning: XXX Neither branch should be taken. make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/var-op-expand.mk b/usr.bin/make/unit-tests/var-op-expand.mk index f89aa6fa4b5..a0b9cc47540 100644 --- a/usr.bin/make/unit-tests/var-op-expand.mk +++ b/usr.bin/make/unit-tests/var-op-expand.mk @@ -1,4 +1,4 @@ -# $NetBSD: var-op-expand.mk,v 1.17 2022/09/08 20:23:45 rillig Exp $ +# $NetBSD: var-op-expand.mk,v 1.18 2023/06/01 20:56:35 rillig Exp $ # # Tests for the := variable assignment operator, which expands its # right-hand side. @@ -274,12 +274,14 @@ indirect:= ${INDIRECT:tl} .if ${indirect} != " ok " . error .else +# expect+1: warning: XXX Neither branch should be taken. . warning XXX Neither branch should be taken. .endif LATER= uppercase-value later= lowercase-value # expect+1: 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. .else . error diff --git a/usr.bin/make/unit-tests/var-op-shell.exp b/usr.bin/make/unit-tests/var-op-shell.exp index 07e394491c4..d8b176c5205 100644 --- a/usr.bin/make/unit-tests/var-op-shell.exp +++ b/usr.bin/make/unit-tests/var-op-shell.exp @@ -1,8 +1,8 @@ -make: "var-op-shell.mk" line 31: warning: "echo "failed"; false" returned non-zero status -make: "var-op-shell.mk" line 37: warning: "false" returned non-zero status -make: "var-op-shell.mk" line 59: warning: "kill $$" exited on a signal +make: "var-op-shell.mk" line 32: warning: "echo "failed"; false" returned non-zero status +make: "var-op-shell.mk" line 39: warning: "false" returned non-zero status +make: "var-op-shell.mk" line 62: warning: "kill $$" exited on a signal /bin/no/such/command: not found -make: "var-op-shell.mk" line 65: warning: "/bin/no/such/command" returned non-zero status +make: "var-op-shell.mk" line 69: warning: "/bin/no/such/command" returned non-zero status stderr Capturing the output of command "echo '$$$$'" Global: OUTPUT = $$$$ diff --git a/usr.bin/make/unit-tests/var-op-shell.mk b/usr.bin/make/unit-tests/var-op-shell.mk index bd2a48f17cc..de26bff9490 100644 --- a/usr.bin/make/unit-tests/var-op-shell.mk +++ b/usr.bin/make/unit-tests/var-op-shell.mk @@ -1,4 +1,4 @@ -# $NetBSD: var-op-shell.mk,v 1.6 2022/01/10 20:32:29 rillig Exp $ +# $NetBSD: var-op-shell.mk,v 1.7 2023/06/01 20:56:35 rillig Exp $ # # Tests for the != variable assignment operator, which runs its right-hand # side through the shell. @@ -28,12 +28,14 @@ OUTPUT!= true # '::!=', expression modifier ':!...!'), a failed command generates only a # warning, not an "error". These "errors" are ignored in default mode, for # compatibility, but not in lint mode (-dL). +# expect+1: warning: "echo "failed"; false" returned non-zero status OUTPUT!= echo "failed"; false .if ${OUTPUT} != "failed" . error .endif # A command with empty output may fail as well. +# expect+1: warning: "false" returned non-zero status OUTPUT!= false .if ${OUTPUT} != "" . error @@ -56,12 +58,14 @@ OUTPUT!= echo "before"; false; echo "after" # This should result in a warning about "exited on a signal". # This used to be kill -14 (SIGALRM), but that stopped working on # Darwin18 after recent update. +# expect+1: warning: "kill $$" exited on a signal OUTPUT!= kill $$$$ .if ${OUTPUT} != "" . error .endif # A nonexistent command produces a non-zero exit status. +# expect+1: warning: "/bin/no/such/command" returned non-zero status OUTPUT!= /bin/no/such/command .if ${OUTPUT} != "" . error diff --git a/usr.bin/make/unit-tests/var-readonly.mk b/usr.bin/make/unit-tests/var-readonly.mk index 43799e4adb5..67e6c0cb828 100644 --- a/usr.bin/make/unit-tests/var-readonly.mk +++ b/usr.bin/make/unit-tests/var-readonly.mk @@ -1,4 +1,4 @@ -# $NetBSD: var-readonly.mk,v 1.1 2023/01/24 00:20:00 sjg Exp $ +# $NetBSD: var-readonly.mk,v 1.2 2023/06/01 20:56:35 rillig Exp $ # the answer N = 42 @@ -17,4 +17,3 @@ N = 69 .endif all: - diff --git a/usr.bin/make/unit-tests/var-recursive.exp b/usr.bin/make/unit-tests/var-recursive.exp index 44c381f94ff..2158286749f 100644 --- a/usr.bin/make/unit-tests/var-recursive.exp +++ b/usr.bin/make/unit-tests/var-recursive.exp @@ -1,19 +1,19 @@ -make: "var-recursive.mk" line 20: still there +make: "var-recursive.mk" line 21: still there Variable DIRECT is recursive. - in var-recursive.mk:21 + in var-recursive.mk:22 make: stopped in unit-tests Variable INDIRECT1 is recursive. - in var-recursive.mk:28 + in var-recursive.mk:29 make: stopped in unit-tests -make: "var-recursive.mk" line 35: ok +make: "var-recursive.mk" line 37: ok Variable V is recursive. - in var-recursive.mk:43 + in var-recursive.mk:45 make: stopped in unit-tests : OK -In a command near "var-recursive.mk" line 55: Variable VAR is recursive. +In a command near "var-recursive.mk" line 57: Variable VAR is recursive. make: stopped in unit-tests exit status 0 diff --git a/usr.bin/make/unit-tests/var-recursive.mk b/usr.bin/make/unit-tests/var-recursive.mk index 1825c8a6312..998d0d8c312 100644 --- a/usr.bin/make/unit-tests/var-recursive.mk +++ b/usr.bin/make/unit-tests/var-recursive.mk @@ -1,4 +1,4 @@ -# $NetBSD: var-recursive.mk,v 1.4 2022/01/29 10:21:26 rillig Exp $ +# $NetBSD: var-recursive.mk,v 1.5 2023/06/01 20:56:35 rillig Exp $ # # Tests for variable expressions that refer to themselves and thus # cannot be evaluated. @@ -17,6 +17,7 @@ all: .elif ${TEST} == direct DIRECT= ${DIRECT} # Defining a recursive variable is not yet an error. +# expect+1: still there . info still there # Therefore this line is printed. . info ${DIRECT} # But expanding the variable is an error. @@ -32,6 +33,7 @@ INDIRECT2= ${INDIRECT1} # The variable refers to itself, but only in the branch of a condition that # is never satisfied and is thus not evaluated. CONDITIONAL= ${1:?ok:${CONDITIONAL}} +# expect+1: ok . info ${CONDITIONAL} .elif ${TEST} == short diff --git a/usr.bin/make/unit-tests/var-scope-cmdline.exp b/usr.bin/make/unit-tests/var-scope-cmdline.exp index 281b5af291c..c663a9069a9 100644 --- a/usr.bin/make/unit-tests/var-scope-cmdline.exp +++ b/usr.bin/make/unit-tests/var-scope-cmdline.exp @@ -1,4 +1,4 @@ -make: "var-scope-cmdline.mk" line 71: global -make: "var-scope-cmdline.mk" line 80: makeflags +make: "var-scope-cmdline.mk" line 72: global +make: "var-scope-cmdline.mk" line 82: makeflags makeflags exit status 0 diff --git a/usr.bin/make/unit-tests/var-scope-cmdline.mk b/usr.bin/make/unit-tests/var-scope-cmdline.mk index fbfb2d0290a..eaa2c58347a 100644 --- a/usr.bin/make/unit-tests/var-scope-cmdline.mk +++ b/usr.bin/make/unit-tests/var-scope-cmdline.mk @@ -1,4 +1,4 @@ -# $NetBSD: var-scope-cmdline.mk,v 1.2 2023/04/07 05:54:16 rillig Exp $ +# $NetBSD: var-scope-cmdline.mk,v 1.3 2023/06/01 20:56:35 rillig Exp $ # # Tests for variables specified on the command line. # @@ -68,6 +68,7 @@ # A normal global variable, without any cmdline variable nearby. VAR= global +# expect+1: global .info ${VAR} # The global variable is "overridden" by simply deleting it and then @@ -77,6 +78,7 @@ VAR= global # # See varmod-loop.mk for a non-obvious way to undefine a cmdline variable. .MAKEFLAGS: VAR=makeflags +# expect+1: makeflags .info ${VAR} # If Var_SetWithFlags should ever forget to delete the global variable, diff --git a/usr.bin/make/unit-tests/vardebug.exp b/usr.bin/make/unit-tests/vardebug.exp index 19e5c9c9fdd..a668807b94e 100644 --- a/usr.bin/make/unit-tests/vardebug.exp +++ b/usr.bin/make/unit-tests/vardebug.exp @@ -54,11 +54,11 @@ 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 44: Unknown modifier "unknown" +make: "vardebug.mk" line 46: Unknown modifier "unknown" Result of ${:unknown} is error (eval-defined, defined) -make: "vardebug.mk" line 44: Malformed conditional (${:Uvariable:unknown}) +make: "vardebug.mk" line 46: Malformed conditional (${:Uvariable:unknown}) Var_Parse: ${UNDEFINED} (eval-defined) -make: "vardebug.mk" line 53: Malformed conditional (${UNDEFINED}) +make: "vardebug.mk" line 56: Malformed conditional (${UNDEFINED}) Global: delete .SHELL (not found) Command: .SHELL = </path/to/shell> Command: .SHELL = overwritten ignored (read-only) diff --git a/usr.bin/make/unit-tests/vardebug.mk b/usr.bin/make/unit-tests/vardebug.mk index 4a16a7f2797..34015aa71db 100644 --- a/usr.bin/make/unit-tests/vardebug.mk +++ b/usr.bin/make/unit-tests/vardebug.mk @@ -1,4 +1,4 @@ -# $NetBSD: vardebug.mk,v 1.7 2021/02/04 21:42:47 rillig Exp $ +# $NetBSD: vardebug.mk,v 1.8 2023/06/01 20:56:35 rillig Exp $ # # Demonstrates the debugging output for var.c. @@ -41,6 +41,8 @@ VAR+= 3 # When ApplyModifiers results in an error, this appears in the debug log # as "is error", without surrounding quotes. +# expect+2: Malformed conditional (${:Uvariable:unknown}) +# expect+1: Unknown modifier "unknown" .if ${:Uvariable:unknown} .endif @@ -50,6 +52,7 @@ VAR+= 3 # There is a specialized error message for "Undefined variable", but as of # 2020-08-08, that is not covered by any unit tests. It might even be # unreachable. +# expect+1: Malformed conditional (${UNDEFINED}) .if ${UNDEFINED} .endif diff --git a/usr.bin/make/unit-tests/varmod-assign-shell.exp b/usr.bin/make/unit-tests/varmod-assign-shell.exp index 7bb41108cb6..b7c6cd223f2 100644 --- a/usr.bin/make/unit-tests/varmod-assign-shell.exp +++ b/usr.bin/make/unit-tests/varmod-assign-shell.exp @@ -1,4 +1,4 @@ -make: "varmod-assign-shell.mk" line 27: warning: "echo output; false" returned non-zero status +make: "varmod-assign-shell.mk" line 28: warning: "echo output; false" returned non-zero status Global: _ = # (empty) Var_Parse: ${ASSIGNED::!=echo output; ${:Ufalse}} (eval-keep-dollar-and-undefined) Evaluating modifier ${ASSIGNED::...} on value "previous" (eval-keep-dollar-and-undefined, regular) diff --git a/usr.bin/make/unit-tests/varmod-assign-shell.mk b/usr.bin/make/unit-tests/varmod-assign-shell.mk index d03692942d5..6158bac14ea 100644 --- a/usr.bin/make/unit-tests/varmod-assign-shell.mk +++ b/usr.bin/make/unit-tests/varmod-assign-shell.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-assign-shell.mk,v 1.4 2022/01/10 20:32:29 rillig Exp $ +# $NetBSD: varmod-assign-shell.mk,v 1.5 2023/06/01 20:56:35 rillig Exp $ # # Tests for the variable modifier '::!=', which assigns the output of a shell # command to the variable, but only if the command exited successfully. This @@ -24,6 +24,7 @@ # assignment operator '!=' is another unnecessary inconsistency. DIRECT= previous +# expect+1: warning: "echo output; false" returned non-zero status DIRECT!= echo output; false ASSIGNED= previous diff --git a/usr.bin/make/unit-tests/varmod-edge.exp b/usr.bin/make/unit-tests/varmod-edge.exp index d9db72b2e2e..92204d8e184 100644 --- a/usr.bin/make/unit-tests/varmod-edge.exp +++ b/usr.bin/make/unit-tests/varmod-edge.exp @@ -1,27 +1,27 @@ -make: "varmod-edge.mk" line 166: ok M-paren -make: "varmod-edge.mk" line 166: ok M-mixed -make: "varmod-edge.mk" line 166: ok M-unescape +make: "varmod-edge.mk" line 184: ok M-paren +make: "varmod-edge.mk" line 184: ok M-mixed +make: "varmod-edge.mk" line 184: ok M-unescape make: Unclosed variable expression, expecting '}' for modifier "U*)" of variable "" with value "*)" -make: "varmod-edge.mk" line 166: ok M-nest-mix -make: "varmod-edge.mk" line 166: ok M-nest-brk -make: "varmod-edge.mk" line 166: ok M-pat-err -make: "varmod-edge.mk" line 166: ok M-bsbs -make: "varmod-edge.mk" line 166: ok M-bs1-par -make: "varmod-edge.mk" line 166: ok M-bs2-par -make: "varmod-edge.mk" line 166: ok M-128 -make: "varmod-edge.mk" line 166: ok eq-ext -make: "varmod-edge.mk" line 166: ok eq-q -make: "varmod-edge.mk" line 166: ok eq-bs +make: "varmod-edge.mk" line 184: ok M-nest-mix +make: "varmod-edge.mk" line 184: ok M-nest-brk +make: "varmod-edge.mk" line 184: ok M-pat-err +make: "varmod-edge.mk" line 184: ok M-bsbs +make: "varmod-edge.mk" line 184: ok M-bs1-par +make: "varmod-edge.mk" line 184: ok M-bs2-par +make: "varmod-edge.mk" line 184: ok M-128 +make: "varmod-edge.mk" line 184: ok eq-ext +make: "varmod-edge.mk" line 184: ok eq-q +make: "varmod-edge.mk" line 184: ok eq-bs make: Unfinished modifier for "INP.eq-esc" ('=' missing) -make: "varmod-edge.mk" line 166: ok eq-esc -make: "varmod-edge.mk" line 166: ok colon -make: "varmod-edge.mk" line 165: Unknown modifier ":" -make: "varmod-edge.mk" line 165: Unknown modifier ":" -make: "varmod-edge.mk" line 166: ok colons -make: "varmod-edge.mk" line 175: Unknown modifier "Z" -make: "varmod-edge.mk" line 175: Malformed conditional (${:Z}) +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 184: ok colons +make: "varmod-edge.mk" line 195: Unknown modifier "Z" +make: "varmod-edge.mk" line 195: Malformed conditional (${:Z}) make: Unfinished modifier for "" (',' missing) -make: "varmod-edge.mk" line 188: Malformed conditional (${:S,}) +make: "varmod-edge.mk" line 209: Malformed conditional (${:S,}) make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/varmod-edge.mk b/usr.bin/make/unit-tests/varmod-edge.mk index 762053d281a..2d63b372e85 100644 --- a/usr.bin/make/unit-tests/varmod-edge.mk +++ b/usr.bin/make/unit-tests/varmod-edge.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-edge.mk,v 1.16 2021/02/23 15:56:30 rillig Exp $ +# $NetBSD: varmod-edge.mk,v 1.17 2023/06/01 20:56:35 rillig Exp $ # # Tests for edge cases in variable modifiers. # @@ -162,7 +162,25 @@ MOD.colons= ${INP.colons::::} EXP.colons= # empty .for test in ${TESTS} +# expect+2: Unknown modifier ":" +# expect+1: Unknown modifier ":" . if ${MOD.${test}} == ${EXP.${test}} +# expect+16: ok M-paren +# expect+15: ok M-mixed +# expect+14: ok M-unescape +# expect+13: ok M-nest-mix +# expect+12: ok M-nest-brk +# expect+11: ok M-pat-err +# expect+10: ok M-bsbs +# expect+09: ok M-bs1-par +# expect+08: ok M-bs2-par +# expect+07: ok M-128 +# expect+06: ok eq-ext +# expect+05: ok eq-q +# expect+04: ok eq-bs +# expect+03: ok eq-esc +# expect+02: ok colon +# expect+01: ok colons . info ok ${test} . else . warning error in ${test}: expected "${EXP.${test}}", got "${MOD.${test}}" @@ -172,6 +190,8 @@ EXP.colons= # empty # Even in expressions based on an unnamed variable, there may be errors. # 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" .if ${:Z} . error .else @@ -185,6 +205,7 @@ EXP.colons= # empty # modifier for (',' missing)", having two spaces in a row. # # XXX: The error message should report the filename:lineno. +# expect+1: Malformed conditional (${:S,}) .if ${:S,} . error .else diff --git a/usr.bin/make/unit-tests/varmod-gmtime.exp b/usr.bin/make/unit-tests/varmod-gmtime.exp index 916e471c462..bbb8bd547bd 100644 --- a/usr.bin/make/unit-tests/varmod-gmtime.exp +++ b/usr.bin/make/unit-tests/varmod-gmtime.exp @@ -1,13 +1,13 @@ -make: "varmod-gmtime.mk" line 59: Invalid time value "-1" -make: "varmod-gmtime.mk" line 59: Malformed conditional (${:L:gmtime=-1} != "") -make: "varmod-gmtime.mk" line 68: Invalid time value " 1" -make: "varmod-gmtime.mk" line 68: Malformed conditional (${:L:gmtime= 1} != "") -make: "varmod-gmtime.mk" line 114: Invalid time value "10000000000000000000000000000000" -make: "varmod-gmtime.mk" line 114: Malformed conditional (${:L:gmtime=10000000000000000000000000000000} != "") -make: "varmod-gmtime.mk" line 125: Invalid time value "error" -make: "varmod-gmtime.mk" line 125: Malformed conditional (${:L:gmtime=error} != "") -make: "varmod-gmtime.mk" line 134: Invalid time value "100000S,1970,bad," -make: "varmod-gmtime.mk" line 134: Malformed conditional (${%Y:L:gmtime=100000S,1970,bad,} != "bad") +make: "varmod-gmtime.mk" line 61: 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: Malformed conditional (${:L:gmtime= 1} != "") +make: "varmod-gmtime.mk" line 120: 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: Malformed conditional (${:L:gmtime=error} != "") +make: "varmod-gmtime.mk" line 144: 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 exit status 1 diff --git a/usr.bin/make/unit-tests/varmod-gmtime.mk b/usr.bin/make/unit-tests/varmod-gmtime.mk index 639c95b24f6..9f68501fa12 100644 --- a/usr.bin/make/unit-tests/varmod-gmtime.mk +++ b/usr.bin/make/unit-tests/varmod-gmtime.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-gmtime.mk,v 1.14 2023/05/10 15:53:32 rillig Exp $ +# $NetBSD: varmod-gmtime.mk,v 1.15 2023/06/01 20:56:35 rillig Exp $ # # Tests for the :gmtime variable modifier, which formats a timestamp # using strftime(3) in UTC. @@ -56,6 +56,8 @@ # 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+1: Malformed conditional (${:L:gmtime=-1} != "") .if ${:L:gmtime=-1} != "" . error .else @@ -65,6 +67,8 @@ # 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+1: Malformed conditional (${:L:gmtime= 1} != "") .if ${:L:gmtime= 1} != "" . error .else @@ -111,6 +115,8 @@ # # 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+1: Malformed conditional (${:L:gmtime=10000000000000000000000000000000} != "") .if ${:L:gmtime=10000000000000000000000000000000} != "" . error .else @@ -122,6 +128,8 @@ # 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+1: Malformed conditional (${:L:gmtime=error} != "") .if ${:L:gmtime=error} != "" . error .else @@ -131,6 +139,8 @@ # 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+1: Malformed conditional (${%Y:L:gmtime=100000S,1970,bad,} != "bad") .if ${%Y:L:gmtime=100000S,1970,bad,} != "bad" . error .endif diff --git a/usr.bin/make/unit-tests/varmod-ifelse.exp b/usr.bin/make/unit-tests/varmod-ifelse.exp index 94cbcbdeae8..5b83ed49a75 100644 --- a/usr.bin/make/unit-tests/varmod-ifelse.exp +++ b/usr.bin/make/unit-tests/varmod-ifelse.exp @@ -1,32 +1,32 @@ make: Bad conditional expression 'variable expression == "literal"' in 'variable expression == "literal"?bad:bad' -make: "varmod-ifelse.mk" line 27: Malformed conditional (${${:Uvariable expression} == "literal":?bad:bad}) +make: "varmod-ifelse.mk" line 28: Malformed conditional (${${:Uvariable expression} == "literal":?bad:bad}) make: Bad conditional expression ' == ""' in ' == ""?bad-assign:bad-assign' make: Bad conditional expression ' == ""' in ' == ""?bad-cond:bad-cond' -make: "varmod-ifelse.mk" line 44: Malformed conditional (${${UNDEF} == "":?bad-cond:bad-cond}) +make: "varmod-ifelse.mk" line 46: Malformed conditional (${${UNDEF} == "":?bad-cond:bad-cond}) make: Bad conditional expression '1 == == 2' in '1 == == 2?yes:no' -make: "varmod-ifelse.mk" line 66: Malformed conditional (${1 == == 2:?yes:no} != "") +make: "varmod-ifelse.mk" line 69: Malformed conditional (${1 == == 2:?yes:no} != "") CondParser_Eval: "${1 == == 2:?yes:no}" != "" CondParser_Eval: 1 == == 2 Comparing 1.000000 == 0.000000 make: Bad conditional expression '1 == == 2' in '1 == == 2?yes:no' Comparing "" != "" -make: "varmod-ifelse.mk" line 92: warning: Oops, the parse error should have been propagated. +make: "varmod-ifelse.mk" line 96: warning: Oops, the parse error should have been propagated. CondParser_Eval: ${ ${:U\$}{VAR} == value:?ok:bad} != "ok" CondParser_Eval: ${VAR} == value Comparing "value" == "value" Comparing "ok" != "ok" -make: "varmod-ifelse.mk" line 153: no. -make: "varmod-ifelse.mk" line 154: Comparison with '>=' requires both operands 'no' and '10' to be numeric +make: "varmod-ifelse.mk" line 158: no. +make: "varmod-ifelse.mk" line 161: Comparison with '>=' requires both operands 'no' and '10' to be numeric make: Bad conditional expression 'string == "literal" || no >= 10' in 'string == "literal" || no >= 10?yes:no' -make: "varmod-ifelse.mk" line 154: . +make: "varmod-ifelse.mk" line 161: . make: Bad conditional expression 'string == "literal" && >= 10' in 'string == "literal" && >= 10?yes:no' -make: "varmod-ifelse.mk" line 159: . +make: "varmod-ifelse.mk" line 167: . make: Bad conditional expression 'string == "literal" || >= 10' in 'string == "literal" || >= 10?yes:no' -make: "varmod-ifelse.mk" line 160: . -make: "varmod-ifelse.mk" line 167: true -make: "varmod-ifelse.mk" line 169: false +make: "varmod-ifelse.mk" line 169: . +make: "varmod-ifelse.mk" line 177: true +make: "varmod-ifelse.mk" line 180: false make: Bad conditional expression ' ' in ' ?true:false' -make: "varmod-ifelse.mk" line 171: +make: "varmod-ifelse.mk" line 182: CondParser_Eval: 0 && ${1:?${:Uthen0:S,}},,}:${:Uelse0:S,}},,}} != "not evaluated" CondParser_Eval: 1 && ${0:?${:Uthen1:S,}},,}:${:Uelse1:S,}},,}} != "else1" CondParser_Eval: 0 diff --git a/usr.bin/make/unit-tests/varmod-ifelse.mk b/usr.bin/make/unit-tests/varmod-ifelse.mk index 0df45cae687..1a71cab5c7a 100644 --- a/usr.bin/make/unit-tests/varmod-ifelse.mk +++ b/usr.bin/make/unit-tests/varmod-ifelse.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-ifelse.mk,v 1.21 2023/02/18 18:23:58 rillig Exp $ +# $NetBSD: varmod-ifelse.mk,v 1.22 2023/06/01 20:56:35 rillig Exp $ # # Tests for the ${cond:?then:else} variable modifier, which evaluates either # the then-expression or the else-expression, depending on the condition. @@ -24,6 +24,7 @@ # Evaluating the variable name lazily would require additional code in # Var_Parse and ParseVarname, it would be more useful and predictable # though. +# expect+1: Malformed conditional (${${:Uvariable expression} == "literal":?bad:bad}) .if ${${:Uvariable expression} == "literal":?bad:bad} . error .else @@ -41,6 +42,7 @@ COND:= ${${UNDEF} == "":?bad-assign:bad-assign} # "Undefined variable" error message is generated. # The difference to the ':=' variable assignment is the additional # "Malformed conditional" error message. +# expect+1: Malformed conditional (${${UNDEF} == "":?bad-cond:bad-cond}) .if ${${UNDEF} == "":?bad-cond:bad-cond} . error .else @@ -63,6 +65,7 @@ COND:= ${${UNDEF} == "":?bad-assign:bad-assign} # conditional therefore returns a parse error from Var_Parse, and this parse # error propagates to CondEvalExpression, where the "Malformed conditional" # comes from. +# expect+1: Malformed conditional (${1 == == 2:?yes:no} != "") .if ${1 == == 2:?yes:no} != "" . error .else @@ -89,6 +92,7 @@ COND:= ${${UNDEF} == "":?bad-assign:bad-assign} .if "${1 == == 2:?yes:no}" != "" . error .else +# expect+1: warning: Oops, the parse error should have been propagated. . warning Oops, the parse error should have been propagated. .endif .MAKEFLAGS: -d0 @@ -150,13 +154,18 @@ VAR= value # instead of just saying that the whole condition is bad. STRING= string NUMBER= no # not really a number +# expect+1: no. .info ${${STRING} == "literal" && ${NUMBER} >= 10:?yes:no}. +# expect+2: . +# expect+1: Comparison with '>=' requires both operands 'no' and '10' to be numeric .info ${${STRING} == "literal" || ${NUMBER} >= 10:?yes:no}. # The following situation occasionally occurs with MKINET6 or similar # variables. NUMBER= # empty, not really a number either +# expect+1: . .info ${${STRING} == "literal" && ${NUMBER} >= 10:?yes:no}. +# expect+1: . .info ${${STRING} == "literal" || ${NUMBER} >= 10:?yes:no}. # CondParser_LeafToken handles [0-9-+] specially, treating them as a number. @@ -164,8 +173,10 @@ PLUS= + ASTERISK= * EMPTY= # empty # "true" since "+" is not the empty string. +# expect+1: true .info ${${PLUS} :?true:false} # "false" since the variable named "*" is not defined. +# expect+1: false .info ${${ASTERISK} :?true:false} # syntax error since the condition is completely blank. .info ${${EMPTY} :?true:false} diff --git a/usr.bin/make/unit-tests/varmod-indirect.exp b/usr.bin/make/unit-tests/varmod-indirect.exp index 46fa1af7a8c..ecf52033ee4 100644 --- a/usr.bin/make/unit-tests/varmod-indirect.exp +++ b/usr.bin/make/unit-tests/varmod-indirect.exp @@ -1,20 +1,20 @@ make: "varmod-indirect.mk" line 19: Unknown modifier "${" make: "varmod-indirect.mk" line 52: Unknown modifier "${" -make: "varmod-indirect.mk" line 53: 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 140: before -make: "varmod-indirect.mk" line 140: after -make: "varmod-indirect.mk" line 146: before -make: "varmod-indirect.mk" line 146: after -make: "varmod-indirect.mk" line 152: before -make: "varmod-indirect.mk" line 152: after -make: "varmod-indirect.mk" line 156: Unknown modifier "Z" -make: "varmod-indirect.mk" line 157: before -make: "varmod-indirect.mk" line 157: after -Parsing line 166: _:= before ${UNDEF} after +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 +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 167: before +make: "varmod-indirect.mk" line 167: after +Parsing line 176: _:= before ${UNDEF} after Global: _ = # (empty) Var_Parse: ${UNDEF} after (eval-keep-dollar-and-undefined) Global: _ = before ${UNDEF} after -Parsing line 169: _:= before ${UNDEF:${:US,a,a,}} after +Parsing line 179: _:= before ${UNDEF:${:US,a,a,}} after Var_Parse: ${UNDEF:${:US,a,a,}} after (eval-keep-dollar-and-undefined) Indirect modifier "S,a,a," from "${:US,a,a,}" Evaluating modifier ${UNDEF:S...} on value "" (eval-keep-dollar-and-undefined, undefined) @@ -23,18 +23,18 @@ Modifier part: "a" ModifyWords: split "" into 1 word Result of ${UNDEF:S,a,a,} is "" (eval-keep-dollar-and-undefined, undefined) Global: _ = before ${UNDEF:S,a,a,} after -Parsing line 179: _:= before ${UNDEF:${:U}} after +Parsing line 189: _:= before ${UNDEF:${:U}} after Var_Parse: ${UNDEF:${:U}} after (eval-keep-dollar-and-undefined) Indirect modifier "" from "${:U}" Global: _ = before ${UNDEF:} after -Parsing line 184: _:= before ${UNDEF:${:UZ}} after +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 184: Unknown modifier "Z" +make: "varmod-indirect.mk" line 195: Unknown modifier "Z" Result of ${UNDEF:Z} is error (eval-keep-dollar-and-undefined, undefined) Global: _ = before ${UNDEF:Z} after -Parsing line 186: .MAKEFLAGS: -d0 +Parsing line 197: .MAKEFLAGS: -d0 ParseDependency(.MAKEFLAGS: -d0) Global: .MAKEFLAGS = -r -k -d 0 -d pv -d Global: .MAKEFLAGS = -r -k -d 0 -d pv -d 0 diff --git a/usr.bin/make/unit-tests/varmod-indirect.mk b/usr.bin/make/unit-tests/varmod-indirect.mk index 082efb035c7..f79f041cd1e 100644 --- a/usr.bin/make/unit-tests/varmod-indirect.mk +++ b/usr.bin/make/unit-tests/varmod-indirect.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-indirect.mk,v 1.11 2022/01/15 12:35:18 rillig Exp $ +# $NetBSD: varmod-indirect.mk,v 1.12 2023/06/01 20:56:35 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 @@ -50,6 +50,7 @@ # expect+2: 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. . warning FIXME: this expression should have resulted in a parse $\ error rather than returning the unparsed portion of the $\ expression. @@ -137,23 +138,32 @@ M_NoPrimes= ${PRIMES:${M_ListToSkip}} # An undefined expression without any modifiers expands to an empty string. .for var in before ${UNDEF} after +# expect+2: before +# expect+1: after . info ${var} .endfor # An undefined expression with only modifiers that keep the expression # undefined expands to an empty string. .for var in before ${UNDEF:${:US,a,a,}} after +# expect+2: before +# expect+1: after . info ${var} .endfor # Even in an indirect modifier based on an undefined variable, the value of # the expression in Var_Parse is a simple empty string. .for var in before ${UNDEF:${:U}} after +# expect+2: before +# expect+1: after . info ${var} .endfor # An error in an indirect modifier. +# expect+1: Unknown modifier "Z" .for var in before ${UNDEF:${:UZ}} after +# expect+2: before +# expect+1: after . info ${var} .endfor @@ -181,6 +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 variable expression ${_} is # parsed but not evaluated. +# expect+1: Unknown modifier "Z" _:= before ${UNDEF:${:UZ}} after .MAKEFLAGS: -d0 diff --git a/usr.bin/make/unit-tests/varmod-localtime.exp b/usr.bin/make/unit-tests/varmod-localtime.exp index c734c234f08..a7c3ff6ab93 100644 --- a/usr.bin/make/unit-tests/varmod-localtime.exp +++ b/usr.bin/make/unit-tests/varmod-localtime.exp @@ -1,13 +1,13 @@ -make: "varmod-localtime.mk" line 59: Invalid time value "-1" -make: "varmod-localtime.mk" line 59: Malformed conditional (${:L:localtime=-1} != "") -make: "varmod-localtime.mk" line 68: Invalid time value " 1" -make: "varmod-localtime.mk" line 68: Malformed conditional (${:L:localtime= 1} != "") -make: "varmod-localtime.mk" line 114: Invalid time value "10000000000000000000000000000000" -make: "varmod-localtime.mk" line 114: Malformed conditional (${:L:localtime=10000000000000000000000000000000} != "") -make: "varmod-localtime.mk" line 125: Invalid time value "error" -make: "varmod-localtime.mk" line 125: Malformed conditional (${:L:localtime=error} != "") -make: "varmod-localtime.mk" line 134: Invalid time value "100000S,1970,bad," -make: "varmod-localtime.mk" line 134: Malformed conditional (${%Y:L:localtime=100000S,1970,bad,} != "bad") +make: "varmod-localtime.mk" line 61: 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: Malformed conditional (${:L:localtime= 1} != "") +make: "varmod-localtime.mk" line 120: 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: Malformed conditional (${:L:localtime=error} != "") +make: "varmod-localtime.mk" line 144: 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 exit status 1 diff --git a/usr.bin/make/unit-tests/varmod-localtime.mk b/usr.bin/make/unit-tests/varmod-localtime.mk index b9386b94998..3d409784475 100644 --- a/usr.bin/make/unit-tests/varmod-localtime.mk +++ b/usr.bin/make/unit-tests/varmod-localtime.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-localtime.mk,v 1.12 2023/05/10 15:53:32 rillig Exp $ +# $NetBSD: varmod-localtime.mk,v 1.13 2023/06/01 20:56:35 rillig Exp $ # # Tests for the :localtime variable modifier, which formats a timestamp # using strftime(3) in local time. @@ -56,6 +56,8 @@ # 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+1: Malformed conditional (${:L:localtime=-1} != "") .if ${:L:localtime=-1} != "" . error .else @@ -65,6 +67,8 @@ # 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+1: Malformed conditional (${:L:localtime= 1} != "") .if ${:L:localtime= 1} != "" . error .else @@ -111,6 +115,8 @@ # # 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+1: Malformed conditional (${:L:localtime=10000000000000000000000000000000} != "") .if ${:L:localtime=10000000000000000000000000000000} != "" . error .else @@ -122,6 +128,8 @@ # 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+1: Malformed conditional (${:L:localtime=error} != "") .if ${:L:localtime=error} != "" . error .else @@ -131,6 +139,8 @@ # 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+1: Malformed conditional (${%Y:L:localtime=100000S,1970,bad,} != "bad") .if ${%Y:L:localtime=100000S,1970,bad,} != "bad" . error .endif diff --git a/usr.bin/make/unit-tests/varmod-loop-delete.exp b/usr.bin/make/unit-tests/varmod-loop-delete.exp index aac86ee3906..47a2f74545a 100644 --- a/usr.bin/make/unit-tests/varmod-loop-delete.exp +++ b/usr.bin/make/unit-tests/varmod-loop-delete.exp @@ -1,4 +1,4 @@ -make: "varmod-loop-delete.mk" line 19: Cannot delete variable "VAR" while it is used +make: "varmod-loop-delete.mk" line 20: 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/usr.bin/make/unit-tests/varmod-loop-delete.mk b/usr.bin/make/unit-tests/varmod-loop-delete.mk index ed145b59ba0..1ec6d361949 100644 --- a/usr.bin/make/unit-tests/varmod-loop-delete.mk +++ b/usr.bin/make/unit-tests/varmod-loop-delete.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-loop-delete.mk,v 1.2 2021/12/05 15:51:33 rillig Exp $ +# $NetBSD: varmod-loop-delete.mk,v 1.3 2023/06/01 20:56:35 rillig Exp $ # # Tests for the variable modifier ':@', which as a side effect allows to # delete an arbitrary variable. @@ -16,6 +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 EVAL:= ${VAR} .if ${EVAL} != " rest of the value" . error diff --git a/usr.bin/make/unit-tests/varmod-loop-varname.exp b/usr.bin/make/unit-tests/varmod-loop-varname.exp index 4f0379d5ea0..2060b51c31d 100644 --- a/usr.bin/make/unit-tests/varmod-loop-varname.exp +++ b/usr.bin/make/unit-tests/varmod-loop-varname.exp @@ -1,11 +1,11 @@ -make: "varmod-loop-varname.mk" line 16: In the :@ modifier of "", the variable name "${:Ubar:S,b,v,}" must not contain a dollar -make: "varmod-loop-varname.mk" line 16: Malformed conditional (${:Uone two three:@${:Ubar:S,b,v,}@+${var}+@} != "+one+ +two+ +three+") -make: "varmod-loop-varname.mk" line 85: In the :@ modifier of "1 2 3", the variable name "v$" must not contain a dollar -make: "varmod-loop-varname.mk" line 85: Malformed conditional (${1 2 3:L:@v$@($v)@} != "(1) (2) (3)") -make: "varmod-loop-varname.mk" line 90: In the :@ modifier of "1 2 3", the variable name "v$$" must not contain a dollar -make: "varmod-loop-varname.mk" line 90: Malformed conditional (${1 2 3:L:@v$$@($v)@} != "() () ()") -make: "varmod-loop-varname.mk" line 95: In the :@ modifier of "1 2 3", the variable name "v$$$" must not contain a dollar -make: "varmod-loop-varname.mk" line 95: Malformed conditional (${1 2 3:L:@v$$$@($v)@} != "() () ()") +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: 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: 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: 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: Malformed conditional (${1 2 3:L:@v$$$@($v)@} != "() () ()") make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/varmod-loop-varname.mk b/usr.bin/make/unit-tests/varmod-loop-varname.mk index 91f8a487646..43c72cee3ee 100644 --- a/usr.bin/make/unit-tests/varmod-loop-varname.mk +++ b/usr.bin/make/unit-tests/varmod-loop-varname.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-loop-varname.mk,v 1.4 2021/12/05 15:01:04 rillig Exp $ +# $NetBSD: varmod-loop-varname.mk,v 1.5 2023/06/01 20:56:35 rillig Exp $ # # Tests for the first part of the variable modifier ':@var@...@', which # contains the variable name to use during the loop. @@ -13,6 +13,8 @@ # 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+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 .else @@ -82,16 +84,22 @@ 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+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+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+1: Malformed conditional (${1 2 3:L:@v$$$@($v)@} != "() () ()") .if ${1 2 3:L:@v$$$@($v)@} != "() () ()" . error .else diff --git a/usr.bin/make/unit-tests/varmod-match-escape.exp b/usr.bin/make/unit-tests/varmod-match-escape.exp index 25cf6c0719d..5ebbf20f4a8 100644 --- a/usr.bin/make/unit-tests/varmod-match-escape.exp +++ b/usr.bin/make/unit-tests/varmod-match-escape.exp @@ -30,10 +30,10 @@ Pattern for ':M' is ":\:" ModifyWords: split ": :: :\:" into 3 words Result of ${VALUES:M${:U\:}\:} is "::" Comparing ":" != "::" -make: "varmod-match-escape.mk" line 42: warning: XXX: Oops +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 67: Dollar followed by nothing +make: "varmod-match-escape.mk" line 69: Dollar followed by nothing make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/varmod-match-escape.mk b/usr.bin/make/unit-tests/varmod-match-escape.mk index 5ac69f964a6..cff09ccf8f6 100644 --- a/usr.bin/make/unit-tests/varmod-match-escape.mk +++ b/usr.bin/make/unit-tests/varmod-match-escape.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-match-escape.mk,v 1.7 2021/04/03 11:08:40 rillig Exp $ +# $NetBSD: varmod-match-escape.mk,v 1.8 2023/06/01 20:56:35 rillig Exp $ # # As of 2020-08-01, the :M and :N modifiers interpret backslashes differently, # depending on whether there was a variable expression somewhere before the @@ -39,6 +39,7 @@ SPECIALS= \: : \\ * \* # VALUES= : :: :\: .if ${VALUES:M\:${:U\:}} != ${VALUES:M${:U\:}\:} +# expect+1: warning: XXX: Oops . warning XXX: Oops .endif @@ -64,6 +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 .if ${:U\$:M\$} != "" . error .endif diff --git a/usr.bin/make/unit-tests/varmod-order.exp b/usr.bin/make/unit-tests/varmod-order.exp index e5d03f887fc..487243a1678 100644 --- a/usr.bin/make/unit-tests/varmod-order.exp +++ b/usr.bin/make/unit-tests/varmod-order.exp @@ -1,26 +1,26 @@ make: Bad modifier ":OX" for variable "WORDS" -make: "varmod-order.mk" line 14: Undefined variable "${WORDS:OX" +make: "varmod-order.mk" line 16: Undefined variable "${WORDS:OX" make: Bad modifier ":OxXX" for variable "WORDS" -make: "varmod-order.mk" line 17: Undefined variable "${WORDS:Ox" +make: "varmod-order.mk" line 21: Undefined variable "${WORDS:Ox" make: Unclosed variable expression, expecting '}' for modifier "O" of variable "WORDS" with value "eight five four nine one seven six ten three two" make: Unclosed variable expression, expecting '}' for modifier "On" of variable "NUMBERS" with value "1 2 3 4 5 6 7 8 9 10" make: Unclosed variable expression, expecting '}' for modifier "Onr" of variable "NUMBERS" with value "10 9 8 7 6 5 4 3 2 1" make: Bad modifier ":Oxn" for variable "NUMBERS" -make: "varmod-order.mk" line 29: Malformed conditional (${NUMBERS:Oxn}) +make: "varmod-order.mk" line 33: Malformed conditional (${NUMBERS:Oxn}) make: Bad modifier ":On_typo" for variable "NUMBERS" -make: "varmod-order.mk" line 39: Malformed conditional (${NUMBERS:On_typo}) +make: "varmod-order.mk" line 44: Malformed conditional (${NUMBERS:On_typo}) make: Bad modifier ":Onr_typo" for variable "NUMBERS" -make: "varmod-order.mk" line 48: Malformed conditional (${NUMBERS:Onr_typo}) +make: "varmod-order.mk" line 54: Malformed conditional (${NUMBERS:Onr_typo}) make: Bad modifier ":Orn_typo" for variable "NUMBERS" -make: "varmod-order.mk" line 57: Malformed conditional (${NUMBERS:Orn_typo}) +make: "varmod-order.mk" line 64: Malformed conditional (${NUMBERS:Orn_typo}) make: Bad modifier ":Onn" for variable "NUMBERS" -make: "varmod-order.mk" line 68: Malformed conditional (${NUMBERS:Onn}) +make: "varmod-order.mk" line 76: Malformed conditional (${NUMBERS:Onn}) make: Bad modifier ":Onrr" for variable "NUMBERS" -make: "varmod-order.mk" line 77: Malformed conditional (${NUMBERS:Onrr}) +make: "varmod-order.mk" line 86: Malformed conditional (${NUMBERS:Onrr}) make: Bad modifier ":Orrn" for variable "NUMBERS" -make: "varmod-order.mk" line 86: Malformed conditional (${NUMBERS:Orrn}) +make: "varmod-order.mk" line 96: Malformed conditional (${NUMBERS:Orrn}) make: Bad modifier ":On=Off" for variable "SWITCH" -make: "varmod-order.mk" line 100: Malformed conditional (${SWITCH:On=Off} != "Off") +make: "varmod-order.mk" line 111: Malformed conditional (${SWITCH:On=Off} != "Off") make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/varmod-order.mk b/usr.bin/make/unit-tests/varmod-order.mk index b4d5452263c..67919543a93 100644 --- a/usr.bin/make/unit-tests/varmod-order.mk +++ b/usr.bin/make/unit-tests/varmod-order.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-order.mk,v 1.10 2023/02/27 08:29:36 rillig Exp $ +# $NetBSD: varmod-order.mk,v 1.11 2023/06/01 20:56:35 rillig Exp $ # # Tests for the :O variable modifier and its variants, which either sort the # words of the value or shuffle them. @@ -11,9 +11,13 @@ NUMBERS= 8 5 4 9 1 7 6 10 3 2 # in English alphabetical order .endif # Unknown modifier "OX" +# FIXME: The error message is wrong. +# expect+1: Undefined variable "${WORDS:OX" _:= ${WORDS:OX} # Unknown modifier "OxXX" +# FIXME: The error message is wrong. +# expect+1: Undefined variable "${WORDS:Ox" _:= ${WORDS:OxXX} # Missing closing brace, to cover the error handling code. @@ -36,6 +40,7 @@ _:= ${NUMBERS:Onr # TODO: Add line number information to the "Bad modifier" diagnostic. # # expect: make: Bad modifier ":On_typo" for variable "NUMBERS" +# expect+1: Malformed conditional (${NUMBERS:On_typo}) .if ${NUMBERS:On_typo} . error .else @@ -45,6 +50,7 @@ _:= ${NUMBERS:Onr # Extra characters after ':Onr' are detected and diagnosed. # # expect: make: Bad modifier ":Onr_typo" for variable "NUMBERS" +# expect+1: Malformed conditional (${NUMBERS:Onr_typo}) .if ${NUMBERS:Onr_typo} . error .else @@ -54,6 +60,7 @@ _:= ${NUMBERS:Onr # Extra characters after ':Orn' are detected and diagnosed. # # expect: make: Bad modifier ":Orn_typo" for variable "NUMBERS" +# expect+1: Malformed conditional (${NUMBERS:Orn_typo}) .if ${NUMBERS:Orn_typo} . error .else @@ -65,6 +72,7 @@ _:= ${NUMBERS:Onr # not make sense. # # expect: make: Bad modifier ":Onn" for variable "NUMBERS" +# expect+1: Malformed conditional (${NUMBERS:Onn}) .if ${NUMBERS:Onn} . error .else @@ -74,6 +82,7 @@ _:= ${NUMBERS:Onr # Repeating the 'r' is not supported as well, for the same reasons as above. # # expect: make: Bad modifier ":Onrr" for variable "NUMBERS" +# expect+1: Malformed conditional (${NUMBERS:Onrr}) .if ${NUMBERS:Onrr} . error .else @@ -83,6 +92,7 @@ _:= ${NUMBERS:Onr # Repeating the 'r' is not supported as well, for the same reasons as above. # # expect: make: Bad modifier ":Orrn" for variable "NUMBERS" +# expect+1: Malformed conditional (${NUMBERS:Orrn}) .if ${NUMBERS:Orrn} . error .else @@ -97,6 +107,7 @@ _:= ${NUMBERS:Onr # There is no such fallback for the ':O' modifiers. SWITCH= On # expect: make: Bad modifier ":On=Off" for variable "SWITCH" +# expect+1: Malformed conditional (${SWITCH:On=Off} != "Off") .if ${SWITCH:On=Off} != "Off" . error .else diff --git a/usr.bin/make/unit-tests/varmod-range.exp b/usr.bin/make/unit-tests/varmod-range.exp index f4ada11ebde..b6226ec82c5 100644 --- a/usr.bin/make/unit-tests/varmod-range.exp +++ b/usr.bin/make/unit-tests/varmod-range.exp @@ -1,13 +1,13 @@ -make: "varmod-range.mk" line 53: Invalid number "x}Rest" != "Rest"" for ':range' modifier -make: "varmod-range.mk" line 53: Malformed conditional ("${:U:range=x}Rest" != "Rest") -make: "varmod-range.mk" line 62: Unknown modifier "x0" -make: "varmod-range.mk" line 62: Malformed conditional ("${:U:range=0x0}Rest" != "Rest") -make: "varmod-range.mk" line 78: Unknown modifier "rang" -make: "varmod-range.mk" line 78: Malformed conditional ("${a b c:L:rang}Rest" != "Rest") -make: "varmod-range.mk" line 85: Unknown modifier "rango" -make: "varmod-range.mk" line 85: Malformed conditional ("${a b c:L:rango}Rest" != "Rest") -make: "varmod-range.mk" line 92: Unknown modifier "ranger" -make: "varmod-range.mk" line 92: Malformed conditional ("${a b c:L:ranger}Rest" != "Rest") +make: "varmod-range.mk" line 55: Invalid number "x}Rest" != "Rest"" for ':range' modifier +make: "varmod-range.mk" line 55: Malformed conditional ("${:U:range=x}Rest" != "Rest") +make: "varmod-range.mk" line 66: Unknown modifier "x0" +make: "varmod-range.mk" line 66: Malformed conditional ("${:U:range=0x0}Rest" != "Rest") +make: "varmod-range.mk" line 84: Unknown modifier "rang" +make: "varmod-range.mk" line 84: Malformed conditional ("${a b c:L:rang}Rest" != "Rest") +make: "varmod-range.mk" line 93: Unknown modifier "rango" +make: "varmod-range.mk" line 93: Malformed conditional ("${a b c:L:rango}Rest" != "Rest") +make: "varmod-range.mk" line 102: Unknown modifier "ranger" +make: "varmod-range.mk" line 102: Malformed conditional ("${a b c:L:ranger}Rest" != "Rest") make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/varmod-range.mk b/usr.bin/make/unit-tests/varmod-range.mk index d63525248e5..86ef11a59ea 100644 --- a/usr.bin/make/unit-tests/varmod-range.mk +++ b/usr.bin/make/unit-tests/varmod-range.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-range.mk,v 1.7 2020/11/01 14:36:25 rillig Exp $ +# $NetBSD: varmod-range.mk,v 1.8 2023/06/01 20:56:35 rillig Exp $ # # Tests for the :range variable modifier, which generates sequences # of integers from the given range. @@ -50,6 +50,8 @@ # # 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+1: Malformed conditional ("${:U:range=x}Rest" != "Rest") .if "${:U:range=x}Rest" != "Rest" . error .else @@ -59,6 +61,8 @@ # 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+1: Malformed conditional ("${:U:range=0x0}Rest" != "Rest") .if "${:U:range=0x0}Rest" != "Rest" . error .else @@ -75,6 +79,8 @@ #.endif # modifier name too short +# expect+2: Unknown modifier "rang" +# expect+1: Malformed conditional ("${a b c:L:rang}Rest" != "Rest") .if "${a b c:L:rang}Rest" != "Rest" . error .else @@ -82,6 +88,8 @@ .endif # misspelled modifier name +# expect+2: Unknown modifier "rango" +# expect+1: Malformed conditional ("${a b c:L:rango}Rest" != "Rest") .if "${a b c:L:rango}Rest" != "Rest" . error .else @@ -89,6 +97,8 @@ .endif # modifier name too long +# expect+2: Unknown modifier "ranger" +# expect+1: Malformed conditional ("${a b c:L:ranger}Rest" != "Rest") .if "${a b c:L:ranger}Rest" != "Rest" . error .else diff --git a/usr.bin/make/unit-tests/varmod-subst.mk b/usr.bin/make/unit-tests/varmod-subst.mk index e0f138c6593..00cae5b9399 100644 --- a/usr.bin/make/unit-tests/varmod-subst.mk +++ b/usr.bin/make/unit-tests/varmod-subst.mk @@ -1,9 +1,7 @@ -# $NetBSD: varmod-subst.mk,v 1.10 2023/06/01 07:27:30 rillig Exp $ +# $NetBSD: varmod-subst.mk,v 1.11 2023/06/01 20:56:35 rillig Exp $ # # Tests for the :S,from,to, variable modifier. -# expect-all - all: mod-subst all: mod-subst-delimiter all: mod-subst-chain diff --git a/usr.bin/make/unit-tests/varmod-sysv.exp b/usr.bin/make/unit-tests/varmod-sysv.exp index 59275857f98..6a3728c3c0f 100644 --- a/usr.bin/make/unit-tests/varmod-sysv.exp +++ b/usr.bin/make/unit-tests/varmod-sysv.exp @@ -1,5 +1,5 @@ make: Unfinished modifier for "word214" ('=' missing) -make: "varmod-sysv.mk" line 214: Malformed conditional (${word214:L:from${:D=}to}) +make: "varmod-sysv.mk" line 215: Malformed conditional (${word214:L:from${:D=}to}) word modifier result '' = "" suffix = "suffix" diff --git a/usr.bin/make/unit-tests/varmod-sysv.mk b/usr.bin/make/unit-tests/varmod-sysv.mk index 712c1731717..78651ea869d 100644 --- a/usr.bin/make/unit-tests/varmod-sysv.mk +++ b/usr.bin/make/unit-tests/varmod-sysv.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-sysv.mk,v 1.14 2021/04/12 16:09:57 rillig Exp $ +# $NetBSD: varmod-sysv.mk,v 1.15 2023/06/01 20:56:35 rillig Exp $ # # Tests for the variable modifier ':from=to', which replaces the suffix # "from" with "to". It can also use '%' as a wildcard. @@ -211,6 +211,7 @@ # XXX: As of 2020-12-05, this expression generates an "Unfinished modifier" # error, while the correct error message would be "Unknown modifier" since # there is no modifier named "fromto". +# expect+1: Malformed conditional (${word214:L:from${:D=}to}) .if ${word214:L:from${:D=}to} . error .endif diff --git a/usr.bin/make/unit-tests/varmod-to-abs.exp b/usr.bin/make/unit-tests/varmod-to-abs.exp index 426b4d39744..4506d5ea817 100644 --- a/usr.bin/make/unit-tests/varmod-to-abs.exp +++ b/usr.bin/make/unit-tests/varmod-to-abs.exp @@ -1,5 +1,5 @@ -make: "varmod-to-abs.mk" line 18: does-not-exist.c make: "varmod-to-abs.mk" line 19: does-not-exist.c +make: "varmod-to-abs.mk" line 21: does-not-exist.c cached_realpath: varmod-to-abs.mk -> varmod-to-abs.mk -make: "varmod-to-abs.mk" line 23: varmod-to-abs.mk +make: "varmod-to-abs.mk" line 26: varmod-to-abs.mk exit status 0 diff --git a/usr.bin/make/unit-tests/varmod-to-abs.mk b/usr.bin/make/unit-tests/varmod-to-abs.mk index 7f23318487e..bc472206898 100644 --- a/usr.bin/make/unit-tests/varmod-to-abs.mk +++ b/usr.bin/make/unit-tests/varmod-to-abs.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-to-abs.mk,v 1.5 2020/11/15 05:48:17 rillig Exp $ +# $NetBSD: varmod-to-abs.mk,v 1.6 2023/06/01 20:56:35 rillig Exp $ # # Tests for the :tA variable modifier, which returns the absolute path for # each of the words in the variable value. @@ -15,11 +15,14 @@ # keeping the cache, just like the GNode for global variables. .MAKEFLAGS: -dd does-not-exist.c= /dev/null +# expect+1: does-not-exist.c .info ${does-not-exist.c:L:tA} +# expect+1: does-not-exist.c .info ${does-not-exist.c:L:tA} # The output of the following line is modified by the global _SED_CMDS in # unit-tests/Makefile. See the .rawout file for the truth. +# expect+1: varmod-to-abs.mk .info ${MAKEFILE:tA} .MAKEFLAGS: -d0 diff --git a/usr.bin/make/unit-tests/varmod-to-separator.exp b/usr.bin/make/unit-tests/varmod-to-separator.exp index bfcfa3ebc10..a7d4ddb2014 100644 --- a/usr.bin/make/unit-tests/varmod-to-separator.exp +++ b/usr.bin/make/unit-tests/varmod-to-separator.exp @@ -1,25 +1,25 @@ -make: "varmod-to-separator.mk" line 153: Invalid character number at "400:tu}" -make: "varmod-to-separator.mk" line 153: Malformed conditional (${WORDS:[1..3]:ts\400:tu}) -make: "varmod-to-separator.mk" line 167: Invalid character number at "100:tu}" -make: "varmod-to-separator.mk" line 167: Malformed conditional (${WORDS:[1..3]:ts\x100:tu}) +make: "varmod-to-separator.mk" line 155: 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: Malformed conditional (${WORDS:[1..3]:ts\x100:tu}) make: Bad modifier ":ts\-300" for variable "WORDS" -make: "varmod-to-separator.mk" line 174: Malformed conditional (${WORDS:[1..3]:ts\-300:tu}) +make: "varmod-to-separator.mk" line 179: Malformed conditional (${WORDS:[1..3]:ts\-300:tu}) make: Bad modifier ":ts\8" for variable "1 2 3" -make: "varmod-to-separator.mk" line 182: Malformed conditional (${1 2 3:L:ts\8:tu}) +make: "varmod-to-separator.mk" line 188: Malformed conditional (${1 2 3:L:ts\8:tu}) make: Bad modifier ":ts\100L" for variable "1 2 3" -make: "varmod-to-separator.mk" line 189: Malformed conditional (${1 2 3:L:ts\100L}) +make: "varmod-to-separator.mk" line 196: Malformed conditional (${1 2 3:L:ts\100L}) make: Bad modifier ":ts\x40g" for variable "1 2 3" -make: "varmod-to-separator.mk" line 196: Malformed conditional (${1 2 3:L:ts\x40g}) +make: "varmod-to-separator.mk" line 204: Malformed conditional (${1 2 3:L:ts\x40g}) make: Bad modifier ":tx" for variable "WORDS" -make: "varmod-to-separator.mk" line 205: Malformed conditional (${WORDS:tx}) +make: "varmod-to-separator.mk" line 214: Malformed conditional (${WORDS:tx}) make: Bad modifier ":ts\X" for variable "WORDS" -make: "varmod-to-separator.mk" line 213: Malformed conditional (${WORDS:ts\X}) +make: "varmod-to-separator.mk" line 223: Malformed conditional (${WORDS:ts\X}) make: Bad modifier ":t\X" for variable "WORDS" -make: "varmod-to-separator.mk" line 221: Malformed conditional (${WORDS:t\X} != "anything") +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 237: Malformed conditional (${:Ua b:ts\69}) -make: "varmod-to-separator.mk" line 246: Invalid character number at "1F60E}" -make: "varmod-to-separator.mk" line 246: Malformed conditional (${:Ua b:ts\x1F60E}) +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: Malformed conditional (${:Ua b:ts\x1F60E}) make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/varmod-to-separator.mk b/usr.bin/make/unit-tests/varmod-to-separator.mk index bf960639f83..f17dece447a 100644 --- a/usr.bin/make/unit-tests/varmod-to-separator.mk +++ b/usr.bin/make/unit-tests/varmod-to-separator.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-to-separator.mk,v 1.11 2022/02/09 21:09:24 rillig Exp $ +# $NetBSD: varmod-to-separator.mk,v 1.12 2023/06/01 20:56:35 rillig Exp $ # # Tests for the :ts variable modifier, which joins the words of the variable # using an arbitrary character as word separator. @@ -150,6 +150,8 @@ 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+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. .else @@ -164,6 +166,8 @@ 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+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. .else @@ -171,6 +175,7 @@ WORDS= one two three four five six .endif # Negative numbers are not allowed for the separator character. +# expect+1: Malformed conditional (${WORDS:[1..3]:ts\-300:tu}) .if ${WORDS:[1..3]:ts\-300:tu} . warning The separator \-300 is accepted even though it is negative. .else @@ -179,6 +184,7 @@ WORDS= one two three four five six # The character number is interpreted as octal number by default. # The digit '8' is not an octal digit though. +# expect+1: Malformed conditional (${1 2 3:L:ts\8:tu}) .if ${1 2 3:L:ts\8:tu} . warning The separator \8 is accepted even though it is not octal. .else @@ -186,6 +192,7 @@ WORDS= one two three four five six .endif # Trailing characters after the octal character number are rejected. +# expect+1: Malformed conditional (${1 2 3:L:ts\100L}) .if ${1 2 3:L:ts\100L} . warning The separator \100L is accepted even though it contains an 'L'. .else @@ -193,6 +200,7 @@ WORDS= one two three four five six .endif # Trailing characters after the hexadecimal character number are rejected. +# expect+1: Malformed conditional (${1 2 3:L:ts\x40g}) .if ${1 2 3:L:ts\x40g} . warning The separator \x40g is accepted even though it contains a 'g'. .else @@ -202,6 +210,7 @@ WORDS= one two three four five six # In the :t modifier, the :t must be followed by any of A, l, s, u. # expect: make: Bad modifier ":tx" for variable "WORDS" +# expect+1: Malformed conditional (${WORDS:tx}) .if ${WORDS:tx} . error .else @@ -210,6 +219,7 @@ WORDS= one two three four five six # The word separator can only be a single character. # expect: make: Bad modifier ":ts\X" for variable "WORDS" +# expect+1: Malformed conditional (${WORDS:ts\X}) .if ${WORDS:ts\X} . error .else @@ -218,6 +228,7 @@ WORDS= one two three four five six # After the backslash, only n, t, an octal number, or x and a hexadecimal # number are allowed. +# expect+1: Malformed conditional (${WORDS:t\X} != "anything") .if ${WORDS:t\X} != "anything" . info This line is not reached. .endif @@ -234,6 +245,7 @@ WORDS= one two three four five six # 2016.02.27.16.20.06, the result was '1E2', since 2016.03.07.20.20.35 make no # longer accepts this escape and complains. # expect: make: Bad modifier ":ts\69" for variable "" +# expect+1: Malformed conditional (${:Ua b:ts\69}) .if ${:Ua b:ts\69} . error .else diff --git a/usr.bin/make/unit-tests/varmod.exp b/usr.bin/make/unit-tests/varmod.exp index 3e588dc4d83..19577fa495c 100644 --- a/usr.bin/make/unit-tests/varmod.exp +++ b/usr.bin/make/unit-tests/varmod.exp @@ -1,8 +1,8 @@ -make: "varmod.mk" line 96: To escape a dollar, use \$, not $$, at "$$:L} != """ -make: "varmod.mk" line 96: Invalid variable name ':', at "$:L} != """ -make: "varmod.mk" line 101: Dollar followed by nothing -make: "varmod.mk" line 110: Missing delimiter ':' after modifier "P" -make: "varmod.mk" line 111: Missing argument for ".error" +make: "varmod.mk" line 98: To escape a dollar, use \$, not $$, at "$$:L} != """ +make: "varmod.mk" line 98: Invalid variable name ':', at "$:L} != """ +make: "varmod.mk" line 104: Dollar followed by nothing +make: "varmod.mk" line 114: Missing delimiter ':' after modifier "P" +make: "varmod.mk" line 116: Missing argument for ".error" make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/varmod.mk b/usr.bin/make/unit-tests/varmod.mk index 17bc1e6e3ae..2ed2f6ee7ce 100644 --- a/usr.bin/make/unit-tests/varmod.mk +++ b/usr.bin/make/unit-tests/varmod.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod.mk,v 1.7 2022/08/24 21:38:06 rillig Exp $ +# $NetBSD: varmod.mk,v 1.8 2023/06/01 20:56:35 rillig Exp $ # # Tests for variable modifiers, such as :Q, :S,from,to or :Ufallback. # @@ -93,11 +93,14 @@ DOLLAR2= ${:U\$} # For compatibility, make does not print these error messages in normal mode. # Should it? .MAKEFLAGS: -dL +# expect+2: To escape a dollar, use \$, not $$, at "$$:L} != """ +# expect+1: Invalid variable name ':', at "$:L} != """ .if ${$$:L} != "" . error .endif # A '$' followed by nothing is an error as well. +# expect+1: Dollar followed by nothing .if ${:Uword:@word@${word}$@} != "word" . error .endif @@ -107,7 +110,9 @@ DOLLAR2= ${:U\$} # XXX: The .error should not be reached since the variable expression is # malformed, and this error should be propagated up to Cond_EvalLine. VAR= STOP +# expect+1: Missing delimiter ':' after modifier "P" .if ${VAR:P=RE} != "STORE" +# expect+1: Missing argument for ".error" . error .endif diff --git a/usr.bin/make/unit-tests/varname-dollar.exp b/usr.bin/make/unit-tests/varname-dollar.exp index c880e82f017..4f7c2ebbdf1 100644 --- a/usr.bin/make/unit-tests/varname-dollar.exp +++ b/usr.bin/make/unit-tests/varname-dollar.exp @@ -1,5 +1,5 @@ -make: "varname-dollar.mk" line 16: dollar is $. -make: "varname-dollar.mk" line 17: dollar in braces is . -make: "varname-dollar.mk" line 25: dollar is $. -make: "varname-dollar.mk" line 26: dollar in braces is dollar. +make: "varname-dollar.mk" line 17: dollar is $. +make: "varname-dollar.mk" line 19: dollar in braces is . +make: "varname-dollar.mk" line 28: dollar is $. +make: "varname-dollar.mk" line 30: dollar in braces is dollar. exit status 0 diff --git a/usr.bin/make/unit-tests/varname-dollar.mk b/usr.bin/make/unit-tests/varname-dollar.mk index d1db9f83330..e60c9dd43e8 100644 --- a/usr.bin/make/unit-tests/varname-dollar.mk +++ b/usr.bin/make/unit-tests/varname-dollar.mk @@ -1,4 +1,4 @@ -# $NetBSD: varname-dollar.mk,v 1.3 2020/08/19 05:40:06 rillig Exp $ +# $NetBSD: varname-dollar.mk,v 1.4 2023/06/01 20:56:35 rillig Exp $ # # Tests for the expression "$$", which looks as if it referred to a variable, # but simply expands to a single '$' sign. @@ -13,7 +13,9 @@ DOLLAR= $$ # At this point, the variable '$' is not defined. Therefore the second line # returns an empty string. +# expect+1: dollar is $. .info dollar is $$. +# expect+1: dollar in braces is . .info dollar in braces is ${${DOLLAR}}. # Now overwrite the '$' variable to see whether '$$' really expands to that @@ -22,7 +24,9 @@ ${DOLLAR}= dollar # At this point, the variable '$' is defined, therefore its value is printed # in the second .info directive. +# expect+1: dollar is $. .info dollar is $$. +# expect+1: dollar in braces is dollar. .info dollar in braces is ${${DOLLAR}}. all: diff --git a/usr.bin/make/unit-tests/varname-dot-makeflags.exp b/usr.bin/make/unit-tests/varname-dot-makeflags.exp index 28cc64fd66c..8004ab40a36 100644 --- a/usr.bin/make/unit-tests/varname-dot-makeflags.exp +++ b/usr.bin/make/unit-tests/varname-dot-makeflags.exp @@ -1,9 +1,9 @@ -make: "varname-dot-makeflags.mk" line 10: MAKEFLAGS=<undefined> -make: "varname-dot-makeflags.mk" line 11: .MAKEFLAGS=< -r -k> -make: "varname-dot-makeflags.mk" line 12: .MAKEOVERRIDES=<> -make: "varname-dot-makeflags.mk" line 18: MAKEFLAGS=<undefined> -make: "varname-dot-makeflags.mk" line 20: .MAKEFLAGS=< -r -k -D VARNAME -r> -make: "varname-dot-makeflags.mk" line 22: .MAKEOVERRIDES=< VAR> +make: "varname-dot-makeflags.mk" line 11: MAKEFLAGS=<undefined> +make: "varname-dot-makeflags.mk" line 13: .MAKEFLAGS=< -r -k> +make: "varname-dot-makeflags.mk" line 15: .MAKEOVERRIDES=<> +make: "varname-dot-makeflags.mk" line 21: MAKEFLAGS=<undefined> +make: "varname-dot-makeflags.mk" line 23: .MAKEFLAGS=< -r -k -D VARNAME -r> +make: "varname-dot-makeflags.mk" line 25: .MAKEOVERRIDES=< VAR> runtime: MAKEFLAGS=< -r -k -D VARNAME -r VAR=value> runtime: .MAKEFLAGS=< -r -k -D VARNAME -r> runtime: .MAKEOVERRIDES=< VAR> diff --git a/usr.bin/make/unit-tests/varname-dot-makeflags.mk b/usr.bin/make/unit-tests/varname-dot-makeflags.mk index cca285f9301..ffb09decb70 100644 --- a/usr.bin/make/unit-tests/varname-dot-makeflags.mk +++ b/usr.bin/make/unit-tests/varname-dot-makeflags.mk @@ -1,4 +1,4 @@ -# $NetBSD: varname-dot-makeflags.mk,v 1.7 2023/02/25 19:24:07 rillig Exp $ +# $NetBSD: varname-dot-makeflags.mk,v 1.8 2023/06/01 20:56:35 rillig Exp $ # # Tests for the special .MAKEFLAGS variable, which collects almost all # command line arguments and passes them on to any child processes via @@ -7,8 +7,11 @@ # See also: # varname-dot-makeoverrides.mk +# expect+1: MAKEFLAGS=<undefined> .info MAKEFLAGS=<${MAKEFLAGS:Uundefined}> +# expect+1: .MAKEFLAGS=< -r -k> .info .MAKEFLAGS=<${.MAKEFLAGS}> +# expect+1: .MAKEOVERRIDES=<> .info .MAKEOVERRIDES=<${.MAKEOVERRIDES:Uundefined}> # Append an option with argument, a plain option and a variable assignment. diff --git a/usr.bin/make/unit-tests/varname-dot-parsedir.exp b/usr.bin/make/unit-tests/varname-dot-parsedir.exp index c0bc56f41d6..0b7eaa46c77 100644 --- a/usr.bin/make/unit-tests/varname-dot-parsedir.exp +++ b/usr.bin/make/unit-tests/varname-dot-parsedir.exp @@ -1,5 +1,5 @@ -make: "varname-dot-parsedir.mk" line 28: At this point, .PARSEDIR is undefined. -make: "<normalized>" line 34: The location can be faked in some cases. -make: "varname-dot-parsedir.mk" line 38: The location is no longer fake. +make: "varname-dot-parsedir.mk" line 29: At this point, .PARSEDIR is undefined. +make: "<normalized>" line 35: The location can be faked in some cases. +make: "varname-dot-parsedir.mk" line 40: The location is no longer fake. At run time, .PARSEDIR is undefined. exit status 0 diff --git a/usr.bin/make/unit-tests/varname-dot-parsedir.mk b/usr.bin/make/unit-tests/varname-dot-parsedir.mk index 7c74419ddd1..37ffabe28cc 100644 --- a/usr.bin/make/unit-tests/varname-dot-parsedir.mk +++ b/usr.bin/make/unit-tests/varname-dot-parsedir.mk @@ -1,4 +1,4 @@ -# $NetBSD: varname-dot-parsedir.mk,v 1.6 2020/10/24 08:50:17 rillig Exp $ +# $NetBSD: varname-dot-parsedir.mk,v 1.7 2023/06/01 20:56:35 rillig Exp $ # # Tests for the special .PARSEDIR variable, which contains the directory part # of the file that is currently parsed. @@ -25,6 +25,7 @@ # # The .rawout file contains the full path to the current directory. # In the .out file, it is filtered out. +# expect+1: At this point, .PARSEDIR is undefined. .info At this point, .PARSEDIR is undefined. # There is absolutely no point in faking the location of the file that is @@ -35,6 +36,7 @@ # After including another file, .PARSEDIR is reset. .include "/dev/null" +# expect+1: The location is no longer fake. .info The location is no longer fake. all: diff --git a/usr.bin/make/unit-tests/varname-dot-parsefile.exp b/usr.bin/make/unit-tests/varname-dot-parsefile.exp index b61f01c01ab..2c541304cf7 100644 --- a/usr.bin/make/unit-tests/varname-dot-parsefile.exp +++ b/usr.bin/make/unit-tests/varname-dot-parsefile.exp @@ -1,5 +1,5 @@ -make: "varname-dot-parsefile.mk" line 23: At this point, .PARSEFILE is undefined. -make: "<normalized>" line 29: The location can be faked in some cases. -make: "varname-dot-parsefile.mk" line 33: The location is no longer fake. +make: "varname-dot-parsefile.mk" line 24: At this point, .PARSEFILE is undefined. +make: "<normalized>" line 30: The location can be faked in some cases. +make: "varname-dot-parsefile.mk" line 35: The location is no longer fake. At run time, .PARSEFILE is undefined. exit status 0 diff --git a/usr.bin/make/unit-tests/varname-dot-parsefile.mk b/usr.bin/make/unit-tests/varname-dot-parsefile.mk index 17b48a5f77e..d6dcd7e3848 100644 --- a/usr.bin/make/unit-tests/varname-dot-parsefile.mk +++ b/usr.bin/make/unit-tests/varname-dot-parsefile.mk @@ -1,4 +1,4 @@ -# $NetBSD: varname-dot-parsefile.mk,v 1.5 2020/10/24 08:50:17 rillig Exp $ +# $NetBSD: varname-dot-parsefile.mk,v 1.6 2023/06/01 20:56:35 rillig Exp $ # # Tests for the special .PARSEFILE variable, which contains the basename part # of the file that is currently parsed. @@ -20,6 +20,7 @@ # The variable .PARSEFILE is indirectly used by the .info directive, # via PrintLocation. +# expect+1: At this point, .PARSEFILE is undefined. .info At this point, .PARSEFILE is undefined. # There is absolutely no point in faking the location of the file that is @@ -30,6 +31,7 @@ # After including another file, .PARSEFILE is reset. .include "/dev/null" +# expect+1: The location is no longer fake. .info The location is no longer fake. all: diff --git a/usr.bin/make/unit-tests/varname.exp b/usr.bin/make/unit-tests/varname.exp index 942532b654d..72aea120c6e 100644 --- a/usr.bin/make/unit-tests/varname.exp +++ b/usr.bin/make/unit-tests/varname.exp @@ -5,13 +5,13 @@ Var_Parse: ${VARNAME} (eval) Global: VAR((( = 3 open parentheses Var_Parse: ${VAR(((}}}}" != "3 open parentheses}}}" (eval) Global: .ALLTARGETS = VAR(((=) -make: "varname.mk" line 30: No closing parenthesis in archive specification -make: "varname.mk" line 30: Error in archive specification: "VAR" +make: "varname.mk" line 32: No closing parenthesis in archive specification +make: "varname.mk" line 32: Error in archive specification: "VAR" Var_Parse: ${:UVAR\(\(\(}= try2 (eval-defined) Evaluating modifier ${:U...} on value "" (eval-defined, undefined) Result of ${:UVAR\(\(\(} is "VAR\(\(\(" (eval-defined, defined) Global: .ALLTARGETS = VAR(((=) VAR\(\(\(= -make: "varname.mk" line 35: Invalid line type +make: "varname.mk" line 38: Invalid line type Var_Parse: ${VARNAME} (eval) Global: VAR((( = try3 Global: .MAKEFLAGS = -r -k -d v -d diff --git a/usr.bin/make/unit-tests/varname.mk b/usr.bin/make/unit-tests/varname.mk index e86fd9176a2..f3e5bdeffee 100644 --- a/usr.bin/make/unit-tests/varname.mk +++ b/usr.bin/make/unit-tests/varname.mk @@ -1,4 +1,4 @@ -# $NetBSD: varname.mk,v 1.10 2022/02/09 21:09:24 rillig Exp $ +# $NetBSD: varname.mk,v 1.11 2023/06/01 20:56:35 rillig Exp $ # # Tests for special variables, such as .MAKE or .PARSEDIR. # And for variable names in general. @@ -27,11 +27,14 @@ ${VARNAME}= 3 open parentheses # This is not a variable assignment since the parentheses and braces are not # balanced. At the end of the line, there are still 3 levels open, which # means the variable name is not finished. +# expect+2: Error in archive specification: "VAR" +# expect+1: No closing parenthesis in archive specification ${:UVAR(((}= try1 # On the left-hand side of a variable assignments, the backslash is not parsed # as an escape character, therefore the parentheses still count to the nesting # level, which at the end of the line is still 3. Therefore this is not a # variable assignment as well. +# expect+1: Invalid line type ${:UVAR\(\(\(}= try2 # To assign to a variable with an arbitrary name, the variable name has to # come from an external source, not the text that is parsed in the assignment diff --git a/usr.bin/make/unit-tests/varparse-dynamic.exp b/usr.bin/make/unit-tests/varparse-dynamic.exp index a2ff2941316..caf8424fa91 100644 --- a/usr.bin/make/unit-tests/varparse-dynamic.exp +++ b/usr.bin/make/unit-tests/varparse-dynamic.exp @@ -1,5 +1,5 @@ -make: "varparse-dynamic.mk" line 8: Malformed conditional (${.TARGEX}) -make: "varparse-dynamic.mk" line 10: Malformed conditional (${.TARGXX}) +make: "varparse-dynamic.mk" line 9: Malformed conditional (${.TARGEX}) +make: "varparse-dynamic.mk" line 12: Malformed conditional (${.TARGXX}) make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/usr.bin/make/unit-tests/varparse-dynamic.mk b/usr.bin/make/unit-tests/varparse-dynamic.mk index 2f862d0e27d..88e4e6a4917 100644 --- a/usr.bin/make/unit-tests/varparse-dynamic.mk +++ b/usr.bin/make/unit-tests/varparse-dynamic.mk @@ -1,12 +1,14 @@ -# $NetBSD: varparse-dynamic.mk,v 1.6 2023/06/01 07:27:30 rillig Exp $ +# $NetBSD: varparse-dynamic.mk,v 1.7 2023/06/01 20:56:35 rillig Exp $ # Before 2020-07-27, there was an off-by-one error in Var_Parse that skipped # the last character in the variable name. # To trigger the bug, the variable had to be undefined. .if ${.TARGET} # exact match, may be undefined .endif +# expect+1: Malformed conditional (${.TARGEX}) .if ${.TARGEX} # 1 character difference, must be defined .endif +# expect+1: Malformed conditional (${.TARGXX}) .if ${.TARGXX} # 2 characters difference, must be defined .endif @@ -30,6 +32,3 @@ .if ${.TARGET:M${UNDEF}} != "\${.TARGET:M\${UNDEF}}" . error .endif - -all: - @: diff --git a/usr.bin/make/unit-tests/varparse-errors.exp b/usr.bin/make/unit-tests/varparse-errors.exp index fc20e427296..41db6d8c6f4 100644 --- a/usr.bin/make/unit-tests/varparse-errors.exp +++ b/usr.bin/make/unit-tests/varparse-errors.exp @@ -1,10 +1,10 @@ -make: "varparse-errors.mk" line 37: Unknown modifier "Z" -make: "varparse-errors.mk" line 45: Unknown modifier "Z" +make: "varparse-errors.mk" line 38: Unknown modifier "Z" +make: "varparse-errors.mk" line 47: Unknown modifier "Z" make: Bad modifier ":OX" for variable "" -make: "varparse-errors.mk" line 67: Undefined variable "${:U:OX" +make: "varparse-errors.mk" line 71: Undefined variable "${:U:OX" make: Bad modifier ":OX" for variable "" make: Bad modifier ":OX" for variable "" -make: "varparse-errors.mk" line 67: Undefined variable "${:U:OX" +make: "varparse-errors.mk" line 71: Undefined variable "${:U:OX" make: Bad modifier ":OX" for variable "" make: Unclosed variable expression, expecting '}' for modifier "Q" of variable "" with value "" make: Unclosed variable expression, expecting '}' for modifier "sh" of variable "" with value "" diff --git a/usr.bin/make/unit-tests/varparse-errors.mk b/usr.bin/make/unit-tests/varparse-errors.mk index 9ce41cc3be9..3ae6d2db1de 100644 --- a/usr.bin/make/unit-tests/varparse-errors.mk +++ b/usr.bin/make/unit-tests/varparse-errors.mk @@ -1,4 +1,4 @@ -# $NetBSD: varparse-errors.mk,v 1.8 2023/02/14 21:56:48 rillig Exp $ +# $NetBSD: varparse-errors.mk,v 1.9 2023/06/01 20:56:35 rillig Exp $ # Tests for parsing and evaluating all kinds of variable expressions. # @@ -34,6 +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" VAR.${:U:Z}= unknown modifier in the variable name .if ${VAR.} != "unknown modifier in the variable name" . error @@ -42,6 +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" VAR.${:U:Z}post= unknown modifier with text in the variable name .if ${VAR.post} != "unknown modifier with text in the variable name" . error @@ -64,6 +66,8 @@ VAR.${:U:Z}post= unknown modifier with text in the variable name # #.MAKEFLAGS: -dv IND= ${:OX} +# expect+2: Undefined variable "${:U:OX" +# expect+1: Undefined variable "${:U:OX" _:= ${:U:OX:U${IND}} ${:U:OX:U${IND}} #.MAKEFLAGS: -d0 |
