|
| 1 | +#!/usr/bin/env sh |
| 2 | + |
| 3 | +set -ex |
| 4 | + |
| 5 | +: "${TARGET?The TARGET environment variable must be set.}" |
| 6 | + |
| 7 | +export RUSTFLAGS="${RUSTFLAGS} -D warnings -Z merge-functions=disabled -Z verify-llvm-ir" |
| 8 | +export HOST_RUSTFLAGS="${RUSTFLAGS}" |
| 9 | +export PROFILE="${PROFILE:="--profile=release"}" |
| 10 | + |
| 11 | +case ${TARGET} in |
| 12 | + # On 32-bit use a static relocation model which avoids some extra |
| 13 | + # instructions when dealing with static data, notably allowing some |
| 14 | + # instruction assertion checks to pass below the 20 instruction limit. If |
| 15 | + # this is the default, dynamic, then too many instructions are generated |
| 16 | + # when we assert the instruction for a function and it causes tests to fail. |
| 17 | + i686-* | i586-*) |
| 18 | + export RUSTFLAGS="${RUSTFLAGS} -C relocation-model=static" |
| 19 | + ;; |
| 20 | + # Some x86_64 targets enable by default more features beyond SSE2, |
| 21 | + # which cause some instruction assertion checks to fail. |
| 22 | + x86_64-*) |
| 23 | + export RUSTFLAGS="${RUSTFLAGS} -C target-feature=-sse3" |
| 24 | + ;; |
| 25 | + #Unoptimized build uses fast-isel which breaks with msa |
| 26 | + mips-* | mipsel-*) |
| 27 | + export RUSTFLAGS="${RUSTFLAGS} -C llvm-args=-fast-isel=false" |
| 28 | + ;; |
| 29 | + armv7-*eabihf | thumbv7-*eabihf) |
| 30 | + export RUSTFLAGS="${RUSTFLAGS} -Ctarget-feature=+neon" |
| 31 | + ;; |
| 32 | + # Some of our test dependencies use the deprecated `gcc` crates which |
| 33 | + # doesn't detect RISC-V compilers automatically, so do it manually here. |
| 34 | + riscv*) |
| 35 | + export RUSTFLAGS="${RUSTFLAGS} -Ctarget-feature=+zk,+zks,+zbb,+zbc" |
| 36 | + ;; |
| 37 | +esac |
| 38 | + |
| 39 | +echo "RUSTFLAGS=${RUSTFLAGS}" |
| 40 | +echo "OBJDUMP=${OBJDUMP}" |
| 41 | +echo "PROFILE=${PROFILE}" |
| 42 | + |
| 43 | +INTRINSIC_TEST="--manifest-path=crates/intrinsic-test/Cargo.toml" |
| 44 | + |
| 45 | +# Test targets compiled with extra features. |
| 46 | +case ${TARGET} in |
| 47 | + # Setup aarch64 & armv7 specific variables, the runner, along with some |
| 48 | + # tests to skip |
| 49 | + aarch64-unknown-linux-gnu*) |
| 50 | + TEST_CPPFLAGS="-fuse-ld=lld -I/usr/aarch64-linux-gnu/include/ -I/usr/aarch64-linux-gnu/include/c++/9/aarch64-linux-gnu/" |
| 51 | + TEST_SKIP_INTRINSICS=crates/intrinsic-test/missing_aarch64.txt |
| 52 | + TEST_CXX_COMPILER="clang++" |
| 53 | + TEST_RUNNER="${CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER}" |
| 54 | + ;; |
| 55 | + |
| 56 | + aarch64_be-unknown-linux-gnu*) |
| 57 | + TEST_CPPFLAGS="-fuse-ld=lld" |
| 58 | + TEST_SKIP_INTRINSICS=crates/intrinsic-test/missing_aarch64.txt |
| 59 | + TEST_CXX_COMPILER="clang++" |
| 60 | + TEST_RUNNER="${CARGO_TARGET_AARCH64_BE_UNKNOWN_LINUX_GNU_RUNNER}" |
| 61 | + ;; |
| 62 | + |
| 63 | + armv7-unknown-linux-gnueabihf*) |
| 64 | + TEST_CPPFLAGS="-fuse-ld=lld -I/usr/arm-linux-gnueabihf/include/ -I/usr/arm-linux-gnueabihf/include/c++/9/arm-linux-gnueabihf/" |
| 65 | + TEST_SKIP_INTRINSICS=crates/intrinsic-test/missing_arm.txt |
| 66 | + TEST_CXX_COMPILER="clang++" |
| 67 | + TEST_RUNNER="${CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_RUNNER}" |
| 68 | + ;; |
| 69 | + *) |
| 70 | + ;; |
| 71 | + |
| 72 | +esac |
| 73 | + |
| 74 | +# Arm specific |
| 75 | +case "${TARGET}" in |
| 76 | + aarch64-unknown-linux-gnu*|armv7-unknown-linux-gnueabihf*) |
| 77 | + CPPFLAGS="${TEST_CPPFLAGS}" RUSTFLAGS="${HOST_RUSTFLAGS}" RUST_LOG=warn \ |
| 78 | + cargo run "${INTRINSIC_TEST}" "${PROFILE}" \ |
| 79 | + --bin intrinsic-test -- intrinsics_data/arm_intrinsics.json \ |
| 80 | + --runner "${TEST_RUNNER}" \ |
| 81 | + --cppcompiler "${TEST_CXX_COMPILER}" \ |
| 82 | + --skip "${TEST_SKIP_INTRINSICS}" \ |
| 83 | + --target "${TARGET}" |
| 84 | + ;; |
| 85 | + |
| 86 | + aarch64_be-unknown-linux-gnu*) |
| 87 | + CPPFLAGS="${TEST_CPPFLAGS}" RUSTFLAGS="${HOST_RUSTFLAGS}" RUST_LOG=warn \ |
| 88 | + cargo run "${INTRINSIC_TEST}" "${PROFILE}" \ |
| 89 | + --bin intrinsic-test -- intrinsics_data/arm_intrinsics.json \ |
| 90 | + --runner "${TEST_RUNNER}" \ |
| 91 | + --cppcompiler "${TEST_CXX_COMPILER}" \ |
| 92 | + --skip "${TEST_SKIP_INTRINSICS}" \ |
| 93 | + --target "${TARGET}" \ |
| 94 | + --linker "${CARGO_TARGET_AARCH64_BE_UNKNOWN_LINUX_GNU_LINKER}" \ |
| 95 | + --cxx-toolchain-dir "${AARCH64_BE_TOOLCHAIN}" |
| 96 | + ;; |
| 97 | + *) |
| 98 | + ;; |
| 99 | +esac |
0 commit comments