Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make/unit-tests tests/make: test misleading error me...



details:   https://anonhg.NetBSD.org/src/rev/e2b0910b0297
branches:  trunk
changeset: 369630:e2b0910b0297
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed Aug 24 21:38:06 2022 +0000

description:
tests/make: test misleading error messages on unclosed expressions

The error messages say 'Unknown modifier' or 'Bad modifier', which is
not entirely correct.  The modifier in itself is valid, it's just that
make doesn't expect the end of the string after the modifier.

diffstat:

 usr.bin/make/unit-tests/varmod.exp          |  10 +++---
 usr.bin/make/unit-tests/varmod.mk           |   5 +++-
 usr.bin/make/unit-tests/varparse-errors.exp |  37 +++++++++++++++++++++++++++++
 usr.bin/make/unit-tests/varparse-errors.mk  |  31 ++++++++++++++++++++++-
 4 files changed, 75 insertions(+), 8 deletions(-)

diffs (120 lines):

diff -r f2d3abf30566 -r e2b0910b0297 usr.bin/make/unit-tests/varmod.exp
--- a/usr.bin/make/unit-tests/varmod.exp        Wed Aug 24 21:03:57 2022 +0000
+++ b/usr.bin/make/unit-tests/varmod.exp        Wed Aug 24 21:38:06 2022 +0000
@@ -1,8 +1,8 @@
-make: "varmod.mk" line 93: To escape a dollar, use \$, not $$, at "$$:L} != """
-make: "varmod.mk" line 93: Invalid variable name ':', at "$:L} != """
-make: "varmod.mk" line 98: Dollar followed by nothing
-make: "varmod.mk" line 107: Missing delimiter ':' after modifier "P"
-make: "varmod.mk" line 108: Missing argument for ".error"
+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: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1
diff -r f2d3abf30566 -r e2b0910b0297 usr.bin/make/unit-tests/varmod.mk
--- a/usr.bin/make/unit-tests/varmod.mk Wed Aug 24 21:03:57 2022 +0000
+++ b/usr.bin/make/unit-tests/varmod.mk Wed Aug 24 21:38:06 2022 +0000
@@ -1,6 +1,9 @@
-# $NetBSD: varmod.mk,v 1.6 2022/08/06 07:06:58 rillig Exp $
+# $NetBSD: varmod.mk,v 1.7 2022/08/24 21:38:06 rillig Exp $
 #
 # Tests for variable modifiers, such as :Q, :S,from,to or :Ufallback.
+#
+# See also:
+#      varparse-errors.mk
 
 # As of 2022-08-06, the possible behaviors during parsing are:
 #
diff -r f2d3abf30566 -r e2b0910b0297 usr.bin/make/unit-tests/varparse-errors.exp
--- a/usr.bin/make/unit-tests/varparse-errors.exp       Wed Aug 24 21:03:57 2022 +0000
+++ b/usr.bin/make/unit-tests/varparse-errors.exp       Wed Aug 24 21:38:06 2022 +0000
@@ -6,6 +6,43 @@
 make: Bad modifier ":OX" for variable ""
 make: "varparse-errors.mk" line 68: Undefined variable "${:U:OX"
 make: Bad modifier ":OX" for variable ""
