-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support testing of non-host architecture via qemu #267
Comments
I won't be back active until the 7th, but then could try and help with
this...maybe adding the target arch/triple to the tests and using it....
That could be done in separate PR and all would have x86 initially...
I don't have Linux on my Apple Silicon machines (yet!) and don't have any
arm Linux box.... But thinking of that made me wonder if qemu would help
make that work, executing x86 on arm machine!!
…On Thu, Jan 2, 2025, 6:37 AM David Lattimore ***@***.***> wrote:
@marxin <https://github.com/marxin> is in the process of porting to
aarch64. Not all the tests pass on ARM yet, but some do.
It'd be great if we could run tests for arm even if we're developing on
x86-64. This should be possible with qemu. For some helpful (debian /
ubuntu based) instructions, see this blog post
<https://azeria-labs.com/arm-on-x86-qemu-user/>.
@andrewdavidmackenzie <https://github.com/andrewdavidmackenzie> - perhaps
this is something you might be interested in?
I'm not sure exactly what it might look like. One possibility is that our
tests could have an instruction in them to specify which architectures the
test should run on. e.g. //#Arch:x86_64, aarch64. We'd then need to add
additional flags to the compiler (and possibly linker) to specify the
architecture. Then, when running the resulting binary, if the architecture
isn't the same as the host, we'd run the binary using qemu-aarch64 or
equivalent.
—
Reply to this email directly, view it on GitHub
<#267>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABKF4LFTHAFU4WJIS6MBDMT2ITGADAVCNFSM6AAAAABUPL4QQSVHI2DSMVQWIX3LMV43ASLTON2WKOZSG43DKNBWHEZDGMI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I was thinking more the other way around - executing arm binaries on an x86-64 Linux machine, but it could plausibly work both ways. Rather than adding the option to all tests, one possibility would be to make the option have a default value, which initially could be "x86_64, aarch64", then override that default for the tests that are x86_64-specific (e.g. because they're written in x86 assembly), or which just don't yet pass on aarch64. |
Adding the qemu support to integration tests might be non-trivial as one needs to properly install cross GCC/Clang, glibc and I am not sure about the qemu when it comes to the dynamically linked binary. An initial step for me would be porting most of the integration tests away from the assembly to C/Rust code that can be run by both platforms. The second step, in my opinion, can be porting the remaining assembly bits to aarch64 as well. Similarly to what I did here: wild/wild/tests/sources/exit.c Line 17 in 80e2fc5
|
At least on ubuntu, installing the required packages for cross compiling to arm was pretty easy - just ran I was able to run a dynamically linked aarch64 program by following the instructions in the post. I agree, that reducing the number of x86-64-specific asm tests would be very helpful for porting. |
Then it sounds cool and having the AArch64 coverage in CI would be great. Related PR: #280 |
@marxin is in the process of porting to aarch64. Not all the tests pass on ARM yet, but some do.
It'd be great if we could run tests for arm even if we're developing on x86-64. This should be possible with qemu. For some helpful (debian / ubuntu based) instructions, see this blog post.
@andrewdavidmackenzie - perhaps this is something you might be interested in?
I'm not sure exactly what it might look like. One possibility is that our tests could have an instruction in them to specify which architectures the test should run on. e.g.
//#Arch:x86_64, aarch64
. We'd then need to add additional flags to the compiler (and possibly linker) to specify the architecture. Then, when running the resulting binary, if the architecture isn't the same as the host, we'd run the binary usingqemu-aarch64
or equivalent.The text was updated successfully, but these errors were encountered: