Skip to content

Commit 5705610

Browse files
authored
Merge pull request #4422 from RalfJung/more-ci
run CI on a bunch more architectures
2 parents a1214e5 + 87fee0c commit 5705610

File tree

4 files changed

+65
-31
lines changed

4 files changed

+65
-31
lines changed

.github/workflows/ci.yml

Lines changed: 46 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,33 @@ defaults:
1414

1515
jobs:
1616
test:
17-
name: build and test on ${{ matrix.host_target }}
17+
name: test (${{ matrix.host_target }})
1818
strategy:
1919
fail-fast: false
2020
matrix:
2121
include:
2222
- host_target: x86_64-unknown-linux-gnu
2323
os: ubuntu-latest
24-
# Needs a libffi patch: <https://github.com/libffi-rs/libffi-rs/pull/160>
25-
# - host_target: i686-unknown-linux-gnu
26-
# os: ubuntu-latest
24+
- host_target: i686-unknown-linux-gnu
25+
os: ubuntu-latest
26+
multiarch: i386
27+
gcc_cross: i686-linux-gnu
2728
- host_target: aarch64-unknown-linux-gnu
2829
os: ubuntu-24.04-arm
29-
# Disabled due to <https://github.com/rust-lang/rust/issues/143184>.
30-
# - host_target: armv7-unknown-linux-gnueabihf
31-
# os: ubuntu-24.04-arm
30+
- host_target: armv7-unknown-linux-gnueabihf
31+
os: ubuntu-24.04-arm
32+
multiarch: armhf
33+
gcc_cross: arm-linux-gnueabihf
34+
- host_target: riscv64gc-unknown-linux-gnu
35+
os: ubuntu-latest
36+
multiarch: riscv64
37+
gcc_cross: riscv64-linux-gnu
38+
qemu: true
39+
- host_target: s390x-unknown-linux-gnu
40+
os: ubuntu-latest
41+
multiarch: s390x
42+
gcc_cross: s390x-linux-gnu
43+
qemu: true
3244
- host_target: aarch64-apple-darwin
3345
os: macos-latest
3446
- host_target: i686-pc-windows-msvc
@@ -38,28 +50,43 @@ jobs:
3850
HOST_TARGET: ${{ matrix.host_target }}
3951
steps:
4052
- uses: actions/checkout@v4
41-
- name: Install multilib dependencies
42-
if: ${{ matrix.host_target == 'i686-unknown-linux-gnu' }}
43-
run: |
44-
sudo dpkg --add-architecture i386
45-
sudo apt update
46-
sudo apt install gcc-multilib zlib1g-dev:i386 libffi-dev:i386
47-
- name: Install multilib dependencies
48-
if: ${{ matrix.host_target == 'armv7-unknown-linux-gnueabihf' }}
53+
- name: install qemu
54+
if: ${{ matrix.qemu }}
55+
run: sudo apt install qemu-user qemu-user-binfmt
56+
- name: install multiarch
57+
if: ${{ matrix.multiarch != '' }}
4958
run: |
50-
sudo dpkg --add-architecture armhf
59+
# s390x, ppc64el need Ubuntu Ports to be in the mirror list
60+
sudo bash -c "echo 'https://ports.ubuntu.com/ priority:4' >> /etc/apt/apt-mirrors.txt"
61+
# Add architecture
62+
sudo dpkg --add-architecture ${{ matrix.multiarch }}
5163
sudo apt update
52-
sudo apt install gcc-arm-linux-gnueabihf zlib1g-dev:armhf libffi-dev:armhf
64+
# Install needed packages
65+
sudo apt install $(echo "libatomic1: zlib1g-dev:" | sed 's/:/:${{ matrix.multiarch }}/g')
5366
- uses: ./.github/workflows/setup
5467
with:
5568
toolchain_flags: "--host ${{ matrix.host_target }}"
5669

57-
- name: Test Miri
70+
# We set up the cross-compiler *after* the basic setup as setting CC would otherwise
71+
# cause confusion.
72+
- name: install gcc-cross
73+
if: ${{ matrix.gcc_cross != '' }}
74+
run: |
75+
sudo apt install gcc-${{ matrix.gcc_cross }}
76+
echo "Setting environment variables:"
77+
echo "CC=${{ matrix.gcc_cross }}-gcc" | tee -a $GITHUB_ENV
78+
TARGET_UPPERCASE=$(echo ${{ matrix.host_target }} | tr '[:lower:]-' '[:upper:]_')
79+
echo "CARGO_TARGET_${TARGET_UPPERCASE}_LINKER=${{ matrix.gcc_cross }}-gcc" | tee -a $GITHUB_ENV
80+
81+
# The main test job! We don't run this in qemu as that is quite slow,
82+
# so those targets only get the clippy check below.
83+
- name: test Miri
84+
if: ${{ !matrix.qemu }}
5885
run: ./ci/ci.sh
5986

