-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Set handlers use unified jsonPrint with prettifier if needed #12179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! This looks good overall but tests in CI are failing. You need to update tests so that the output matches expectations.
- in
t_ubu_clithe test namedast_compact_json_with_base_pathis failing because--ast-compact-jsonused to pretty-print the output by default. Now it no longer does. You need to add--pretty-printto itsargsfile to perserve the current output. There might be more tests that need a similar change. You can run the CLI tests locally withcommandLineTests.sh - Lots of test cases fail in
t_ubu_soltest. Same reason as above. To fix them you need to modify the test case runners to pass the right options to the functions that generate JSON. For example this needs to be done inABIJsonTest: https://github.com/ethereum/solidity/blob/ef21e43fa36be8ff58725133aa5bb6e74bd06baf/test/libsolidity/ABIJsonTest.cpp#L64
This is of course not the only place. - Please add new CLI tests that cover both pretty-printed and normal output for these options so that we can see that the change works. Take a look at #11639 if you want to see how to add such tests.
- Finally, since this does not cover
--metadata, please removeCloses #12011from PR description. We don't want to close the issue before all options are addressed. But doing the metadata separately is definitely a good idea since this one might require some discussion in the team while the other options should not be controversial at all.
|
Do you need any help with adding/updating these tests? |
|
I'd be happy to update the tests if that's still blocking merge |
|
Sure. Looks like @akali is not working on it so it's fine to take over. |
|
Is there a way to disable tests that require SMT/Horn solver in |
|
It supports the |
|
How do you input the pattern? Here's what I'm trying to run, but it doesn't like the arg format |
|
That should work if it's the full name of the test dir. If not, you have to add some wildcards: ./cmdlineTests.sh "*ast_compact_json_with_base_path*" |
|
|
Looks like you're having a problem with this line: Are you by chance on macOS? It's probably that This probably slipped though because we never really use this feature in CI - we always run all tests - and locally it worked for me on Linux so I never noticed. |
|
Yup I'm on macOS. I'll try that out, thanks |
|
The -c fix worked for me. PR #12348 |
|
@dallonasnes Are you still interested in working on this? |
|
Hi, better if someone else takes it. For tests to pass, it'll be small changes in many dozens of files, hadn't realized it was that broad of a change. |
|
@dallonasnes Test input must be updated, yes, but if you mean test output/expectations, we of course have auto-update mode so it does not have to be done manually. I.e. there's the |
|
I take over this PR. |
@cameel, I guess this is not the best way to go. We want to keep pretty JSONs in the test expectations and modify only the test runners, right? Please check a fixup commit I delivered and let me know it is fine. |
|
@wechman Ah, you're right! Looks like we were already pretty-printing by default in all cases so we can actually keep the expectations and just adjust the options. I misremembered that and thought that we needed to update expectation in some cases too but apparently not. This still needs some tests for the compact version though. |
|
@cameel, I added compact JSON output tests to the fixup commit. But, I noticed surprising result in ast_pretty_json_with_base_path test. There is pretty-printed JSON with following first line: "JSON AST (compact format):" in the test output. I am not sure if I the information about "compact format" is required to be part of the output, is it? Unless, I should not mix "--ast-compact-json" with "--pretty-json" in the test scenarios? |
|
The Maybe we could remove the "compact format" part from the header, though changing the output is technically a breaking change. Personally, I'd just leave it as is, it does correspond to the option name. Anyway, the output of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added some suggestions about test naming.
The remaining issues are that --pretty-print is meant to affect --ast-compact-json (so that needs to be changed back) and that some of the options covered by the PR appear not to be fully covered.
f8dcc5c to
5df1b1b
Compare
|
@cameel Thank you all your comments! I updated code accordingly. I also squashed commits and rebased them on the newest develop. |
cameel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
I just noticed that it's missing a changelog entry though. This is a change visible to users.
b5b5094 to
1a266e1
Compare
|
@cameel Changelog updated. |
|
@wechman not sure if you just rebased it, but cli tests failing |
|
Yeah, needs a rebase and updating CLI test expectations but other than that it's done. |
|
@leonardoalt @cameel I have just rebased. Also, I have updated expectations in one command line test case. |
Sticknmove
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
|
Thanks |
Sticknmove
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
|
Thanks |
3 similar comments
|
Thanks |
|
Thanks |
|
Thanks |
Partially addresses #12011 (all except for
--metadata).