From bcd9d8a5c33d24b2f817a3e9cf5d5a16606f83cd Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Mon, 13 Jan 2025 23:00:39 +0000 Subject: [PATCH] Reduce indentation in `run.sh` using early return --- library/compiler-builtins/libm/ci/run.sh | 51 ++++++++++++------------ 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/library/compiler-builtins/libm/ci/run.sh b/library/compiler-builtins/libm/ci/run.sh index 94ff54cb7256..008f32d5b8c8 100755 --- a/library/compiler-builtins/libm/ci/run.sh +++ b/library/compiler-builtins/libm/ci/run.sh @@ -3,8 +3,6 @@ set -eux export RUST_BACKTRACE="${RUST_BACKTRACE:-full}" -# Needed for no-panic to correct detect a lack of panics -export RUSTFLAGS="${RUSTFLAGS:-} -Ccodegen-units=1" target="${1:-}" @@ -69,33 +67,36 @@ esac cargo check -p libm --no-default-features if [ "${BUILD_ONLY:-}" = "1" ]; then + # If we are on targets that can't run tests, verify that we can build. cmd="cargo build --target $target --package libm" $cmd $cmd --features unstable-intrinsics echo "can't run tests on $target; skipping" -else - cmd="cargo test --all --target $target $extra_flags" - - # Test once without intrinsics - $cmd - - # 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. - cmd="$cmd --exclude util --exclude libm-macros" - - # Test once with intrinsics enabled - $cmd --features unstable-intrinsics - $cmd --features unstable-intrinsics --benches - - # Test the same in release mode, which also increases coverage. Also ensure - # the soft float routines are checked. - $cmd --profile release-checked - $cmd --profile release-checked --features force-soft-floats - $cmd --profile release-checked --features unstable-intrinsics - $cmd --profile release-checked --features unstable-intrinsics --benches - - # Ensure that the routines do not panic. - ENSURE_NO_PANIC=1 cargo build -p libm --target "$target" --no-default-features --release + exit fi +# Otherwise, run the test suite. + +cmd="cargo test --all --target $target $extra_flags" + +# Test once without intrinsics +$cmd + +# 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. +cmd="$cmd --exclude util --exclude libm-macros" + +# Test once with intrinsics enabled +$cmd --features unstable-intrinsics +$cmd --features unstable-intrinsics --benches + +# Test the same in release mode, which also increases coverage. Also ensure +# the soft float routines are checked. +$cmd --profile release-checked +$cmd --profile release-checked --features force-soft-floats +$cmd --profile release-checked --features unstable-intrinsics +$cmd --profile release-checked --features unstable-intrinsics --benches + +# Ensure that the routines do not panic. +ENSURE_NO_PANIC=1 cargo build -p libm --target "$target" --no-default-features --release