Home | History | Annotate | Download | only in unit-tests
History log of /src/usr.bin/make/unit-tests/varmod-assign.exp
RevisionDateAuthorComments
 1.35  16-Jun-2025  rillig make: in a warning without location information, print the stack trace

Without further context, a warning like the following is hard to track
back:

> nbmake[4]: warning: Invalid character " " in variable name
> "if ,"LSAN_OPTIONS=""
 1.34  30-Mar-2025  rillig make: add details to error message for the "::=" modifier

The previous error message about a bad modifier ":" was not helpful, as
the strcspn call stopped immediately due to the modifier starting with
the separater character ":". The previous error message also didn't
reveal that the "parse error" was due to the expression name being
empty.
 1.33  29-Mar-2025  rillig make: add ":" to error message about unknown modifier

In the manual page, the modifiers are listed with a preceding ":", so
use the same pattern in the error message. This removes an inconsistency
between the error messages "Unknown modifier" and "Bad modifier".
 1.32  29-Mar-2025  rillig make: add more details to error message about unfinished modifier

These details allow to quickly see the place where the syntax error is,
based on the surrounding lines from the stack trace.
 1.31  29-Mar-2025  rillig make: in stack traces from target commands, add the command level

A target can contain several commands, and these commands are likely to
contain the same expressions. To distinguish them, add one more line to
the stack trace, to narrow down the source of the error.
 1.30  11-Jan-2025  rillig make: replace "Malformed conditional" with "Variable is undefined"

Evaluating a conditional such as ".if ${UNDEF}" produced a "Malformed
conditional" error, even though the form of the conditional was correct,
it was the content of the variable that was wrong.

Replace this message with the more accurate "Variable is undefined",
revealing which of the possibly many variables is actually undefined.
 1.29  29-Aug-2024  rillig make: reduce line length in error messages

The error messages for deeply nested parse errors were hard to decipher,
due to the large amount of text. Split these messages into individual
lines, just as in the backtrace for .include files and .for loops. This
unified backtrace makes the output more uniform.
 1.28  20-Jul-2024  rillig make: don't run erroneous commands in compat mode

When there is a parse or evaluation error in an expression that becomes
part of the command, don't run that command, as the result of the failed
evaluation typically contains garbage characters. Skip the remaining
commands from that target as well, as they may depend on the erroneous
command.
 1.27  09-Jul-2024  rillig make: error out on parse/evaluation errors in shell commands

The expression ${VAR:X} has an unknown modifier ':X'. Previously, this
expression errored out when the expression was evaluated at parse time,
but not when the expression was evaluated when generating the commands
to bring a target up to date. The errors were previously reported, they
didn't affect the exit status, though.

Now, errors in expressions are handled in the same way, regardless of
the time at which they are evaluated.
 1.26  05-Jul-2024  rillig make: in error messages for anonymous variables, log the value
 1.25  04-Jul-2024  rillig make: error out on the "Bad modifier" error message

Previously, the "Bad modifier" error message did not affect make's exit
status. As a side effect, this kind of error now gets more context
information.
 1.24  04-Jul-2024  rillig make: add more context information to error messages

In case of a parse error or evaluation error, print the variable value
in addition to the variable name, to see the effects of previous
expression modifiers.

In nested make calls, print the current directory at the bottom of a
stack trace, as that information is otherwise hard to get in a parallel
build spanning multiple directories.
 1.23  30-Jun-2024  rillig make: error out on some more syntax errors

Previously, these errors only produced a message on stderr. They only
affected make's exit status when they were evaluated at parse time, but
not when evaluating the commands for a specific target right before
executing them.

The affected syntax errors are:
* invalid regular expressions in the ':C' modifier
* out-of-range references to regex groups in the ':C' modifier
* unfinished modifiers
 1.22  30-Jun-2024  rillig make: sync error handling between '!=' assignment and '::!=' modifier
 1.21  30-Jun-2024  rillig make: add detailed exit status to message for failed sub-commands

Several commands communicate via the exit status and not only
distinguish between zero and non-zero, so make this information
available to ease investigations.

The command "false" is not guaranteed to exit with a consistent status,
so use "(exit 13)" instead in the tests, to keep these tests portable
across different operating systems. The exit status 127 is required for
a shell that cannot find a command, so keep that one.
 1.20  20-Apr-2024  rillig branches: 1.20.2;
