headcrab-rs / headcrab

A modern Rust debugging library 🦀
https://headcrab.rs
Other
888 stars 32 forks source link

Setup CI infrastructure to run non-x86 builds #131

Open nbaksalyar opened 3 years ago

nbaksalyar commented 3 years ago

We can run non-x86 builds with qemu (like e.g. rust-lang/libc does) in order to ensure that Headcrab can still be built without errors on non-x86 platforms (even if it's not entirely functional).

This will help us to prepare for introducing more target_archs in the future.

philipc commented 3 years ago

https://github.com/rust-embedded/cross is easy to use. It runs tests using qemu.

nbaksalyar commented 3 years ago

Great suggestion, thank you!

pro465 commented 2 years ago

@nbaksalyar parhaps all you need to do is copy and paste https://gist.github.com/pro465/a33a080d82d2ea28725a5956abb57871

it should be noted that i basically copied and pasted https://github.com/actions-rs/example/blob/master/.github/workflows/cross_compile.yml with some changes to make it cross-test instead of cross-compile without knowing if it will work, and the last time the example was updated was two years ago, so I'm not sure if that will work.

bjorn3 commented 2 years ago

QEMU user mode doesn't support ptrace so using cross won't help unfortunately. A VM will likely be needed.

pro465 commented 2 years ago

oh that's unfortunate :(

pro465 commented 2 years ago

@bjorn3 but wait, does libc not contain ptrace too? then how do they run/test it in QEMU?

bjorn3 commented 2 years ago

The libc crate doesn't contain any tests at all AFAIK. They only check that it matches the C header files I believe.

nbaksalyar commented 2 years ago

Yes, it's a matter of actually executing cross-arch code, whether it's cross-compilated or built natively.

It seems that the simplest option to execute tests would be to run CI on a dedicated server (e.g. there are arm-based nodes) - but we don't support any ISAs apart from x86_64 yet, so I would consider this more of a long-term goal.