Skip to content

Commit

Permalink
fix: disable bindgen layout tests
Browse files Browse the repository at this point in the history
They are mainly useful to catch unexpected layout discrepancies across
platforms, but we were already expecting such discrepancies on Windows,
due to the bindings being pregenerated on Linux.

It'd be great to still have these tests on Linux, but with current
versions of bindgen that's not doable without resorting to increasing
tech debt. (See
rust-lang/rust-bindgen#2787 (comment))
  • Loading branch information
AlexTMjugador committed Nov 28, 2024
1 parent 4cb5cf2 commit ef0dcc4
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 978 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ jobs:
packages-to-test: -p ogg_next_sys -p aotuv_lancer_vorbis_sys -p vorbis_rs
- target: x86_64-pc-windows-gnu
runner: windows-2022
# Low-level FFI binding crates mostly contain layout tests
# that assume a Unix-like platform, so they won't work
# on Windows
packages-to-test: -p vorbis_rs
- target: x86_64-apple-darwin
runner: macos-13
packages-to-test: -p ogg_next_sys -p aotuv_lancer_vorbis_sys -p vorbis_rs
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ and this project adheres to
### Changed

- Bumped MSRV to 1.82 due to refactors to use methods like `Box::new_uninit`.
- Reduced size of the autogenerated C bindings code by dropping layout tests,
which were expected to fail on non-Linux platforms anyway due to
platform-specific code generation differences.

### Fixed

Expand Down
4 changes: 2 additions & 2 deletions packages/aotuv_lancer_vorbis_sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ cc.workspace = true
bindgen = { workspace = true, optional = true }

[features]
# Requires Clang and slows down the build, but guarantees that the bindings are up to date.
# It usually is better to run the generate-bindings.sh script instead
# Requires Clang and slows down the build, but guarantees that the bindings are tailored for the platform and up to date.
# It is usually better to run the generate-bindings.sh script instead
build-time-bindgen = ["bindgen"]
3 changes: 2 additions & 1 deletion packages/aotuv_lancer_vorbis_sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ fn main() {
.blocklist_item("FILE")
.blocklist_item("ogg_.*")
.blocklist_item("__.*")
.rust_target(RustTarget::Stable_1_73)
.rust_target(RustTarget::Stable_1_77)
.layout_tests(false) // Type layout is platform-specific
.generate()
.expect("Unable to generate bindings")
.write_to_file("src/bindings.rs")
Expand Down
Loading

0 comments on commit ef0dcc4

Please sign in to comment.