-
Notifications
You must be signed in to change notification settings - Fork 19
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
Generate layout tests using real sizeof
/alignof
#181
Conversation
235fc09
to
783e317
Compare
Workspace Cargo.toml can define deps that get inherited by crates, which in our case is particularly useful for bindgen but also means we can update less places if our git dependencies change names etc.
d47c585
to
d658291
Compare
d658291
to
971cba3
Compare
c667787
to
971cba3
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.
A very interesting solution for our custom-compiler setup! This might just solve all size-related uncertainties in the testing suite.
Other than for a couple of missing features, which aren't really needed, I feel like this addition has all that it needs to be an useful replacement for bindgen tests. Great job! 👏
cc = "1.0" | ||
cpp_build = { optional = true, git = "https://github.com/mystor/rust-cpp.git" } |
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.
Why not use the version on crates.io?
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.
Mostly so I could use mystor/rust-cpp#111 which hasn't been released yet. We could do without it and just re-define all the cc
configuration, or pin the commit hash, but I wasn't too worried about it since this is a test-only dependency
Blocklist specific bitfields etc instead of whole types, and document why each one is blocklisted. Also support field renames for mangling (e.g. `type`).
This is an interesting point — for now, I've left the bindgen tests in place because I think they might still be useful to assert properties that clang thinks about the generated types... Especially given that only adds around 1 minute to CI time, and takes almost no effort on our part, do you think we should leave those alone and keep running them alongside these new tests? Otherwise, I think this PR is pretty much good to go so I will probably merge once everything is passing 🚀 |
Very much so,
👍 |
Similar to the tests generated by
bindgen
, but using our actual toolchain to spit out the expected values instead of what libclang generates (bindgen's default behavior).The full generated test can be downloaded from Actions: https://github.com/rust3ds/ctru-rs/actions/runs/9072691412/artifacts/1499437252
Here's a partial example: