-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
[tests] Refactor scripts/ASTImportTest.sh. #13576
Conversation
e7f6556
to
47a5775
Compare
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.
Hey, I took a look at the PR, and it looks good, I just made some comments ;)
scripts/ASTImportTest.sh
Outdated
printError "❌ ERROR: AST reimport failed for ${sol_file}" | ||
if [[ $ABORT_ON_ERROR == 1 ]] | ||
then | ||
printError "You can find the files used for this test here: $(pwd)" |
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 think something like that is useful. It allows to investigate the resulting json files and gives information what was actually done in these tests. so this should allow an easy reproduction.
0c2ee2a
to
73b5b88
Compare
@cameel @r0qs I'm somehow not sure what to do with #8185. I guess that issue was created, when the script was different. However, right now the only place where we redirect potential errors to |
73b5b88
to
c13aa5b
Compare
c13aa5b
to
8597351
Compare
It wasn't really that much different. In the last revision before the issue was reported I see that only
I think it would still be worthwhile to check why it's not compilable. If it's a compilation error, ignore. But if it's an ICE or a segfault, I'd print the error and exit. But to detect that, it would be best to compile via Standard JSON since then we can check if we got valid JSON on output. I wouldn't do this in this PR though because it's a bit unrelated. So just post a comment about it in the issue and leave it open.
This is nice and I think it solves part of that issue. I'd still keep it open as I said above though. |
Hmm.. interesting idea.. I think we should change return codes in See #13633 |
8597351
to
dabe9b4
Compare
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 fine overall, but still needs some small corrections.
After #13633 got merged, I change the script accordingly. However, the script will ignore all |
dabe9b4
to
c6c82b4
Compare
scripts/ASTImportTest.sh
Outdated
# compare expected and obtained ast's | ||
if diff_files expected.json obtained.json | ||
then | ||
echo -n "✅" |
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.
After staring on these nice unicode checkmarks for some hours today, I think they should not be used ;)
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.
Maybe we could ignore the print in case of success and only print an error if they are not equivalent?
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 will just remove the unicode checkmark. However, I think that CircleCI will terminate jobs that are not generating any output for a specific time. So I will let it still print normal dots.
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.
Yes, the normal dots are fine in my opinion. I was thinking of removing only the checkmarks as you mentioned. And keep the error in case the ast's are not equivalent.
Running the branch locally, I got the following result:
Is it expected that 1883 cannot be compiled? |
Ah yes! The reason for that the syntax tests. Many of these syntax tests consists of errors to be able to check for specific behaviour of the parser. Maybe we should change that to only use the semantic test cases. But in general the high amount of not compilable tests are expected. |
I think that syntax tests are actually more important for this feature than semantic tests. At least with regard to AST import/export - because they generally use more varied syntax so I'd expect them to cover more corner cases of the AST. For assembly import/export it might actually be the opposite though so ideally we'd have both. |
scripts/ASTImportTest.sh
Outdated
for PARAM in "$@" | ||
do | ||
case "$PARAM" in | ||
ast) IMPORT_TEST_TYPE="ast" ;; |
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 think this should be accepted only once. It's less of a problem when there's one possible value but later this approach will allow things like scripts/ASTImportTest.sh --exit-on-error evm-assembly ast
, which is very misleading because it looks as if it would run both sets of tests.
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 a simple function check_import_test_type_unset
that is called before setting IMPORT_TEST_TYPE
. This should solve the problem mentioned here.
7e82fc1
to
357d81c
Compare
@r0qs @cameel The original script did not invoke the code generator. This was changed in this PR. Thats why many of the syntax tests were treated as non-compilable. See #13576 (comment). I corrected this now. |
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 still have some suggestions but they're all cosmetic so tentatively approving.
I also added now another change in |
deaddec
to
dcfc59e
Compare
dcfc59e
to
ab706e3
Compare
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.
Please, fix this: #13576 (comment) and we are good to go :)
Co-authored-by: Kamil Śliwak <[email protected]>
I just applied it. 😛 Didn't see the need to wait. |
* [tests] Refactor scripts/ASTImportTest.sh. Co-authored-by: Nuno Santos <[email protected]> Co-authored-by: Kamil Śliwak <[email protected]>
* [tests] Refactor scripts/ASTImportTest.sh. Co-authored-by: Nuno Santos <[email protected]> Co-authored-by: Kamil Śliwak <[email protected]>
Refactors
script/ASTImportTests.sh
to make #12834 more readable.Fixes #8185