| History log of /src/usr.bin/make/unit-tests/moderrs.exp |
| Revision | | Date | Author | Comments |
| 1.54 |
| 28-Jun-2025 |
rillig | make: consistently use double quotes in error messages
Previously, some error messages used single quotes, very few used backticks or parentheses, most already used double quotes.
While here, reword a few error messages to be clearer or more consistent with related error messages.
|
| 1.53 |
| 30-Mar-2025 |
rillig | make: fix error message for invalid ":[...]" modifier
The unparsed value of the modifier argument can already be seen in the stack trace, but the modifier argument may contain expressions and the expanded value of these expressions was hidden up to now. See the EMPTY test at the bottom of varmod-select-words.mk for details.
|
| 1.52 |
| 30-Mar-2025 |
rillig | make: let the ":t" modifiers fall back to the ":from=to" modifier
Suggested by https://bugs.freebsd.org/285726.
This means that the ":t" modifiers cannot have future extensions that include a "=", as that may break existing code.
|
| 1.51 |
| 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.50 |
| 29-Mar-2025 |
rillig | make: stop parsing after seeing an unknown modifier in an expression
Previously, after an expression such as ${VAR:Z::::}, make detected the unknown modifier ":Z" and then continued parsing, which produced unnecessary follow-up error messages. It was also necessary to distinguish the error cases when logging the result of an applied modifier in -dv mode.
Unify the error handling cases of a syntax error, an evaluation error and an unknown modifier, to avoid the unnecessary follow-up error messages.
The test in varmod-edge.mk now produces ":}" from the erroneous expression, which may be misleading and thus will be looked at in a follow-up commit.
The general idea of this patch was reviewed by sjg, I made a few nonsubstantial changes after the review.
|
| 1.49 |
| 29-Mar-2025 |
rillig | make: fix error message for unclosed expression
Even in an unclosed expression such as "${VAR:from=to", the modifier ":from=to" needs to be recognized as such, instead of giving an error message about an "Unknown modifier ":from=to"".
|
| 1.48 |
| 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.47 |
| 29-Mar-2025 |
rillig | make: add details about indirect modifiers to the stack traces
Previously, the error message "Unfinished modifier (',' missing)" from moderrs.mk didn't provide enough context to understand where and why the comma was missing.
|
| 1.46 |
| 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.45 |
| 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.44 |
| 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.43 |
| 20-Jul-2024 |
rillig | tests/make: remove redundant context information
The affected target is already mentioned in the line containing the error message.
|
| 1.42 |
| 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.41 |
| 05-Jul-2024 |
rillig | make: in error messages for anonymous variables, log the value
|
| 1.40 |
| 05-Jul-2024 |
rillig | make: error out on unclosed expressions during parse time
In exchange, this adds location information.
For unnamed expressions, the value is no longer printed. This will be added back in a follow-up commit.
|
| 1.39 |
| 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.38 |
| 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.37 |
| 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.36 |
| 30-Jun-2024 |
rillig | tests/make: replace 'want' comments with 'expect' directives
The 'want' comments needed to be cross-checked manually, which was error-prone, as can be seen in the "Unknown modifier" messages that got out of sync.
|
| 1.35 |
| 20-Apr-2024 |
rillig | branches: 1.35.2; make: provide more context information for parse/evaluate errors
|
| 1.34 |
| 19-Nov-2023 |
rillig | tests/make: replace 'variable expressions' with 'expressions'
|
| 1.33 |
| 19-Nov-2023 |
rillig | make: replace 'variable expression' with 'expression' in diagnostics
|
| 1.32 |
| 21-Jun-2021 |
rillig | tests/make: remove unnecessary -dL from moderrs.mk
It was only needed for the test for unmatched subexpressions in the modifier ':C'. That test has been moved to varmod-subst-regex.mk.
|
| 1.31 |
| 21-Jun-2021 |
rillig | tests/make: move and extend test for unmatched '\1' in ':C'
This test lived together with a few unrelated tests in moderrs.mk, it is better placed in varmod-subst-regex.mk though.
While here, extend, document and explain the test since its purpose was not obvious from reading the code alone.
|
| 1.30 |
| 21-Jun-2021 |
sjg | Do not report unmatched regex subexpressions
It is not always an error for a subexpression to have not matched, since the regex library can/does not convey how many matches are expected, only report an error if opts.strict (-dL)
Reviewed by: christos
|
| 1.29 |
| 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.28 |
| 23-Feb-2021 |
rillig | make: add test for confusing error message for bad modifier
In the expression ${:U}, the variable name is empty. Since these expressions are generated by .for loops, the error messages for them must not end with a trailing space. Putting the variable name in quotes helps against that.
|
| 1.27 |
| 23-Feb-2021 |
rillig | make: improve error message for unclosed modifier
Replace "variable specification" with the more modern "variable expression", reduce the number of parentheses, output more than a single character for modifiers, make it obvious that in expressions such as ${:Serror}, the "" means a variable name.
|
| 1.26 |
| 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.25 |
| 23-Feb-2021 |
rillig | make: quote ':S' in error message about missing delimiter
|
| 1.24 |
| 23-Feb-2021 |
rillig | make: add quotes around variable name in an error message
|
| 1.23 |
| 01-Nov-2020 |
rillig | make(1): treat malformed :range, :ts and :[...] as errors
Before, integer overflow in the :[1..2] modifier had not been detected, and the actual behavior varied between ILP64 and LP64I32 machines.
Before, the :ts modifier accepted character literals like \012345 and \x1F600, which don't fit in a single character and were thus truncated.
Before, the :range modifier issued an "Unknown modifier" error message for :range=x, which was not quite correct. The error message in this case is now "Invalid number".
|
| 1.22 |
| 01-Nov-2020 |
rillig | make(1): demonstrate parsing bugs in test moderrs.mk
When a malformed variable expression is parsed, the remaining part of the expression is passed unmodified to the output. This is unexpected and wrong.
|
| 1.21 |
| 01-Nov-2020 |
rillig | make(1): renumber the tests in moderrs.mk, remove duplicates
|
| 1.20 |
| 01-Nov-2020 |
rillig | make(1): make test names in moderrs.mk more descriptive
|
| 1.19 |
| 01-Nov-2020 |
rillig | make(1): precisely describe the expected output in the test moderrs.mk
By making "want:" the same length as "make:", the remaining text in these lines can be compared easily.
|
| 1.18 |
| 01-Nov-2020 |
rillig | make(1): separate sections of moderrs.mk with empty lines
|
| 1.17 |
| 01-Nov-2020 |
rillig | make(1): add section headings to the test moderrs.mk
|
| 1.16 |
| 25-Aug-2020 |
rillig | make(1): move test for the ::= modifier to varmod-assign
|
| 1.15 |
| 09-Aug-2020 |
rillig | make(1): improve test for undefined subexpression in :C modifier
In the previous test output, it was unnecessarily hard to see what happens because of the many empty strings. Enclosing the capturing groups in parentheses helps against this.
|
| 1.14 |
| 09-Aug-2020 |
rillig | make(1): add test for undefined subexpression in the :C modifier
|
| 1.13 |
| 08-Aug-2020 |
rillig | make(1): improve error message in case of unfinished modifiers
The previous error message "Unclosed substitution" was wrong for several reasons.
It is not about "unclosed", but about "unfinished" since in the :@var@...@ modifier the missing '@' does not really close anything.
The word "substitution" may have originated in a time where :S and :from=to were the only modifiers, and these were indeed substitutions, but several other modifiers aren't.
The :S and :C modifiers allow an arbitrary delimiter, therefore it is helpful to enclose the delimiter in quotes, just in case someone chooses ')' or '{' or even ' ' as delimiter.
|
| 1.12 |
| 31-Jul-2020 |
rillig | make(1): add test for parsing an incomplete :t modifier
This looks a lot like undefined behavior, just like in :S and :C before.
|
| 1.11 |
| 31-Jul-2020 |
rillig | make(1): fix undefined behavior when parsing malformed :C modifier
Same as in the :S modifier.
|
| 1.10 |
| 31-Jul-2020 |
rillig | make(1): fix undefined behavior in malformed :S modifier
The unit tests failed on Ubuntu, and by looking closely at the code, it was trivial to see the out-of-bounds memory read.
Other modifiers may have the same problem and will be inspected later.
|
| 1.9 |
| 29-Jul-2020 |
rillig | make(1): fix segfault when evaluating ${::=value}
The bug had been in the handling of the SysV modifier for many years, but it had not been triggered since the "parsing position for the next modifier" had been initialized to a non-NULL pointer.
In var.v r1.350, this pointer had been initialized to NULL instead since every ApplyModifier function must set it in every case where it returns anything except "default_case".
There might have been a slight chance of tricking make to output a wrong error message, but nothing worse.
|
| 1.8 |
| 29-Jul-2020 |
rillig | make(1): add enough tests to cover the ApplyModifier functions
Only a few return statements are still missing from the code coverage.
In ApplyModifier_Assign, the test for an empty variable name is skipped for now since it segfaults.
In ApplyModifier_SysV after the second ParseModifierPart, the branch for the missing delimiter is not reached since this case is already checked for in the first part of the function. To trigger this branch, a specially crafted, unrealistic string needs to be created, and that's too complicated for the moment.
|
| 1.7 |
| 29-Jul-2020 |
rillig | make(1): add unit tests for parse errors in modifiers
|
| 1.6 |
| 28-Jul-2020 |
rillig | make(1): add test for modifier part with unbalanced braces
|
| 1.5 |
| 26-Jul-2020 |
rillig | make(1): add tests for :!...! parse errors
|
| 1.4 |
| 26-Jul-2020 |
rillig | make(1): add test for missing input validation in :[123] modifier
|
| 1.3 |
| 26-Jul-2020 |
rillig | make(1): fix missing error message about missing @ delimiter
This had been broken since 2020-07-03, during a "refactoring".
|
| 1.2 |
| 26-Jul-2020 |
rillig | make(1): add test about missing delimiters in :@ modifier
These error conditions have been broken since var.c 1.236 on 2020-07-03.
|
| 1.1 |
| 21-Aug-2014 |
apb | Give each group of tests its own output file.
* Rename each sub-makefile to *.mk; * Add a *.exp file of expected output for each sub-makefile; * Remove test.exp, which is replaced by all the other *.exp files. * Use suffix rules to generate *.rawout and *.out files for each test case. * Rewrite the test and accept targets to adapt to the new way.
The old (now removed) test.exp file is almost identical to the concatenation (in the correct order) of all the new *.exp files. There are expected differences in makefile names embedded in the output, and the new "exit status" lines. Some old "*** Error code 1 (ignored)" lines are also removed (replaced by new "exit status 1" lines).
|
| 1.35.2.2 |
| 02-Aug-2025 |
perseant | Sync with HEAD
|
| 1.35.2.1 |
| 01-Jul-2024 |
perseant | Sync with HEAD.
|