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: clean up comments, exten...



details:   https://anonhg.NetBSD.org/src/rev/dfa3472467a3
branches:  trunk
changeset: 376104:dfa3472467a3
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Jun 01 07:27:30 2023 +0000

description:
tests/make: clean up comments, extend a few tests

diffstat:

 distrib/sets/lists/tests/mi                  |   6 +++---
 usr.bin/make/unit-tests/Makefile             |   3 +--
 usr.bin/make/unit-tests/check-expect.lua     |   4 ++--
 usr.bin/make/unit-tests/cond-eof.exp         |   6 +++---
 usr.bin/make/unit-tests/cond-eof.mk          |  12 +++++++++---
 usr.bin/make/unit-tests/cond-func-empty.mk   |   4 ++--
 usr.bin/make/unit-tests/cond-token-string.mk |   4 ++--
 usr.bin/make/unit-tests/dep.mk               |  14 +++++++++++++-
 usr.bin/make/unit-tests/directive-endif.exp  |   6 +++---
 usr.bin/make/unit-tests/directive-endif.mk   |  28 +++++++++++++---------------
 usr.bin/make/unit-tests/directive-for.mk     |   8 ++++----
 usr.bin/make/unit-tests/forsubst.exp         |   2 --
 usr.bin/make/unit-tests/forsubst.mk          |  22 ----------------------
 usr.bin/make/unit-tests/varmod-subst.mk      |  12 +++++++++++-
 usr.bin/make/unit-tests/varname-makeflags.mk |  10 +++++-----
 usr.bin/make/unit-tests/varparse-dynamic.mk  |   4 ++--
 16 files changed, 73 insertions(+), 72 deletions(-)

diffs (truncated from 366 to 300 lines):

diff -r f909f50b5877 -r dfa3472467a3 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Thu Jun 01 06:25:34 2023 +0000
+++ b/distrib/sets/lists/tests/mi       Thu Jun 01 07:27:30 2023 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1265 2023/05/31 00:18:44 riastradh Exp $
+# $NetBSD: mi,v 1.1266 2023/06/01 07:27:30 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5821,8 +5821,8 @@
 ./usr/tests/usr.bin/make/unit-tests/export.mk                                  tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/forloop.exp                                        tests-obsolete          obsolete,atf
 ./usr/tests/usr.bin/make/unit-tests/forloop.mk                                 tests-obsolete          obsolete,atf
-./usr/tests/usr.bin/make/unit-tests/forsubst.exp                               tests-usr.bin-tests     compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/forsubst.mk                                        tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/forsubst.exp                               tests-obsolete          obsolete,atf
+./usr/tests/usr.bin/make/unit-tests/forsubst.mk                                        tests-obsolete          obsolete,atf
 ./usr/tests/usr.bin/make/unit-tests/gnode-submake.exp                          tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/gnode-submake.mk                           tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/hanoi-include.exp                          tests-usr.bin-tests     compattestfile,atf
diff -r f909f50b5877 -r dfa3472467a3 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Thu Jun 01 06:25:34 2023 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Thu Jun 01 07:27:30 2023 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.335 2023/05/10 13:03:06 rillig Exp $
+# $NetBSD: Makefile,v 1.336 2023/06/01 07:27:30 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -212,7 +212,6 @@ TESTS+=             export
 TESTS+=                export-all
 TESTS+=                export-env
 TESTS+=                export-variants
-TESTS+=                forsubst
 TESTS+=                gnode-submake
 TESTS+=                hanoi-include
 TESTS+=                impsrc
diff -r f909f50b5877 -r dfa3472467a3 usr.bin/make/unit-tests/check-expect.lua
--- a/usr.bin/make/unit-tests/check-expect.lua  Thu Jun 01 06:25:34 2023 +0000
+++ b/usr.bin/make/unit-tests/check-expect.lua  Thu Jun 01 07:27:30 2023 +0000
@@ -1,5 +1,5 @@
 #!  /usr/bin/lua
