Module Name: src
Committed By: rillig
Date: Sat Jan 11 20:16:40 UTC 2025
Modified Files:
src/usr.bin/make/unit-tests: check-expect.lua cond-token-string.mk
cond-undef-lint.mk directive-include.mk opt-debug-lint.mk
vardebug.mk varmod-edge.mk varmod.mk varname.mk
Log Message:
tests/make: force correct order of expected messages
To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/check-expect.lua
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/cond-token-string.mk \
src/usr.bin/make/unit-tests/vardebug.mk
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cond-undef-lint.mk
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/directive-include.mk
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/unit-tests/opt-debug-lint.mk \
src/usr.bin/make/unit-tests/varmod.mk
cvs rdiff -u -r1.31 -r1.32 src/usr.bin/make/unit-tests/varmod-edge.mk
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/make/unit-tests/varname.mk
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/unit-tests/check-expect.lua
diff -u src/usr.bin/make/unit-tests/check-expect.lua:1.9 src/usr.bin/make/unit-tests/check-expect.lua:1.10
--- src/usr.bin/make/unit-tests/check-expect.lua:1.9 Sat Jul 20 11:05:11 2024
+++ src/usr.bin/make/unit-tests/check-expect.lua Sat Jan 11 20:16:40 2025
@@ -1,5 +1,5 @@
#! /usr/bin/lua
--- $NetBSD: check-expect.lua,v 1.9 2024/07/20 11:05:11 rillig Exp $
+-- $NetBSD: check-expect.lua,v 1.10 2025/01/11 20:16:40 rillig Exp $
--[[
@@ -151,6 +151,9 @@ local function check_mk(mk_fname)
by_location[location][i] = ""
found = true
break
+ elseif message ~= "" then
+ print_error("error: %s:%d: out-of-order '%s'",
+ mk_fname, mk_lineno, message)
end
end
end
Index: src/usr.bin/make/unit-tests/cond-token-string.mk
diff -u src/usr.bin/make/unit-tests/cond-token-string.mk:1.13 src/usr.bin/make/unit-tests/cond-token-string.mk:1.14
--- src/usr.bin/make/unit-tests/cond-token-string.mk:1.13 Thu Aug 29 20:20:36 2024
+++ src/usr.bin/make/unit-tests/cond-token-string.mk Sat Jan 11 20:16:40 2025
@@ -1,4 +1,4 @@
-# $NetBSD: cond-token-string.mk,v 1.13 2024/08/29 20:20:36 rillig Exp $
+# $NetBSD: cond-token-string.mk,v 1.14 2025/01/11 20:16:40 rillig Exp $
#
# Tests for quoted string literals in .if conditions.
#
@@ -10,8 +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"
+# expect+2: Unknown modifier "Z"
+# expect+1: Malformed conditional '"" != "${:Uvalue:Z}"'
.if "" != "${:Uvalue:Z}"
. error
.else
Index: src/usr.bin/make/unit-tests/vardebug.mk
diff -u src/usr.bin/make/unit-tests/vardebug.mk:1.13 src/usr.bin/make/unit-tests/vardebug.mk:1.14
--- src/usr.bin/make/unit-tests/vardebug.mk:1.13 Thu Aug 29 20:20:36 2024
+++ src/usr.bin/make/unit-tests/vardebug.mk Sat Jan 11 20:16:40 2025
@@ -1,4 +1,4 @@
-# $NetBSD: vardebug.mk,v 1.13 2024/08/29 20:20:36 rillig Exp $
+# $NetBSD: vardebug.mk,v 1.14 2025/01/11 20:16:40 rillig Exp $
#
# Demonstrates the debugging output for var.c.
@@ -58,8 +58,8 @@ VAR+= 3
# When ApplyModifiers results in an error, this appears in the debug log
# as "is error", without surrounding quotes.
# expect: Result of ${:unknown} is error (eval-defined, defined)
-# expect+2: Malformed conditional '${:Uvariable:unknown}'
-# expect+1: Unknown modifier "unknown"
+# expect+2: Unknown modifier "unknown"
+# expect+1: Malformed conditional '${:Uvariable:unknown}'
.if ${:Uvariable:unknown}
.endif
Index: src/usr.bin/make/unit-tests/cond-undef-lint.mk
diff -u src/usr.bin/make/unit-tests/cond-undef-lint.mk:1.5 src/usr.bin/make/unit-tests/cond-undef-lint.mk:1.6
--- src/usr.bin/make/unit-tests/cond-undef-lint.mk:1.5 Tue Aug 6 18:00:17 2024
+++ src/usr.bin/make/unit-tests/cond-undef-lint.mk Sat Jan 11 20:16:40 2025
@@ -1,4 +1,4 @@
-# $NetBSD: cond-undef-lint.mk,v 1.5 2024/08/06 18:00:17 rillig Exp $
+# $NetBSD: cond-undef-lint.mk,v 1.6 2025/01/11 20:16:40 rillig Exp $
#
# Tests for defined and undefined variables in .if conditions, in lint mode.
#
@@ -20,8 +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
+# expect+2: Variable "UNDEF" is undefined
+# expect+1: Malformed conditional '${UNDEF}'
.if ${UNDEF}
. error
.else
Index: src/usr.bin/make/unit-tests/directive-include.mk
diff -u src/usr.bin/make/unit-tests/directive-include.mk:1.16 src/usr.bin/make/unit-tests/directive-include.mk:1.17
--- src/usr.bin/make/unit-tests/directive-include.mk:1.16 Thu Aug 29 20:20:36 2024
+++ src/usr.bin/make/unit-tests/directive-include.mk Sat Jan 11 20:16:40 2025
@@ -1,4 +1,4 @@
-# $NetBSD: directive-include.mk,v 1.16 2024/08/29 20:20:36 rillig Exp $
+# $NetBSD: directive-include.mk,v 1.17 2025/01/11 20:16:40 rillig Exp $
#
# Tests for the .include directive, which includes another file.
@@ -51,8 +51,8 @@ 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"
+# expect+2: Unknown modifier "Z"
+# expect+1: Could not find nonexistent.mk
.include "nonexistent${:U123:Z}.mk"
# The traditional include directive is seldom used.
Index: src/usr.bin/make/unit-tests/opt-debug-lint.mk
diff -u src/usr.bin/make/unit-tests/opt-debug-lint.mk:1.20 src/usr.bin/make/unit-tests/opt-debug-lint.mk:1.21
--- src/usr.bin/make/unit-tests/opt-debug-lint.mk:1.20 Thu Aug 29 20:20:36 2024
+++ src/usr.bin/make/unit-tests/opt-debug-lint.mk Sat Jan 11 20:16:40 2025
@@ -1,4 +1,4 @@
-# $NetBSD: opt-debug-lint.mk,v 1.20 2024/08/29 20:20:36 rillig Exp $
+# $NetBSD: opt-debug-lint.mk,v 1.21 2025/01/11 20:16:40 rillig Exp $
#
# Tests for the -dL command line option, which runs additional checks
# to catch common mistakes, such as unclosed expressions.
@@ -16,8 +16,8 @@
#
# See also:
# cond-undef-lint.mk
-# expect+2: Malformed conditional '$X'
-# expect+1: Variable "X" is undefined
+# expect+2: Variable "X" is undefined
+# expect+1: Malformed conditional '$X'
.if $X
. error
.endif
@@ -40,8 +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
+# expect+2: Variable "UNDEF" is undefined
+# expect+1: Malformed conditional '${UNDEF}'
.if ${UNDEF}
. error
.endif
Index: src/usr.bin/make/unit-tests/varmod.mk
diff -u src/usr.bin/make/unit-tests/varmod.mk:1.20 src/usr.bin/make/unit-tests/varmod.mk:1.21
--- src/usr.bin/make/unit-tests/varmod.mk:1.20 Thu Aug 29 20:20:37 2024
+++ src/usr.bin/make/unit-tests/varmod.mk Sat Jan 11 20:16:40 2025
@@ -1,4 +1,4 @@
-# $NetBSD: varmod.mk,v 1.20 2024/08/29 20:20:37 rillig Exp $
+# $NetBSD: varmod.mk,v 1.21 2025/01/11 20:16:40 rillig Exp $
#
# Tests for variable modifiers, such as :Q, :S,from,to or :Ufallback.
#
@@ -132,8 +132,8 @@ VAR= STOP
# Test the range generation modifier ':range=n' with a very large number that
# is larger than SIZE_MAX for any supported platform.
-# expect+2: Malformed conditional '${word:L:range=99333000222000111000}'
-# expect+1: Invalid number "99333000222000111000}" for ':range' modifier
+# expect+2: Invalid number "99333000222000111000}" for ':range' modifier
+# expect+1: Malformed conditional '${word:L:range=99333000222000111000}'
.if ${word:L:range=99333000222000111000}
.endif
@@ -202,15 +202,15 @@ VAR_DOLLAR= VAR$$
.if ${:Ufallback$} != "fallback"
. error
.endif
-# expect+2: Malformed conditional '${%y:L:gmtime=1000$}'
-# expect+1: Invalid time value "1000$"
+# expect+2: Invalid time value "1000$"
+# expect+1: Malformed conditional '${%y:L:gmtime=1000$}'
.if ${%y:L:gmtime=1000$}
. error
.else
. error
.endif
-# expect+2: Malformed conditional '${%y:L:localtime=1000$}'
-# expect+1: Invalid time value "1000$"
+# expect+2: Invalid time value "1000$"
+# expect+1: Malformed conditional '${%y:L:localtime=1000$}'
.if ${%y:L:localtime=1000$}
. error
.else
Index: src/usr.bin/make/unit-tests/varmod-edge.mk
diff -u src/usr.bin/make/unit-tests/varmod-edge.mk:1.31 src/usr.bin/make/unit-tests/varmod-edge.mk:1.32
--- src/usr.bin/make/unit-tests/varmod-edge.mk:1.31 Thu Aug 29 20:20:36 2024
+++ src/usr.bin/make/unit-tests/varmod-edge.mk Sat Jan 11 20:16:40 2025
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-edge.mk,v 1.31 2024/08/29 20:20:36 rillig Exp $
+# $NetBSD: varmod-edge.mk,v 1.32 2025/01/11 20:16:40 rillig Exp $
#
# Tests for edge cases in variable modifiers.
#
@@ -198,8 +198,8 @@ EXP= # 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"
+# expect+2: Unknown modifier "Z"
+# expect+1: Malformed conditional '${:Z}'
.if ${:Z}
. error
.else
Index: src/usr.bin/make/unit-tests/varname.mk
diff -u src/usr.bin/make/unit-tests/varname.mk:1.15 src/usr.bin/make/unit-tests/varname.mk:1.16
--- src/usr.bin/make/unit-tests/varname.mk:1.15 Tue Aug 6 17:46:01 2024
+++ src/usr.bin/make/unit-tests/varname.mk Sat Jan 11 20:16:40 2025
@@ -1,4 +1,4 @@
-# $NetBSD: varname.mk,v 1.15 2024/08/06 17:46:01 rillig Exp $
+# $NetBSD: varname.mk,v 1.16 2025/01/11 20:16:40 rillig Exp $
#
# Tests for special variables, such as .MAKE or .PARSEDIR.
# And for variable names in general.
@@ -27,8 +27,8 @@ ${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: Missing ')' in archive specification
+# expect+2: Missing ')' in archive specification
+# expect+1: Error in archive specification: "VAR"
${: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