Repository navigation
feat(go-runner): keep GOCACHE and GOMODCACHE when they're set - #71
marten-seemann wants to merge 1 commit into
Conversation
[Medium impact] The change affects cache reuse for Go benchmark runs that use this runner. The PR appears safe to merge, with a non-blocking request for cache regression tests.
|
| for (var, cache_dir) in [("GOCACHE", "gocache"), ("GOMODCACHE", "gomodcache")] { | ||
| if std::env::var_os(var).is_none_or(|v| v.is_empty()) { | ||
| cmd.env(var, _dir.path().join(cache_dir)); | ||
| } | ||
| } |
There was a problem hiding this comment.
The existing tests check benchmark results but never check GOCACHE or GOMODCACHE. Restoring the old unconditional overrides would therefore pass unnoticed and silently bring back cold builds in CI.
Add tests for nonempty, unset, and empty values, including cases where only one variable is set. Run each case in a child process so parallel tests do not share environment changes.
Prompt To Fix With AI
This is a comment left during a code review.
Path: go-runner/src/runner/mod.rs
Line: 71-75
Comment:
**Cache choices lack tests**
The existing tests check benchmark results but never check `GOCACHE` or `GOMODCACHE`. Restoring the old unconditional overrides would therefore pass unnoticed and silently bring back cold builds in CI.
Add tests for nonempty, unset, and empty values, including cases where only one variable is set. Run each case in a child process so parallel tests do not share environment changes.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Each run builds from an empty build cache, and CI has no way to change that. On the Gen 1 macro runner, the cold build is 54 s of a 76 s benchmark step for a single package (quic-go's
integrationtests/self), all of it billed. With this change, a workflow can setGOCACHEand restore it withactions/cache. Without them set, nothing changes.The isolation was added in 4d1e0d3 to avoid conflicts between concurrent runs. Go's build cache is safe for concurrent use, and
go testnever caches results when-benchis set, so a shared cache can't cause benchmarks to be skipped.Build-only times for
./integrationtests/self ./quicvarinton an M3 Max: 12.6 s with isolated caches, 7.4 s with a warmGOCACHE.The
testingpackage and every test binary are still rebuilt on each run, because the instrument-hooks dir and the profile dir are substituted into the overlay. With both paths fixed, the warm build takes 1.6 s. Reading them at runtime instead is left for a separate PR.