+make: "varparse-errors.mk" line 72: Unknown modifier "Q"
+make: Unclosed variable expression, expecting '}' for modifier "Q" of variable "" with value ""
+make: "varparse-errors.mk" line 72: Undefined variable "${:U:Q"
+make: "varparse-errors.mk" line 74: Unknown modifier "sh"
+make: Unclosed variable expression, expecting '}' for modifier "sh" of variable "" with value ""
+make: "varparse-errors.mk" line 74: Undefined variable "${:U:sh"
+make: Bad modifier ":tA" for variable ""
+make: "varparse-errors.mk" line 76: Undefined variable "${:U:tA"
+make: Bad modifier ":tsX" for variable ""
+make: "varparse-errors.mk" line 78: Undefined variable "${:U:ts"
+make: Bad modifier ":ts" for variable ""
+make: "varparse-errors.mk" line 80: Undefined variable "${:U:ts"
+make: Bad modifier ":ts\040" for variable ""
+make: "varparse-errors.mk" line 82: Undefined variable "${:U:ts"
+make: "varparse-errors.mk" line 84: Unknown modifier "u"
+make: Unclosed variable expression, expecting '}' for modifier "u" of variable "" with value ""
+make: "varparse-errors.mk" line 84: Undefined variable "${:U:u"
+make: "varparse-errors.mk" line 86: Unknown modifier "H"
+make: Unclosed variable expression, expecting '}' for modifier "H" of variable "" with value ""
+make: "varparse-errors.mk" line 86: Undefined variable "${:U:H"
+make: Bad modifier ":[1]" for variable ""
+make: "varparse-errors.mk" line 88: Undefined variable "${:U:[1]"
+make: "varparse-errors.mk" line 90: Unknown modifier "hash"
+make: Unclosed variable expression, expecting '}' for modifier "hash" of variable "" with value ""
+make: "varparse-errors.mk" line 90: Undefined variable "${:U:hash"
+make: "varparse-errors.mk" line 92: Unknown modifier "range"
+make: Unclosed variable expression, expecting '}' for modifier "range" of variable "" with value ""
+make: "varparse-errors.mk" line 92: Undefined variable "${:U:range"
+make: "varparse-errors.mk" line 94: Unknown modifier "_"
+make: Unclosed variable expression, expecting '}' for modifier "_" of variable "" with value ""
+make: "varparse-errors.mk" line 94: Undefined variable "${:U:_"
+make: "varparse-errors.mk" line 96: Unknown modifier "gmtime"
+make: Unclosed variable expression, expecting '}' for modifier "gmtime" of variable "" with value ""
+make: "varparse-errors.mk" line 96: Undefined variable "${:U:gmtime"
+make: "varparse-errors.mk" line 98: Unknown modifier "localtime"
+make: Unclosed variable expression, expecting '}' for modifier "localtime" of variable "" with value ""
+make: "varparse-errors.mk" line 98: Undefined variable "${:U:localtime"
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1
diff -r f2d3abf30566 -r e2b0910b0297 usr.bin/make/unit-tests/varparse-errors.mk
--- a/usr.bin/make/unit-tests/varparse-errors.mk        Wed Aug 24 21:03:57 2022 +0000
+++ b/usr.bin/make/unit-tests/varparse-errors.mk        Wed Aug 24 21:38:06 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: varparse-errors.mk,v 1.5 2022/01/24 22:59:49 rillig Exp $
+# $NetBSD: varparse-errors.mk,v 1.6 2022/08/24 21:38:06 rillig Exp $
 
 # Tests for parsing and evaluating all kinds of variable expressions.
 #
@@ -68,4 +68,31 @@
 _:=    ${:U:OX:U${IND}} ${:U:OX:U${IND}}
 #.MAKEFLAGS: -d0
 
-all:
+# expect+1: Unknown modifier "Q"
+UNCLOSED:=     ${:U:Q
+# expect+1: Unknown modifier "sh"
+UNCLOSED:=     ${:U:sh
+# expect: make: Bad modifier ":tA" for variable ""
+UNCLOSED:=     ${:U:tA
+# expect: make: Bad modifier ":tsX" for variable ""
+UNCLOSED:=     ${:U:tsX
+# expect: make: Bad modifier ":ts" for variable ""
+UNCLOSED:=     ${:U:ts
+# expect: make: Bad modifier ":ts\040" for variable ""
+UNCLOSED:=     ${:U:ts\040
+# expect+1: Unknown modifier "u"
+UNCLOSED:=     ${:U:u
+# expect+1: Unknown modifier "H"
+UNCLOSED:=     ${:U:H
+# expect: make: Bad modifier ":[1]" for variable ""
+UNCLOSED:=     ${:U:[1]
+# expect+1: Unknown modifier "hash"
+UNCLOSED:=     ${:U:hash
+# expect+1: Unknown modifier "range"
+UNCLOSED:=     ${:U:range
+# expect+1: Unknown modifier "_"
+UNCLOSED:=     ${:U:_
+# expect+1: Unknown modifier "gmtime"
+UNCLOSED:=     ${:U:gmtime
+# expect+1: Unknown modifier "localtime"
+UNCLOSED:=     ${:U:localtime



Home | Main Index | Thread Index | Old Index