Repository navigation
split debug info out of dev-profile binaries - #1752
Conversation
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.
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.
…idate-test-harness
bplatz
left a comment
There was a problem hiding this comment.
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 Building 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 |
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
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 testas well, since the test profile inherits dev.