Conversation
DRMacIver
commented
Mar 27, 2026
9170d76 to
c4f7a3e
Compare
- TempRustProject: use PID-based temp target dirs to prevent parallel
test binaries from racing on shared build cache
- test_output: accept both {closure#0} and {{closure}} backtrace formats
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
c4f7a3e to
813e535
Compare
Liam-DeVoe
reviewed
Mar 27, 2026
Comment on lines
10
to
26
|
|
||
| // cache build output from TempRustProject across tests. Compilation time is substantial | ||
| // (10+ seconds) and this lets us only incur that cost on the first test. | ||
| // Cache build output from TempRustProject across tests within the same process. | ||
| // | ||
| // We clear the dir at the start to ensure a fresh environment on each test run. | ||
| // Under coverage (CARGO_LLVM_COV=1), we reuse the main project's llvm-cov target | ||
| // dir so that subprocess builds share the same instrumented artifacts. This lets | ||
| // cargo-llvm-cov's report phase map subprocess profraw data back to source files. | ||
| // Cargo's internal file locks prevent corruption from concurrent access. | ||
| // | ||
| // Outside coverage, each test binary gets its own target dir (via PID) to avoid | ||
| // heavy lock contention when multiple test binaries build in parallel. | ||
| static SHARED_TARGET_DIR: LazyLock<PathBuf> = LazyLock::new(|| { | ||
| let path = std::env::temp_dir().join("hegel-test-cargo-target"); | ||
| if std::env::var("CARGO_LLVM_COV").is_ok() { | ||
| let path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("target/llvm-cov-target"); | ||
| return path; | ||
| } | ||
| let path = std::env::temp_dir().join(format!("hegel-test-cargo-target-{}", std::process::id())); | ||
| let _ = std::fs::remove_dir_all(&path); |
Member
There was a problem hiding this comment.
Why have we changed from a shared target dir to mixing in pid outside of coverage? This lessens the benefit of a shared target dir for compilation times by a factor of n where n is the number of cores
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix two flaky/broken tests:
TempRustProject: PID-based temp target dirs to prevent parallel test binary racestest_output: accept both{closure#0}and{{closure}}backtrace formats (Rust 1.92 changed the stable format)