You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/workflow/testing/coreclr/running-arm32-tests.md
+5-57Lines changed: 5 additions & 57 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,62 +1,6 @@
1
1
# Running ARM32 tests on modern hardware
2
2
3
-
One of our supported targets is 32-bit ARM. It can be quite challenging to construct a realistic ARM32 environment where you can build or run tests in a reasonable amount of time. Thankfully, it's possible to take some shortcuts, and do your build in a different environment, which reduces your need to 'somewhere I can run ARM32 binaries'. This is a rough explanation of one way to do that - building your runtime+tests in a cross-build container, and then running them in an ARM64 linux environment.
4
-
5
-
## Setting up a cross-build environment targeting ARM32
6
-
7
-
https://github.com/dotnet/runtime/blob/main/docs/workflow/building/coreclr/cross-building.md#linux-cross-building provides detailed instructions on how to cross-build, but if you try to cross-build for ARM32 in particular, you're likely to encounter issues due to latent problems in our build scripts and dependencies. As such, here's a set of steps that worked for me:
8
-
9
-
1. Pull the `mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-cross-arm-net9.0` docker image onto an x64 host.
10
-
2. Spawn a persistent container from the image. regular `docker run` won't work right, so you want to spawn a shell in the container and leave it running, i.e. `docker run -dit mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-cross-arm-net9.0 bash`
11
-
3. Attach to the now-running container. You can find it with `docker container list` and then `docker attach <container-hash>`. You are now in a cross-build ready environment that has an ARM32 cross-build root at `/crossrootfs/arm`.
12
-
4.`git clone` the runtime and check out the branch you wish to build.
13
-
5. Perform a cross build of the runtime with the right flags set to be able to also cross-build tests. The details are important here; if you miss one of these switches the test build will probably go looking for x64 linux binaries or things like that.
14
-
15
-
```bash
16
-
$ export ROOTFS_DIR=/crossrootfs/arm
17
-
18
-
$ ./build.sh clr+libs+host+packs -rc Release -lc Release -c Debug -arch arm -os linux -cross
19
-
Build succeeded.
20
-
0 Warning(s)
21
-
0 Error(s)
22
-
23
-
Time Elapsed 00:07:59.69
24
-
25
-
$ ./src/tests/build.sh release arm -cross /p:LibrariesConfiguration=Release
26
-
Test build successful.
27
-
Test binaries are available at /home/runtime/artifacts/tests/coreclr/linux.arm.Release
Make sure to match the `LibrariesConfiguration` for the tests build to the `-lc` configuration from the runtime build.
35
-
36
-
Now that you've successfully built the runtime and tests, you're going to want to grab the entire artifacts directory, and migrate it from this build environment to your execution environment. First, archive the whole artifacts directory from inside the container, in the existing shell you opened:
37
-
38
-
```bash
39
-
$ tar -acf /home/artifacts.tar.gz ./artifacts
40
-
```
41
-
42
-
This will take a while, the artifacts folder is big. Now outside of the container, grab the artifacts tarball from its filesystem using `docker cp`, and migrate it to the ARM64 environment where you will be running tests - i.e.:
This will take a while, the tarball is probably a few gigabytes. Once it's in the right place, you can migrate over to the ARM64 environment and get set up, i.e.:
This will also take a while since cloning the runtime repo isn't fast and neither is unpacking a 4GB tarball, but once it's done, you're almost ready to run tests!
3
+
One of our supported targets is 32-bit ARM. It can be quite challenging to construct a realistic ARM32 environment where you can build or run tests in a reasonable amount of time. Thankfully, it's possible to configure an ARM64 linux environment so that you can cross-build from ARM64 to ARM32, and run tests there using native hardware support instead of software emulation. This is not possible on ARM64-based Windows (this functionality is not offered by the OS).
60
4
61
5
## Configuring your ARM64 environment to run ARM32 binaries
62
6
@@ -74,6 +18,10 @@ The following additional packages will be installed:
74
18
75
19
Note that when installing a package for another architecture, you need to suffix the package name with the architecture name. For me, the three packages above were sufficient to run an ARM32 JIT test.
76
20
21
+
## Cross-building for ARM32 on ARM64
22
+
23
+
Follow the steps from https://github.com/dotnet/runtime/blob/main/docs/workflow/building/coreclr/cross-building.md#linux-cross-building as-is. You should end up with a `linux.arm``Core_Root` and test artifacts.
24
+
77
25
## Running an ARM32 test in your ARM64 environment
78
26
79
27
We're finally ready to go, probably. Export an environment variable to point to your ARM32 core root, and then run your test, i.e.:
0 commit comments