Add linux aarch64 target to ci test
I guess it should be as simple as this now that aarch64 runners have been added.
Not sure what to do about the failure:
failures:
---- test_wrap_static_fns stdout ----
In path is ::: tests/expectations/tests/generated/wrap_static_fns
Out path is ::: /home/runner/work/rust-bindgen/rust-bindgen/target/debug/build/bindgen-tests-c763cee99ba75d0d/out/wrap_static_fns
thread 'test_wrap_static_fns' panicked at bindgen-tests/tests/tests.rs:742:10:
Failed to generate bindings: Codegen(Serialize { msg: "Cannot serialize type kind Opaque", loc: "tests/headers/wrap-static-fns.h:63:56" })
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
test_wrap_static_fns
This needs a rebase but I think the failure is legit. Is it crashing on the valist in that test?
If you can reproduce locally, it'd be great to see what bit of the test is failing.
I reproduced and got a stacktrace locally:
thread 'test_wrap_static_fns' panicked at bindgen-tests/tests/tests.rs:742:10:
Failed to generate bindings: Codegen(Serialize { msg: "Cannot serialize type kind Opaque", loc: "tests/headers/wrap-static-fns.h:63:56" })
stack backtrace:
0: __rustc::rust_begin_unwind
at /rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/library/std/src/panicking.rs:697:5
1: core::panicking::panic_fmt
at /rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/library/core/src/panicking.rs:75:14
2: core::result::unwrap_failed
at /rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/library/core/src/result.rs:1704:5
3: core::result::Result<T,E>::expect
at /rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/library/core/src/result.rs:1061:23
4: tests::test_wrap_static_fns
at ./tests/tests.rs:736:21
5: tests::test_wrap_static_fns::{{closure}}
at ./tests/tests.rs:724:26
6: core::ops::function::FnOnce::call_once
at /rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/library/core/src/ops/function.rs:250:5
7: core::ops::function::FnOnce::call_once
at /rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
test test_wrap_static_fns ... FAILED
How to reproduce, something like this:
docker run --platform linux/arm64 -ti rust:latest bash
apt update
apt install libclang1-19
git clone https://github.com/rust-lang/rust-bindgen
cd rust-bindgen
RUST_BACKTRACE=1 cargo test test_wrap_static_fns
I tried running it manually but it seems to succeed, @emilio how can I trigger the panic by running bindgen?
$ cargo run -- bindgen-tests/tests/headers/wrap-static-fns.h
Finished `dev` profile [unoptimized + debuginfo] target(s) in 5.54s
Running `target/debug/bindgen bindgen-tests/tests/headers/wrap-static-fns.h`
Warning: can't set `binop_separator = Back`, unstable features are only available in nightly channel.
/* automatically generated by rust-bindgen 0.72.0 */
pub type func = ::std::option::Option<
unsafe extern "C" fn(arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int,
>;
pub const foo_BAR: foo = 0;
pub type foo = ::std::os::raw::c_uint;
edit: Managed to reproduce
$ cargo run -- --wrap-static-fns bindgen-tests/tests/headers/wrap-static-fns.h
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.05s
Running `target/debug/bindgen --wrap-static-fns bindgen-tests/tests/headers/wrap-static-fns.h`
Unable to generate bindings: codegen error: serialization error at bindgen-tests/tests/headers/wrap-static-fns.h:63:56: Cannot serialize type kind Opaque
edit2: Attached debug output debug.log
edit3: I have never worked on bindgen, so I probably won't be able to figure out what could be wrong here.
Ok, to reproduce that on x86_64 you can:
cargo run -- --wrap-static-fns bindgen-tests/tests/headers/wrap-static-fns.h -- -target aarch64-unknown-linux-gnu
It seems bindgen can't reason about the builtin va_list there: https://github.com/Blizzard/clang/blob/6c67f57680c38ccd146786841eeac753ad45bf0f/lib/AST/ASTContext.cpp#L6099
As a workaround for now, you can probably ifdef the tests using va_list and update expectations or so.
Please do file an issue about the wrap-static-fns not dealing with valists in aarch64
Fixed the failed CI and rebased
Maybe it is a bit excessive to run all the combinations on aarch64-linux. Which combination would give most bang for the buck?