Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross35 committed Jan 14, 2025
1 parent 03b41a9 commit d54d9f8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
3 changes: 2 additions & 1 deletion ci/run-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ run() {
# will be owned by root
mkdir -p target

set_env="HOME=/tmp PATH=\$PATH:/rust/bin:/cargo/bin"
docker build -t "$target" "ci/docker/$target"
docker run \
--rm \
Expand All @@ -40,7 +41,7 @@ run() {
--init \
-w /checkout \
"$target" \
sh -c "HOME=/tmp PATH=\$PATH:/rust/bin exec ci/run.sh $target"
sh -c "$set_env exec ci/run.sh $target"
}

if [ -z "$1" ]; then
Expand Down
40 changes: 20 additions & 20 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export RUST_BACKTRACE="${RUST_BACKTRACE:-full}"
export NEXTEST_STATUS_LEVEL=all

target="${1:-}"
flags=""

if [ -z "$target" ]; then
host_target=$(rustc -vV | awk '/^host/ { print $2 }')
Expand All @@ -14,22 +15,22 @@ if [ -z "$target" ]; then
fi

# We enumerate features manually.
extra_flags="--no-default-features"
flags="$flags --no-default-features"

# Enable arch-specific routines when available.
extra_flags="$extra_flags --features arch"
flags="$flags --features arch"

# Always enable `unstable-float` since it expands available API but does not
# change any implementations.
extra_flags="$extra_flags --features unstable-float"
flags="$flags --features unstable-float"

# We need to specifically skip tests for musl-math-sys on systems that can't
# build musl since otherwise `--all` will activate it.
case "$target" in
# Can't build at all on MSVC, WASM, or thumb
*windows-msvc*) extra_flags="$extra_flags --exclude musl-math-sys" ;;
*wasm*) extra_flags="$extra_flags --exclude musl-math-sys" ;;
*thumb*) extra_flags="$extra_flags --exclude musl-math-sys" ;;
*windows-msvc*) flags="$flags --exclude musl-math-sys" ;;
*wasm*) flags="$flags --exclude musl-math-sys" ;;
*thumb*) flags="$flags --exclude musl-math-sys" ;;

# We can build musl on MinGW but running tests gets a stack overflow
*windows-gnu*) ;;
Expand All @@ -39,7 +40,7 @@ case "$target" in
*powerpc64le*) ;;

# Everything else gets musl enabled
*) extra_flags="$extra_flags --features libm-test/build-musl" ;;
*) flags="$flags --features libm-test/build-musl" ;;
esac

# Configure which targets test against MPFR
Expand All @@ -51,17 +52,17 @@ case "$target" in
# Targets that aren't cross compiled work fine
# FIXME(ci): we should be able to enable aarch64 Linux here once GHA
# support rolls out.
x86_64*) extra_flags="$extra_flags --features libm-test/build-mpfr" ;;
i686*) extra_flags="$extra_flags --features libm-test/build-mpfr" ;;
i586*) extra_flags="$extra_flags --features libm-test/build-mpfr --features gmp-mpfr-sys/force-cross" ;;
x86_64*) flags="$flags --features libm-test/build-mpfr" ;;
i686*) flags="$flags --features libm-test/build-mpfr" ;;
i586*) flags="$flags --features libm-test/build-mpfr --features gmp-mpfr-sys/force-cross" ;;
# Apple aarch64 is native
aarch64*apple*) extra_flags="$extra_flags --features libm-test/build-mpfr" ;;
aarch64*apple*) flags="$flags --features libm-test/build-mpfr" ;;
esac

# FIXME: `STATUS_DLL_NOT_FOUND` testing macros on CI.
# <https://github.com/rust-lang/rust/issues/128944>
case "$target" in
*windows-gnu) extra_flags="$extra_flags --exclude libm-macros" ;;
*windows-gnu) flags="$flags --exclude libm-macros" ;;
esac

# Make sure we can build with overriding features.
Expand All @@ -77,22 +78,21 @@ if [ "${BUILD_ONLY:-}" = "1" ]; then
exit
fi

cmd="cargo test"
flags="$flags --all --target $target"

# If nextest is available, use that
command -v cargo-nextest && nextest=1 || nextest=0
echo "nextest: $nextest"
[ "$nextest" = "1" ] && cmd="cargo nextest run"

# Otherwise, run the test suite.

cmd="$cmd --all --target $target $extra_flags"
if [ "$nextest" = "1" ]; then
cmd="cargo nextest run $flags"
else
cmd="cargo test $flags"
fi

# Test once without intrinsics
$cmd

# Run doctests if they were excluded by nextest
[ "$nextest" = "1" ] && $cmd --doc
[ "$nextest" = "1" ] && "cargo test --doc $flags"

# Exclude the macros and utile crates from the rest of the tests to save CI
# runtime, they shouldn't have anything feature- or opt-level-dependent.
Expand Down

0 comments on commit d54d9f8

Please sign in to comment.