make: provide more context information for parse/evaluate errors
 1.19  07-Jan-2024  rillig tests/make: test the '::=' modifier in target scope
 1.18  29-Dec-2023  rillig tests/make: test the '::=' assignment modifier
 1.17  30-Nov-2021  rillig tests/make: convert tests for modifier '::=' to parse time

This puts the expected result of the expressions closer to the
expressions, making the tests self-contained.

The error messages that used to produce trailing spaces have been fixed
in var.c 1.853 from 2021-02-23. The error message now encloses the
variable name in quotes.
 1.16  06-Apr-2021  rillig make: reduce verbosity of the -dv debug logging for standard cases

The verbosity was already removed from LogBeforeApply, now it is
consistent between LogBeforeApply and LogAfterApply.
 1.15  05-Apr-2021  rillig make: in debug log, add space between scope and variable name

Without this space, the debug log looked more like line noise, even
though the only punctuation was a single innocent ':'. From a make
user's perspective, the variable name is a word of its own and should
not be visually glued to its namespace.
 1.14  05-Apr-2021  rillig make: omit unnecessary details from -dv debug log

When an expression is based on a defined variable, it does not matter
whether the evaluation mode is "eval" or "eval-defined", therefore omit
these details to reduce confusion.
 1.13  05-Apr-2021  rillig make: be more verbose in -dv debug logging

The previous log output was too brief to be understandable. Give more
hints by describing each part of the expression when evaluating a
modifier. Distinguish between parse-only mode and eval mode since in
parse-only mode most of the details are irrelevant.
 1.12  03-Apr-2021  rillig make: remove VarFlags from debug logging

Before the introduction of ExprDefined, VarFlags contained whether the
expression was defined or not, which was useful to know since the final
value of the expression depends on this information. The other VarFlags
do not influence the evaluation, so there is no point logging them.
 1.11  15-Mar-2021  rillig make: fix double varname expansion in the variable modifier '::='

This is an edge case that doesn't occur in practice since pretty much
nobody dares to use variable names that contain an actual '$' in their
name. This is not about the fairly common VAR.${param} (as written in
the makefile), but instead about the variable whose name is literally
'VAR.${param}'.

The test demonstrates that after the fix, the variable name is taken
exactly as-is for the simple assignment modifier '::='. There are no
such tests for the modifiers '::+=', '::!=' and '::?=', but that's ok.
The code in ApplyModifier_Assign would look assymetrical and suspicious
enough if one of these modifiers would expand its variable name and the
others wouldn't.
 1.10  15-Mar-2021  rillig tests/make: demonstrate that the modifier '::=' expands the varname
 1.9  23-Feb-2021  rillig make: improve error message for bad modifier in variable expression

The improvement is especially noteable for variable expressions based on
the empty variable, see moderrs.exp:103.
 1.8  23-Feb-2021  rillig make: improve error message for unknown modifier

Back in 1995, the modifiers were all single-character, and it made sense
to print only the first character. Nowadays, with ':S', ':@var@...@',
'::=' and several others, a little more context is useful to see where
the exact error is. The actual modifier is still guessed, and the guess
may be wrong as soon as backslashes get involved, but it is still better
than before.
 1.7  23-Feb-2021  rillig make: add quotes around variable name in an error message
 1.6  18-Oct-2020  rillig make(1): explain existing tests for the ::= assignment modifiers
 1.5  25-Aug-2020  rillig make(1): fix error message for ::!= modifier with shell error

It's just too easy to confuse st->val and val.
 1.4  25-Aug-2020  rillig make(1): add test for ::!= modifier with shell error
 1.3  25-Aug-2020  rillig make(1): move test for the ::= modifier to varmod-assign
 1.2  16-Aug-2020  rillig make(1): move tests for the :gmtime and ::= modifiers to separate files
 1.1  16-Aug-2020  rillig make(1): add dummies for fine-grained tests, one per single feature

The test names have been derived from the current manual page.

All these tests are dummies right now, and the code from the existing
tests will be moved into the new tests step by step.

This is done to prevent modmisc, escape, varmod-edge and varmisc from
growing without any bounds, and to reduce the side-effects of one test
to the others.
 1.20.2.2  02-Aug-2025  perseant Sync with HEAD
 1.20.2.1  01-Jul-2024  perseant Sync with HEAD.

RSS XML Feed