Skip to content

split debug info out of dev-profile binaries - #1752

Merged
zonotope merged 7 commits into
mainfrom
chore/dev-profile-split-debuginfo
Sep 2, 2026
Merged

zonotope merged 7 commits into
mainfrom
chore/dev-profile-split-debuginfo

Conversation

@zonotope

Copy link
Copy Markdown
Contributor

Cargo's dev profile defaults to packed DWARF, so every integration test binary carries its own copy of the debug info from the workspace rlibs it links.

split-debuginfo = "unpacked" keeps the full DWARF but stores it in .dwo files instead of duplicating it into each linked binary. No debugging capability is lost, and links get faster.

Applies to cargo test as well, since the test profile inherits dev.

Cargo's dev profile defaults to packed DWARF, so every integration test binary
carries its own copy of the debug info from the workspace rlibs it links.

split-debuginfo = "unpacked" keeps the full DWARF but stores it in .dwo files
instead of duplicating it into each linked binary. No debugging capability is
lost, and links get faster.

Applies to `cargo test` as well, since the test profile inherits dev.
@zonotope
zonotope requested review from aaj3f and bplatz August 31, 2026 16:49
fluree-db-server had 28 auto-discovered integration test targets, one per
tests/*.rs file. Each is a `bin` that links the full workspace dependency tree,
so the crate paid 28 separate link steps on every test build. This takes it to
9.

Group them using the pattern fluree-db-api already establishes: `autotests =
false` plus explicit [[test]] declarations, with each harness pulling its
members in via #[path]/mod. The 28 test files are not moved or edited, so git
blame is preserved across all 22k lines. Grouping is by domain (grp_http,
grp_query, grp_proxy, grp_policy, grp_search, grp_raft, grp_bolt), not by
feature. `raft` is the only non-default feature here (default = native,
credential, iceberg, shacl, bolt), so grp_raft is the only harness that compiles
to an empty binary on a default build.

telemetry_test and multi_query_tracing_integration keep their own binaries. Both
install a tracing subscriber and assert on the events captured through it, and
tracing's callsite-interest cache is process-global while the capture is
thread-local, so those assertions are only reliable when the test is alone in
its process under bare `cargo test`. docs/contributing/tests.md already states
that rule for fluree-db-api; it now covers this crate too.

`autotests = false` also means a new tests/*.rs that nobody wires into a harness
never compiles and never runs, with `cargo test` still reporting success.
tests/harness_coverage.rs asserts every tests/*.rs is either pulled into a
harness or declared as its own [[test]], and names the orphans when it fails.

Verified under bare `cargo test`, not just nextest. nextest gives every test its
own process and cannot detect the shared-process hazards this layout introduces.

@bplatz bplatz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing worth addressing: split-debuginfo = "unpacked" is only supported on Linux and Apple targets — on windows-msvc stable rustc rejects it as a hard error, so this breaks cargo build/cargo test for anyone on Windows (release/dist builds are unaffected since they don't set it). Since Cargo has no per-platform profile syntax, consider moving this to CARGO_PROFILE_DEV_SPLIT_DEBUGINFO=unpacked in the CI workflow env: instead — one line covers both the workspace and testsuite-sparql jobs, macOS already defaults to unpacked, and Windows never sees it.

@zonotope

zonotope commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

One thing worth addressing: split-debuginfo = "unpacked" is only supported on Linux and Apple targets — on windows-msvc stable rustc rejects it as a hard error, so this breaks cargo build/cargo test for anyone on Windows (release/dist builds are unaffected since they don't set it). Since Cargo has no per-platform profile syntax, consider moving this to CARGO_PROFILE_DEV_SPLIT_DEBUGINFO=unpacked in the CI workflow env: instead — one line covers both the workspace and testsuite-sparql jobs, macOS already defaults to unpacked, and Windows never sees it.

Cargo queries the target's supported values and omits -C split-debuginfo entirely when the target doesn't support it.

Building --target x86_64-pc-windows-msvc on 1.97.0, the rustc invocation Cargo constructs is -C embed-bitcode=no -C debuginfo=2 ... --target x86_64-pc-windows-msvc (no -C split-debuginfo). Same on wasm32-unknown-unknown. The Linux invocation by contrast carries -C debuginfo=2 -C split-debuginfo=unpacked.

Since rust-toolchain.toml pins 1.97.0 and CI uses dtolnay/[email protected], every developer gets that gating behavior.

I'd rather keep it in the manifest than move to CARGO_PROFILE_DEV_SPLIT_DEBUGINFO in CI env because the env var only helps CI and the saving that matters is local. This would give it back for every Linux and macOS developer. It also wouldn't add safety, since an env-set profile value goes through the same resolution path.

zonotope and others added 2 commits September 1, 2026 15:56
The guard skipped anything named grp_*, assuming it must be declared as a
[[test]] target, and harvested #[path] lines from every file on disk. An
undeclared tests/grp_foo.rs therefore escaped the check while its members
counted as covered. A whole harness could go missing with the guard still
reporting success.

Derive reachability from Cargo.toml instead: parse the [[test]] blocks, harvest
The filename special case is removed rather than supplemented. The parser also
handles targets that omit `path`, which fluree-db-api uses and a port will need.
group integration tests into grp_* harnesses
@zonotope
zonotope merged commit e2e3c02 into main Sep 2, 2026
14 checks passed
@zonotope
zonotope deleted the chore/dev-profile-split-debuginfo branch September 2, 2026 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants