Merge pull request rust-lang/libm#440 from tgross35/not-always-1-cgu

Don't always set `codegen-units=1`
This commit is contained in:
Trevor Gross 2025-01-13 19:39:25 -05:00 committed by GitHub
commit 72ec4b39ca
2 changed files with 30 additions and 28 deletions

View file

@ -61,14 +61,15 @@ exclude = [
[dev-dependencies]
no-panic = "0.1.30"
# This is needed for no-panic to correctly detect the lack of panics
[profile.release]
# Options for no-panic to correctly detect the lack of panics
codegen-units = 1
lto = "fat"
# Release mode with debug assertions
[profile.release-checked]
inherits = "release"
codegen-units = 1
debug-assertions = true
inherits = "release"
lto = "fat"
overflow-checks = true

View file

@ -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