6087
# The `style` job only runs on Linux; this makes sure the host-specific
6188
# code is also covered by clippy.
62-
- name: Check clippy
89+
- name: clippy
6390
run: ./miri clippy -- -D warnings
6491

6592
style:
@@ -71,8 +98,6 @@ jobs:
7198

7299
- name: rustfmt
73100
run: ./miri fmt --check
74-
- name: clippy
75-
run: ./miri clippy -- -D warnings
76101
- name: clippy (no features)
77102
run: ./miri clippy --no-default-features -- -D warnings
78103
- name: clippy (all features)

.github/workflows/setup/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ runs:
3636
key: cargo-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/Cargo.lock') }}-v1
3737
restore-keys: cargo-${{ runner.os }}-${{ runner.arch }}
3838

39-
- name: Install rustup-toolchain-install-master
39+
- name: Install the tools we need
4040
if: steps.cache.outputs.cache-hit != 'true'
4141
run: cargo install -f rustup-toolchain-install-master hyperfine
4242
shell: bash

ci/ci.sh

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,18 @@ case $HOST_TARGET in
146146
MANY_SEEDS=64 TEST_TARGET=x86_64-apple-darwin run_tests
147147
MANY_SEEDS=64 TEST_TARGET=x86_64-pc-windows-gnu run_tests
148148
;;
149+
i686-unknown-linux-gnu)
150+
# Host
151+
# Without GC_STRESS as this is a slow runner.
152+
MIR_OPT=1 MANY_SEEDS=64 TEST_BENCH=1 CARGO_MIRI_ENV=1 run_tests
153+
# Partially supported targets (tier 2)
154+
BASIC="empty_main integer heap_alloc libc-mem vec string btreemap" # ensures we have the basics: pre-main code, system allocator
155+
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
156+
TEST_TARGET=aarch64-linux-android run_tests_minimal $BASIC $UNIX time hashmap random thread sync concurrency epoll eventfd
157+
TEST_TARGET=wasm32-wasip2 run_tests_minimal $BASIC wasm
158+
TEST_TARGET=wasm32-unknown-unknown run_tests_minimal no_std empty_main wasm # this target doesn't really have std
159+
TEST_TARGET=thumbv7em-none-eabihf run_tests_minimal no_std
160+
;;
149161
aarch64-unknown-linux-gnu)
150162
# Host
151163
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
154166
# Custom target JSON file
155167
TEST_TARGET=tests/x86_64-unknown-kernel.json MIRI_NO_STD=1 run_tests_minimal no_std
156168
;;
169+
armv7-unknown-linux-gnueabihf)
170+
# Host
171+
GC_STRESS=1 MIR_OPT=1 MANY_SEEDS=64 TEST_BENCH=1 CARGO_MIRI_ENV=1 run_tests
172+
;;
157173
aarch64-apple-darwin)
158174
# Host
159175
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
170186
MANY_SEEDS=16 TEST_TARGET=x86_64-pc-solaris run_tests
171187
MANY_SEEDS=16 TEST_TARGET=x86_64-unknown-freebsd run_tests
172188
MANY_SEEDS=16 TEST_TARGET=i686-unknown-freebsd run_tests
173-
# Partially supported targets (tier 2)
174-
BASIC="empty_main integer heap_alloc libc-mem vec string btreemap" # ensures we have the basics: pre-main code, system allocator
175-
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
176-
TEST_TARGET=aarch64-linux-android run_tests_minimal $BASIC $UNIX time hashmap random thread sync concurrency epoll eventfd
177-
TEST_TARGET=wasm32-wasip2 run_tests_minimal $BASIC wasm
178-
TEST_TARGET=wasm32-unknown-unknown run_tests_minimal no_std empty_main wasm # this target doesn't really have std
179-
TEST_TARGET=thumbv7em-none-eabihf run_tests_minimal no_std
180189
;;
181190
i686-pc-windows-msvc)
182191
# Host

tests/native-lib/scalar_arguments.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ EXPORT uint32_t get_unsigned_int(void) {
2222
return -10;
2323
}
2424

25-
EXPORT short add_int16(int16_t x) {
25+
EXPORT int16_t add_int16(int16_t x) {
2626
return x + 3;
2727
}
2828

29-
EXPORT long add_short_to_long(int16_t x, int64_t y) {
29+
EXPORT int64_t add_short_to_long(int16_t x, int64_t y) {
3030
return x + y;
3131
}
3232

0 commit comments

Comments
 (0)