Pre-release warning stripping in CLI tests does not always produce correct JSON formatting when combined with --pretty-print
#13544
Labels
bug 🐛
good first issue
low effort
There is not much implementation work to be done. The task is very easy or tiny.
low impact
Changes are not very noticeable or potential benefits are limited.
should have
We like the idea but it’s not important enough to be a part of the roadmap.
testing 🔨
This came up in #13162 (review).
Non-release builds of the compiler always output an extra warning, which results in a different output between release and debug builds in CI:
For this reason
cmdlineTests.sh
script strips the warning from compile output. For Standard JSON this is more tricky, since the error is a part of an array and we have to match the JSON formatting of the expectations. The stripping code seems to have a small bug because in some cases the formatting it produces after stripping the warning differs from what we get when the warning is not there at all.We need to adjust the stripping code to handle this corner case. It would be best if we could also solve the problem more generally by making the CLI tests simply ignore the JSON formatting.
Fixing this is likely a prerequisite for #7665, since enabling pretty printing may uncover this problem in other existing tests.
How to reproduce
Let's look at the prettified Standard JSON output for this
input.json
file:This is what the output of a pre-release binary looks like unstripped:
The stripping in
cmdlineTests.sh
removes the pre-release warning, which results in this output:Note the
}],
sequence in the output. A release binary, that does not output the warning produces a slightly different formatting in that spot:As a result, it's impossible to write a test with nicely formatted JSON output that matches both release and pre-release build output. For example in #13162
t_ubu_release
fails if we expect}],
andt_ubu_cli
fails if we expect the other variant.The warning stripping code
You can find the code responsible for stripping this warning here:
solidity/test/cmdlineTests.sh
Lines 189 to 199 in 1fbee82
The text was updated successfully, but these errors were encountered: