Skip to content

Commit

Permalink
Use QEMU to test CPUs with AES-NI but no AVX, and without AES-NI.
Browse files Browse the repository at this point in the history
  • Loading branch information
briansmith committed Jun 20, 2024
1 parent 85df439 commit 8776218
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
31 changes: 28 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ jobs:
- aarch64-unknown-linux-gnu # Has assembly
- arm-unknown-linux-gnueabi # Has assembly
- armv7-unknown-linux-gnueabihf # Has assembly
- i686-unknown-linux-gnu # Has assembly
# - i686-unknown-linux-gnu # Has assembly; handled specially below.
- powerpc-unknown-linux-gnu # No assembly 32-bit big-endian with flags
- powerpc64-unknown-linux-gnu # No assembly 64-bit big-endian with flags
- powerpc64le-unknown-linux-gnu # No assembly 64-bit little-endian with flags
Expand Down Expand Up @@ -599,6 +599,17 @@ jobs:
# https://github.com/rust-lang/rust/issues/79556 and
# https://github.com/rust-lang/rust/issues/79555 are fixed.
- target: i686-unknown-linux-gnu
cpu_model: # default
features: --features=std
mode: # debug
rust_channel: nightly
host_os: ubuntu-22.04

- target: i686-unknown-linux-gnu
cpu_model: Conroe-v1
features: --features=std
mode: # debug
rust_channel: nightly
host_os: ubuntu-22.04

- target: powerpc-unknown-linux-gnu
Expand All @@ -619,6 +630,20 @@ jobs:
- target: x86_64-apple-darwin
host_os: macos-13

- target: x86_64-unknown-linux-gnu
cpu_model: Conroe-v1
features: --features=std
mode: # debug
rust_channel: nightly
host_os: ubuntu-22.04

- target: x86_64-unknown-linux-gnu
cpu_model: Denverton-v2
features: --features=std
mode: # debug
rust_channel: nightly
host_os: ubuntu-22.04

- target: x86_64-unknown-linux-musl
host_os: ubuntu-22.04

Expand All @@ -630,15 +655,15 @@ jobs:
with:
persist-credentials: false

- run: RING_COVERAGE=1 mk/install-build-tools.sh +${{ matrix.rust_channel }} --target=${{ matrix.target }}
- run: RING_CPU_MODEL=${{ matrix.cpu_model }} RING_COVERAGE=1 mk/install-build-tools.sh +${{ matrix.rust_channel }} --target=${{ matrix.target }}
shell: sh

- if: ${{ contains(matrix.host_os, 'windows') }}
run: ./mk/install-build-tools.ps1

- if: ${{ !contains(matrix.host_os, 'windows') }}
run: |
RING_COVERAGE=1 mk/cargo.sh +${{ matrix.rust_channel }} test -vv --target=${{ matrix.target }} ${{ matrix.cargo_options }} ${{ matrix.features }} ${{ matrix.mode }}
RING_CPU_MODEL=${{ matrix.cpu_model }} RING_COVERAGE=1 mk/cargo.sh +${{ matrix.rust_channel }} test -vv --target=${{ matrix.target }} ${{ matrix.cargo_options }} ${{ matrix.features }} ${{ matrix.mode }}
- uses: briansmith/codecov-codecov-action@v4
with:
Expand Down
10 changes: 10 additions & 0 deletions mk/cargo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ qemu_powerpc64le="qemu-ppc64le -L /usr/powerpc64le-linux-gnu"
qemu_riscv64="qemu-riscv64 -L /usr/riscv64-linux-gnu"
qemu_s390x="qemu-s390x -L /usr/s390x-linux-gnu"
qemu_sparc64="qemu-sparc64 -L /usr/sparc64-linux-gnu"
qemu_x86="qemu-i386"
qemu_x86_64="qemu-x86_64"

# Avoid putting the Android tools in `$PATH` because there are tools in this
# directory like `clang` that would conflict with the same-named tools that may
Expand Down Expand Up @@ -110,6 +112,9 @@ case $target in
i686-unknown-linux-gnu)
use_clang=1
export CARGO_TARGET_I686_UNKNOWN_LINUX_GNU_LINKER=clang-$llvm_version
if [ -n "${RING_CPU_MODEL-}" ]; then
export CARGO_TARGET_I686_UNKNOWN_LINUX_GNU_RUNNER="$qemu_x86 -cpu ${RING_CPU_MODEL}"
fi
;;
i686-unknown-linux-musl)
use_clang=1
Expand Down Expand Up @@ -176,6 +181,11 @@ case $target in
export CARGO_TARGET_SPARC64_UNKNOWN_LINUX_GNU_LINKER=sparc64-linux-gnu-gcc
export CARGO_TARGET_SPARC64_UNKNOWN_LINUX_GNU_RUNNER="$qemu_sparc64"
;;
x86_64-unknown-linux-gnu)
if [ -n "${RING_CPU_MODEL-}" ]; then
export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="$qemu_x86_64 -cpu ${RING_CPU_MODEL}"
fi
;;
x86_64-unknown-linux-musl)
use_clang=1
# XXX: Work around https://github.com/rust-lang/rust/issues/79555.
Expand Down
8 changes: 8 additions & 0 deletions mk/install-build-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ i686-unknown-linux-gnu)
install_packages \
gcc-multilib \
libc6-dev-i386
if [ -n "${RING_CPU_MODEL-}" ]; then
install_packages qemu-user
fi
;;
i686-unknown-linux-musl|x86_64-unknown-linux-musl)
use_clang=1
Expand Down Expand Up @@ -183,6 +186,11 @@ wasm32-wasi)
https://github.com/briansmith/ring-toolchain \
target/tools/linux-x86_64
;;
x86_64-unknown-linux-gnu)
if [ -n "${RING_CPU_MODEL-}" ]; then
install_packages qemu-user
fi
;;
*)
;;
esac
Expand Down

0 comments on commit 8776218

Please sign in to comment.