rust-lang / rust-lang/rust-bindgen
Generated tests are not compatible across architectures
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
Input C/C++ Header
struct Foo {
int bar;
};
Bindgen Invocation
Run on x86_64-apple-darwin:
$ bindgen input.h
Test with: cargo test --target=i686-apple-darwin
Actual Results
fn bindgen_test_layout_Foo ( ) …
Expected Results
The tests are valid only on the architecture bindgen was run on. It would be great if bindgen was able to make tests portable, e.g.:
#[cfg(target_pointer_width = "64")]
fn bindgen_test_layout_Foo ( ) …
#[cfg(target_pointer_width = "32")]
fn bindgen_test_layout_Foo ( ) …
Currently this isn't easy to do even manually, because tests are interleaved with other code, so combining of 32- and 64-bit files requires advanced regex-fu.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the shown input.h, bindgen invocation, and cargo test --target=i686-apple-darwin command. Inspect the generated bindgen_test_layout_Foo functions and how layout tests are interleaved with other generated code. Done means generated tests remain valid when bindgen runs on x86_64-apple-darwin and tests run on i686-apple-darwin.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, cpp, rust
- Domain
- compilers, testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100