-
Notifications
You must be signed in to change notification settings - Fork 283
refactor: Update reorganize_definitions test and fix some issues
#1484
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.
Is this a snapshot?
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.
How do I run the test?
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.
Go into c2rust-refactor/tests, run run-test.sh reorganize_definitions. I think we should start adding these tests back to CI, but I wasn't sure if it goes into this PR or do another one.
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.
It'd be nice to have all the testing just in Rust instead of scattered shell scripts.
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'd like to move all the refactorer tests into tests/refactor at the top level, and then we can change the testing there. We should do that separately though.
It'd be nice to have all the testing just in Rust instead of scattered shell scripts.
I'm not sure how this is supposed to work in this case. The inputs are Rust files that we feed into the refactorer, are you saying we should call that tool from Rust #[test] code? I'm not sure how that's simpler or what it buys us over shell scripts.
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'd like to move all the refactorer tests into
tests/refactorat the top level, and then we can change the testing there. We should do that separately though.
I don't care too much, but our transpiler snapshot tests are under c2rust-transpile/, so the way it is now would be the same.
I'm not sure how that's simpler or what it buys us over shell scripts.
We just run cargo test and cargo figures out what we need to build. For example the current shell scripts have a lot of complexity over setting up paths and run only debug mode, whereas with cargo it just does the right thing.
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.
Alright, we can do that but I'd prefer making a separate PR for those (probably larger) changes.
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.
Yep, that's totally fine.
af7d13d to
5665646
Compare
| _ => 'match_fields: { | ||
| if variant1.fields().len() != variant2.fields().len() { | ||
| break 'match_fields false; | ||
| } |
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.
Oh clever!
reorganize_definitions test and fix some issues
kkysen
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.
I think this all LGTM now besides those two little nits.
…ce for function signatures
…/unions in compatible_types
5665646 to
e1fbe80
Compare
statvfsstructure has a private field that we cannot useWhen matching between two types to determine whether they can be unified, we now account for differences in visibility because importing a structure with private types from an external crate (e.g.
libc) makes them unusable to us when trying to construct new values of those types. The motivating example isstatvfs: