Merge pull request #4422 from RalfJung/more-ci

run CI on a bunch more architectures
This commit is contained in:
Ralf Jung 2025-06-29 21:05:18 +00:00 committed by GitHub
commit d1ee0ebbf0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 65 additions and 31 deletions

View file

@ -14,21 +14,33 @@ defaults:
jobs:
test:
name: build and test on ${{ matrix.host_target }}
name: test (${{ matrix.host_target }})
strategy:
fail-fast: false
matrix:
include:
- host_target: x86_64-unknown-linux-gnu
os: ubuntu-latest
# Needs a libffi patch: <https://github.com/libffi-rs/libffi-rs/pull/160>
# - host_target: i686-unknown-linux-gnu
# os: ubuntu-latest
- host_target: i686-unknown-linux-gnu
os: ubuntu-latest
multiarch: i386
gcc_cross: i686-linux-gnu
- host_target: aarch64-unknown-linux-gnu
os: ubuntu-24.04-arm
# Disabled due to <https://github.com/rust-lang/rust/issues/143184>.
# - host_target: armv7-unknown-linux-gnueabihf
# os: ubuntu-24.04-arm
- host_target: armv7-unknown-linux-gnueabihf
os: ubuntu-24.04-arm
multiarch: armhf
gcc_cross: arm-linux-gnueabihf
- host_target: riscv64gc-unknown-linux-gnu
os: ubuntu-latest
multiarch: riscv64
gcc_cross: riscv64-linux-gnu
qemu: true
- host_target: s390x-unknown-linux-gnu
os: ubuntu-latest
multiarch: s390x
gcc_cross: s390x-linux-gnu
qemu: true
- host_target: aarch64-apple-darwin
os: macos-latest
- host_target: i686-pc-windows-msvc
@ -38,28 +50,43 @@ jobs:
HOST_TARGET: ${{ matrix.host_target }}
steps:
- uses: actions/checkout@v4
- name: Install multilib dependencies
if: ${{ matrix.host_target == 'i686-unknown-linux-gnu' }}
- name: install qemu
if: ${{ matrix.qemu }}
run: sudo apt install qemu-user qemu-user-binfmt
- name: install multiarch
if: ${{ matrix.multiarch != '' }}
run: |
sudo dpkg --add-architecture i386
# s390x, ppc64el need Ubuntu Ports to be in the mirror list
sudo bash -c "echo 'https://ports.ubuntu.com/ priority:4' >> /etc/apt/apt-mirrors.txt"
# Add architecture
sudo dpkg --add-architecture ${{ matrix.multiarch }}
sudo apt update
sudo apt install gcc-multilib zlib1g-dev:i386 libffi-dev:i386
- name: Install multilib dependencies
if: ${{ matrix.host_target == 'armv7-unknown-linux-gnueabihf' }}
run: |
sudo dpkg --add-architecture armhf
sudo apt update
sudo apt install gcc-arm-linux-gnueabihf zlib1g-dev:armhf libffi-dev:armhf
# Install needed packages
sudo apt install $(echo "libatomic1: zlib1g-dev:" | sed 's/:/:${{ matrix.multiarch }}/g')
- uses: ./.github/workflows/setup
with:
toolchain_flags: "--host ${{ matrix.host_target }}"
- name: Test Miri
# We set up the cross-compiler *after* the basic setup as setting CC would otherwise
# cause confusion.
- name: install gcc-cross
if: ${{ matrix.gcc_cross != '' }}
run: |
sudo apt install gcc-${{ matrix.gcc_cross }}
echo "Setting environment variables:"
echo "CC=${{ matrix.gcc_cross }}-gcc" | tee -a $GITHUB_ENV
TARGET_UPPERCASE=$(echo ${{ matrix.host_target }} | tr '[:lower:]-' '[:upper:]_')
echo "CARGO_TARGET_${TARGET_UPPERCASE}_LINKER=${{ matrix.gcc_cross }}-gcc" | tee -a $GITHUB_ENV
# The main test job! We don't run this in qemu as that is quite slow,
# so those targets only get the clippy check below.
- name: test Miri
if: ${{ !matrix.qemu }}
run: ./ci/ci.sh
# The `style` job only runs on Linux; this makes sure the host-specific
# code is also covered by clippy.
- name: Check clippy
- name: clippy
run: ./miri clippy -- -D warnings
style:
@ -71,8 +98,6 @@ jobs:
- name: rustfmt
run: ./miri fmt --check
- name: clippy
run: ./miri clippy -- -D warnings
- name: clippy (no features)
run: ./miri clippy --no-default-features -- -D warnings
- name: clippy (all features)

