Skip to content

Commit 3896d32

Browse files
committed
fix(test): speed up debug and codecov tests
1 parent 58352c4 commit 3896d32

File tree

6 files changed

+22
-13
lines changed

6 files changed

+22
-13
lines changed

.github/workflows/coverage.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ env:
3131
RUSTC_WRAPPER: sccache
3232
CC: sccache clang
3333
CXX: sccache clang++
34+
# To minimize compile times: https://nnethercote.github.io/perf-book/build-configuration.html#minimizing-compile-times
35+
RUSTFLAGS: "-C linker=clang -C link-arg=-fuse-ld=lld"
3436

3537
jobs:
3638
codecov:
@@ -50,13 +52,7 @@ jobs:
5052
- uses: taiki-e/install-action@cargo-llvm-cov
5153
- uses: taiki-e/install-action@nextest
5254
- name: Generate code coverage
53-
run: |
54-
cargo llvm-cov --workspace --codecov --output-path lcov.info nextest
55-
env:
56-
CC: "sccache clang"
57-
CXX: "sccache clang++"
58-
# To minimize compile times: https://nnethercote.github.io/perf-book/build-configuration.html#minimizing-compile-times
59-
RUSTFLAGS: "-C linker=clang -C link-arg=-fuse-ld=lld"
55+
run: make codecov
6056
# Save lcov.info as an artifact for debugging purposes
6157
- uses: actions/upload-artifact@v4
6258
with:

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,11 @@ rust2go = { workspace = true, features = ["build"] }
268268
debug = "line-tables-only"
269269
split-debuginfo = "unpacked"
270270

271-
# Avoid generating any debug information for dependencies
272271
[profile.dev.package."*"]
272+
# Avoid generating any debug information for dependencies
273273
debug = false
274+
# Speed up debug tests and codecov tests
275+
opt-level = 1
274276

275277
# Profile for interactive debugging sessions, e.g., with LLDB.
276278
# Doesn't work with Go FFI - disable it with `FOREST_F3_SIDECAR_FFI_BUILD_OPT_OUT=1`.

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ test-release:
110110

111111
test-all: test test-release
112112

113+
codecov:
114+
cargo llvm-cov --workspace --codecov --output-path lcov.info
115+
113116
# Checks if all headers are present and adds if not
114117
license:
115118
./scripts/add_license.sh

interop-tests/Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,14 @@ tokio = { workspace = true, features = ['full'] }
4141

4242
[build-dependencies]
4343
rust2go = { workspace = true, features = ["build"] }
44+
45+
# https://doc.rust-lang.org/stable/cargo/guide/build-performance.html#reduce-amount-of-generated-debug-information
46+
[profile.dev]
47+
debug = "line-tables-only"
48+
split-debuginfo = "unpacked"
49+
50+
[profile.dev.package."*"]
51+
# Avoid generating any debug information for dependencies
52+
debug = false
53+
# Speed up debug tests and codecov tests
54+
opt-level = 1

src/tool/subcommands/api_cmd/test_snapshot.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,6 @@ mod tests {
199199
include!(concat!(env!("OUT_DIR"), "/__rpc_regression_tests_gen.rs"));
200200

201201
async fn rpc_regression_test_run(name: &str) {
202-
// Skip for debug build on CI as the downloading is slow and flaky
203-
if crate::utils::is_ci() && crate::utils::is_debug_build() {
204-
return;
205-
}
206-
207202
// Set proof parameter data dir and make sure the proofs are available
208203
{
209204
static PROOF_PARAMS_LOCK: LazyLock<Mutex<()>> = LazyLock::new(|| Mutex::new(()));

src/utils/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,13 @@ pub enum RetryError {
169169
RetriesExceeded,
170170
}
171171

172+
#[allow(dead_code)]
172173
#[cfg(test)]
173174
pub fn is_debug_build() -> bool {
174175
cfg!(debug_assertions)
175176
}
176177

178+
#[allow(dead_code)]
177179
#[cfg(test)]
178180
pub fn is_ci() -> bool {
179181
// https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#default-environment-variables

0 commit comments

Comments
 (0)