--- $NetBSD: check-expect.lua,v 1.4 2023/05/09 19:43:12 rillig Exp $
+-- $NetBSD: check-expect.lua,v 1.5 2023/06/01 07:27:30 rillig Exp $
 
 --[[
 
@@ -58,7 +58,7 @@ local function collect_lineno_diagnostic
   for _, line in ipairs(exp_lines) do
     ---@type string | nil, string, string
     local l_fname, l_lineno, l_msg =
-      line:match("^make: \"([^\"]+)\" line (%d+): (.*)")
+      line:match('^make: "([^"]+)" line (%d+): (.*)')
     if l_fname ~= nil then
       local location = ("%s:%d"):format(l_fname, l_lineno)
       if by_location[location] == nil then
diff -r f909f50b5877 -r dfa3472467a3 usr.bin/make/unit-tests/cond-eof.exp
--- a/usr.bin/make/unit-tests/cond-eof.exp      Thu Jun 01 06:25:34 2023 +0000
+++ b/usr.bin/make/unit-tests/cond-eof.exp      Thu Jun 01 07:27:30 2023 +0000
@@ -1,6 +1,6 @@
-make: "cond-eof.mk" line 15: Malformed conditional (0 ${SIDE_EFFECT} ${SIDE_EFFECT2})
-make: "cond-eof.mk" line 17: Malformed conditional (1 ${SIDE_EFFECT} ${SIDE_EFFECT2})
-make: "cond-eof.mk" line 19: Malformed conditional ((0) ${SIDE_EFFECT} ${SIDE_EFFECT2})
+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: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1
diff -r f909f50b5877 -r dfa3472467a3 usr.bin/make/unit-tests/cond-eof.mk
--- a/usr.bin/make/unit-tests/cond-eof.mk       Thu Jun 01 06:25:34 2023 +0000
+++ b/usr.bin/make/unit-tests/cond-eof.mk       Thu Jun 01 07:27:30 2023 +0000
@@ -1,7 +1,10 @@
-# $NetBSD: cond-eof.mk,v 1.3 2021/12/10 23:12:44 rillig Exp $
+# $NetBSD: cond-eof.mk,v 1.4 2023/06/01 07:27:30 rillig Exp $
 #
-# Tests for parsing conditions, especially the end of such conditions, which
-# are represented as the token TOK_EOF.
+# 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!}
@@ -12,9 +15,12 @@ SIDE_EFFECT2=        ${:!echo 'side effect 2' 1
 # These syntax errors are an edge case that does not occur during normal
 # operation.  Still, it is easy to avoid evaluating these expressions, just in
 # case they have side effects.
+# expect+1: Malformed conditional (0 ${SIDE_EFFECT} ${SIDE_EFFECT2})
 .if 0 ${SIDE_EFFECT} ${SIDE_EFFECT2}
 .endif
+# expect+1: Malformed conditional (1 ${SIDE_EFFECT} ${SIDE_EFFECT2})
 .if 1 ${SIDE_EFFECT} ${SIDE_EFFECT2}
 .endif
+# expect+1: Malformed conditional ((0) ${SIDE_EFFECT} ${SIDE_EFFECT2})
 .if (0) ${SIDE_EFFECT} ${SIDE_EFFECT2}
 .endif
diff -r f909f50b5877 -r dfa3472467a3 usr.bin/make/unit-tests/cond-func-empty.mk
--- a/usr.bin/make/unit-tests/cond-func-empty.mk        Thu Jun 01 06:25:34 2023 +0000
+++ b/usr.bin/make/unit-tests/cond-func-empty.mk        Thu Jun 01 07:27:30 2023 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: cond-func-empty.mk,v 1.18 2023/03/04 21:15:30 rillig Exp $
+# $NetBSD: cond-func-empty.mk,v 1.19 2023/06/01 07:27:30 rillig Exp $
 #
 # Tests for the empty() function in .if conditions, which tests a variable
 # expression for emptiness.
@@ -25,7 +25,7 @@ WORD= word
 .endif
 
 # The :S modifier replaces the empty value with an actual word.  After
-# applying the :S modifier to the expression, it value is 'empty', so it is
+# applying the :S modifier to the expression, its value is 'empty', so it is
 # no longer empty, but it is still based on an undefined variable.  There are
 # a few modifiers that turn an undefined expression into a defined expression,
 # among them :U and :D, but not :S.  Therefore, at the end of evaluating the
diff -r f909f50b5877 -r dfa3472467a3 usr.bin/make/unit-tests/cond-token-string.mk
--- a/usr.bin/make/unit-tests/cond-token-string.mk      Thu Jun 01 06:25:34 2023 +0000
+++ b/usr.bin/make/unit-tests/cond-token-string.mk      Thu Jun 01 07:27:30 2023 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: cond-token-string.mk,v 1.6 2022/05/08 06:57:00 rillig Exp $
+# $NetBSD: cond-token-string.mk,v 1.7 2023/06/01 07:27:30 rillig Exp $
 #
 # Tests for quoted string literals in .if conditions.
 #
@@ -9,7 +9,7 @@
 # TODO: Implementation
 
 # Cover the code in CondParser_String that frees the memory after parsing
-# a variable expression based on an undefined variable.
+# an expression based on an undefined variable.
 .if "" != "${:Uvalue:Z}"
 .  error
 .else
diff -r f909f50b5877 -r dfa3472467a3 usr.bin/make/unit-tests/dep.mk
--- a/usr.bin/make/unit-tests/dep.mk    Thu Jun 01 06:25:34 2023 +0000
+++ b/usr.bin/make/unit-tests/dep.mk    Thu Jun 01 07:27:30 2023 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: dep.mk,v 1.3 2021/12/13 23:38:54 rillig Exp $
+# $NetBSD: dep.mk,v 1.4 2023/06/01 07:27:30 rillig Exp $
 #
 # Tests for dependency declarations, such as "target: sources".
 
@@ -15,4 +15,16 @@ only-colon::
 # would be another error message.
 only-colon:
 
+
+# Before parse.c 1.158 from 2009-10-07, the parser broke dependency lines at
+# the first ';', without parsing expressions as such.  It interpreted the
+# first ';' as the separator between the dependency and its commands, and the
+# '^' as a shell command.
+all: for-subst
+.for file in ${.PARSEFILE}
+for-subst:       ${file:S;^;./;g}
+       @echo ".for with :S;... OK"
+.endfor
+
+
 all:
diff -r f909f50b5877 -r dfa3472467a3 usr.bin/make/unit-tests/directive-endif.exp
--- a/usr.bin/make/unit-tests/directive-endif.exp       Thu Jun 01 06:25:34 2023 +0000
+++ b/usr.bin/make/unit-tests/directive-endif.exp       Thu Jun 01 07:27:30 2023 +0000
@@ -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 33: 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 45: Unknown directive "endifx"
+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: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1
diff -r f909f50b5877 -r dfa3472467a3 usr.bin/make/unit-tests/directive-endif.mk
--- a/usr.bin/make/unit-tests/directive-endif.mk        Thu Jun 01 06:25:34 2023 +0000
+++ b/usr.bin/make/unit-tests/directive-endif.mk        Thu Jun 01 07:27:30 2023 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: directive-endif.mk,v 1.5 2020/12/14 21:56:17 rillig Exp $
+# $NetBSD: directive-endif.mk,v 1.6 2023/06/01 07:27:30 rillig Exp $
 #
 # Tests for the .endif directive.
 #
@@ -8,18 +8,18 @@
 # See also:
 #      Cond_EvalLine
 
-# TODO: Implementation
+# expect-all
 
 .MAKEFLAGS: -dL
 
-# Error: .endif does not take arguments
 .if 0
-# Since 2020-12-15, complain about the extra text after the 'endif'.
+# Since 2020-12-15:
+# expect+1: The .endif directive does not take arguments
 .endif 0
 
-# Error: .endif does not take arguments
 .if 1
-# Since 2020-12-15, complain about the extra text after the 'endif'.
+# Since 2020-12-15:
+# expect+1: The .endif directive does not take arguments
 .endif 1
 
 # Comments are allowed after an '.endif'.
@@ -29,21 +29,19 @@
 # Only whitespace and comments are allowed after an '.endif', but nothing
 # else.
 .if 1
-# Since 2020-12-15, complain about the extra text after the 'endif'.
+# Since 2020-12-15:
+# expect+1: The .endif directive does not take arguments
 .endif0
 
 # Only whitespace and comments are allowed after an '.endif', but nothing
 # else.
 .if 1
-# Since 2020-12-15, complain about the extra text after the 'endif'.
+# Since 2020-12-15:
+# expect+1: The .endif directive does not take arguments
 .endif/
 
-# After an '.endif', no other letter must occur.  This 'endifx' is not
-# parsed as an 'endif', therefore another '.endif' must follow to balance
-# the directives.
+# After an '.endif', no other letter must occur.
 .if 1
+# expect+1: Unknown directive "endifx"
 .endifx
-.endif # to close the preceding '.if'
-
-all:
-       @:;
+.endif                         # to close the preceding '.if'
diff -r f909f50b5877 -r dfa3472467a3 usr.bin/make/unit-tests/directive-for.mk
--- a/usr.bin/make/unit-tests/directive-for.mk  Thu Jun 01 06:25:34 2023 +0000
+++ b/usr.bin/make/unit-tests/directive-for.mk  Thu Jun 01 07:27:30 2023 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: directive-for.mk,v 1.20 2023/05/10 13:03:06 rillig Exp $
+# $NetBSD: directive-for.mk,v 1.21 2023/06/01 07:27:30 rillig Exp $
 #
 # Tests for the .for directive.
 #
@@ -87,9 +87,9 @@ var2= value before
 .  warning After the .for loop, var2 must still have its original value.
 .endif
 
-# Until 2008-12-21, the values of the iteration variables were simply
-# inserted as plain text and then parsed as usual, which made it possible
-# to achieve all kinds of strange effects, such as generating '.if'
+# Before for.c 1.39 from 2008-12-21, the values of the iteration variables
+# were simply inserted as plain text and then parsed as usual, which made it
+# possible to achieve all kinds of strange effects, such as generating '.if'
 # directives or inserting '$' characters in random places, thereby changing
 # how following '$' are interpreted.
 #
diff -r f909f50b5877 -r dfa3472467a3 usr.bin/make/unit-tests/forsubst.exp
--- a/usr.bin/make/unit-tests/forsubst.exp      Thu Jun 01 06:25:34 2023 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-.for with :S;... OK
-exit status 0
diff -r f909f50b5877 -r dfa3472467a3 usr.bin/make/unit-tests/forsubst.mk
--- a/usr.bin/make/unit-tests/forsubst.mk       Thu Jun 01 06:25:34 2023 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-# $NetBSD: forsubst.mk,v 1.3 2020/11/03 17:59:27 rillig Exp $
-#
-# The parser used to break dependency lines at ';' without regard for
-# substitution patterns.  Back then, the first ';' was interpreted as the
-# separator between the dependency and its commands.  This (perhaps coupled
-# with the new handling of .for variables in ${:U<value>...) caused
-# interesting results for lines like:
-#
-# .for file in ${LIST}
-#   for-subst:       ${file:S;^;${here}/;g}
-# .endfor
-#
-# See the commit to unit-tests/forsubst (without the .mk) from 2009-10-07.
-
-all: for-subst
-
-here := ${.PARSEDIR}
-# this should not run foul of the parser
-.for file in ${.PARSEFILE}
-for-subst:       ${file:S;^;${here}/;g}
-       @echo ".for with :S;... OK"
-.endfor
diff -r f909f50b5877 -r dfa3472467a3 usr.bin/make/unit-tests/varmod-subst.mk
--- a/usr.bin/make/unit-tests/varmod-subst.mk   Thu Jun 01 06:25:34 2023 +0000
+++ b/usr.bin/make/unit-tests/varmod-subst.mk   Thu Jun 01 07:27:30 2023 +0000
@@ -1,7 +1,9 @@
-# $NetBSD: varmod-subst.mk,v 1.9 2021/09/06 21:18:55 rillig Exp $
+# $NetBSD: varmod-subst.mk,v 1.10 2023/06/01 07:27:30 rillig Exp $
 #
 # Tests for the :S,from,to, variable modifier.



Home | Main Index | Thread Index | Old Index