View file

@ -36,7 +36,7 @@ runs:
key: cargo-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/Cargo.lock') }}-v1
restore-keys: cargo-${{ runner.os }}-${{ runner.arch }}
- name: Install rustup-toolchain-install-master
- name: Install the tools we need
if: steps.cache.outputs.cache-hit != 'true'
run: cargo install -f rustup-toolchain-install-master hyperfine
shell: bash

View file

@ -146,6 +146,18 @@ case $HOST_TARGET in
MANY_SEEDS=64 TEST_TARGET=x86_64-apple-darwin run_tests
MANY_SEEDS=64 TEST_TARGET=x86_64-pc-windows-gnu run_tests
;;
i686-unknown-linux-gnu)
# Host
# Without GC_STRESS as this is a slow runner.
MIR_OPT=1 MANY_SEEDS=64 TEST_BENCH=1 CARGO_MIRI_ENV=1 run_tests
# Partially supported targets (tier 2)
BASIC="empty_main integer heap_alloc libc-mem vec string btreemap" # ensures we have the basics: pre-main code, system allocator
UNIX="hello panic/panic panic/unwind concurrency/simple atomic libc-mem libc-misc libc-random env num_cpus" # the things that are very similar across all Unixes, and hence easily supported there
TEST_TARGET=aarch64-linux-android run_tests_minimal $BASIC $UNIX time hashmap random thread sync concurrency epoll eventfd
TEST_TARGET=wasm32-wasip2 run_tests_minimal $BASIC wasm
TEST_TARGET=wasm32-unknown-unknown run_tests_minimal no_std empty_main wasm # this target doesn't really have std
TEST_TARGET=thumbv7em-none-eabihf run_tests_minimal no_std
;;
aarch64-unknown-linux-gnu)
# Host
GC_STRESS=1 MIR_OPT=1 MANY_SEEDS=64 TEST_BENCH=1 CARGO_MIRI_ENV=1 run_tests
@ -154,6 +166,10 @@ case $HOST_TARGET in
# Custom target JSON file
TEST_TARGET=tests/x86_64-unknown-kernel.json MIRI_NO_STD=1 run_tests_minimal no_std
;;
armv7-unknown-linux-gnueabihf)
# Host
GC_STRESS=1 MIR_OPT=1 MANY_SEEDS=64 TEST_BENCH=1 CARGO_MIRI_ENV=1 run_tests
;;
aarch64-apple-darwin)
# Host
GC_STRESS=1 MIR_OPT=1 MANY_SEEDS=64 TEST_BENCH=1 CARGO_MIRI_ENV=1 run_tests
@ -170,13 +186,6 @@ case $HOST_TARGET in
MANY_SEEDS=16 TEST_TARGET=x86_64-pc-solaris run_tests
MANY_SEEDS=16 TEST_TARGET=x86_64-unknown-freebsd run_tests
MANY_SEEDS=16 TEST_TARGET=i686-unknown-freebsd run_tests
# Partially supported targets (tier 2)
BASIC="empty_main integer heap_alloc libc-mem vec string btreemap" # ensures we have the basics: pre-main code, system allocator
UNIX="hello panic/panic panic/unwind concurrency/simple atomic libc-mem libc-misc libc-random env num_cpus" # the things that are very similar across all Unixes, and hence easily supported there
TEST_TARGET=aarch64-linux-android run_tests_minimal $BASIC $UNIX time hashmap random thread sync concurrency epoll eventfd
TEST_TARGET=wasm32-wasip2 run_tests_minimal $BASIC wasm
TEST_TARGET=wasm32-unknown-unknown run_tests_minimal no_std empty_main wasm # this target doesn't really have std
TEST_TARGET=thumbv7em-none-eabihf run_tests_minimal no_std
;;
i686-pc-windows-msvc)
# Host

View file

@ -22,11 +22,11 @@ EXPORT uint32_t get_unsigned_int(void) {
return -10;
}
EXPORT short add_int16(int16_t x) {
EXPORT int16_t add_int16(int16_t x) {
return x + 3;
}
EXPORT long add_short_to_long(int16_t x, int64_t y) {
EXPORT int64_t add_short_to_long(int16_t x, int64_t y) {
return x + y;
}