JohnTitor / ctest2

Automatic testing of FFI bindings for Rust
https://crates.io/crates/ctest2
Apache License 2.0
22 stars 20 forks source link

Swap size and value args in roundtrip tests #41

Closed wesleywiser closed 1 year ago

wesleywiser commented 2 years ago

If there is a disagreement on the size of the value, this can cause issues on archs that pass parameters on the stack (such as x86) leading to non-sensical errors like this:

size of struct sched_param is 28 in C and -134597808 in Rust

Swapping the parameter order alleviates this:

size of struct sched_param is 28 in C and 20 in Rust

JohnTitor commented 2 years ago

Is there any way to test it? Does it work to add a test code to testcrate and run it on i686-unknown-linux-gnu?

JohnTitor commented 1 year ago

@wesleywiser Friendly-ping, do you have any thoughts about the above comment? Note that the testcrate currently doesn't test items correctly (see https://github.com/JohnTitor/ctest2/issues/45), so it's fine to accept w/o a test :)

wesleywiser commented 1 year ago

Sorry! I took a look briefly the other week but couldn't quite figure out how to get a good testcase and haven't had much time to look at it again since.