rust-lang / rust-lang/rust-bindgen
Some expected are not overwritten with BINDGEN_OVERWRITE_EXPECTED=1
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
STR:
- Change some code in src/codegen/mod.rs related to the generating tests for layout
- Try to overwrite expected
BINDGEN_OVERWRITE_EXPECTED=1 cargo test
- Run the tests again
cargo test
Actual result:
failures:
test_mixed_header_and_header_contents
test_multiple_header_calls_in_builder
There no changes in appropriate files test_mixed_header_and_header_contents.rs and test_multiple_header_calls_in_builder.rs in tests/expectations/tests/
Expected result:
Tests are passed because expected files are overwritten
As I can see, we are regenerating expected files in fn compare_generated_header inside of macro_rules! test_header which is written to $OUT_DIR/out/tests.rs by build.rs. However, in build.rs we are applying this macro only to headers from tests/headers while test_mixed_header_and_header_contents.rs is generated manually from different headers in fn test_mixed_header_and_header_contents (tests/tests.rs). So, BINDGEN_OVERWRITE_EXPECTED=1 doesn't work here.
I've caught this bug in test_mixed_header_and_header_contents and test_multiple_header_calls_in_builder but I suppose it also affects all tests generated in tests/tests.rs manually.
Sorry, the codebase is a new for me, so I don't know how to fix it easily.
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
Read build.rs and tests/tests.rs, focusing on macro_rules! test_header, compare_generated_header, and the two named tests. Run BINDGEN_OVERWRITE_EXPECTED=1 cargo test followed by cargo test. Done means the manually generated tests overwrite their expectation files and the subsequent test run passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100