Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Don't set codegen-units=1 by default in CI #440

Merged
merged 2 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
47 changes: 24 additions & 23 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:-}"

Expand Down Expand Up @@ -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"
exit
fi

# Test once without intrinsics
$cmd
# Otherwise, run the test suite.

# 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"
cmd="cargo test --all --target $target $extra_flags"

# 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
fi
# 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