From 2fddaecebe4ee5e2d8dc06f181bb608ea0a4296c Mon Sep 17 00:00:00 2001 From: Alex Pyattaev Date: Wed, 5 Mar 2025 19:07:18 +0200 Subject: [PATCH] enable optimizer in tests --- Cargo.toml | 5 +++++ README.md | 2 +- ci/stable/run-local-cluster-partially.sh | 1 + ci/stable/run-partition.sh | 1 + programs/sbf/Cargo.toml | 5 +++++ 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index cd68ac2603c..78566f5f335 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -637,6 +637,11 @@ opt-level = 3 inherits = "dev" debug = "full" +# Enable optimizations for ci unittests to trigger const propagation and inlining +[profile.ci] +inherits = "test" +opt-level = 1 + [profile.release-with-debug] inherits = "release" debug = true diff --git a/README.md b/README.md index ed3ff570273..779a55659bd 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ $ ./cargo build **Run the test suite:** ```bash -$ ./cargo test +$ ./cargo nextest run --profile ci --cargo-profile ci --config-file .config/nextest.toml ``` ### Starting a local testnet diff --git a/ci/stable/run-local-cluster-partially.sh b/ci/stable/run-local-cluster-partially.sh index 7ba0c4edd09..cc07961168d 100755 --- a/ci/stable/run-local-cluster-partially.sh +++ b/ci/stable/run-local-cluster-partially.sh @@ -22,6 +22,7 @@ source "$here"/common.sh _ cargo nextest run \ --profile ci \ + --cargo-profile ci \ --package solana-local-cluster \ --test local_cluster \ --partition hash:"$CURRENT/$TOTAL" \ diff --git a/ci/stable/run-partition.sh b/ci/stable/run-partition.sh index a981d9111a4..7c90cfb25ec 100755 --- a/ci/stable/run-partition.sh +++ b/ci/stable/run-partition.sh @@ -25,6 +25,7 @@ source "$here"/common.sh ARGS=( --profile ci + --cargo-profile ci --workspace --tests --jobs "$JOBS" diff --git a/programs/sbf/Cargo.toml b/programs/sbf/Cargo.toml index ffcf23c716f..a0fcb0de7bb 100644 --- a/programs/sbf/Cargo.toml +++ b/programs/sbf/Cargo.toml @@ -287,6 +287,11 @@ debug = "line-tables-only" inherits = "dev" debug = "full" +# Enable basic optimizations for unittests to trigger const propagation and inlining +[profile.ci] +inherits = "test" +opt-level = 1 + [profile.release] # The test programs are build in release mode # Minimize their file size so that they fit into the account size limit