transform, interp: name the test fixture cache workaround - #5781
Merged
Merged
Conversation
`go test` only treats a file as a cache input if the test opened it through the os package. LLVM fixtures are read by llvm.NewMemoryBufferFromFile, which opens the file in C, so a fixture is never hashed and editing one leaves a stale cached pass. optimizer_internal_test.go had no os.Stat workaround, so TestBlockGlobalAllocPromotionUses did not run against its fixture: appending unparseable IR to testdata/optimizer-alloc-uses.ll did not fail it. Replace the bare os.Stat calls with ensureTestCacheFreshness, which also fails the test when the fixture is missing, and add the missing call. transform_test, transform and interp each keep a copy. A stopgap for tinygo-org#5780.
Contributor
Author
|
This probably isn’t as planet breaking as it sounds. In CI I doubt the caching works as well as it does locally so CI will likely catch any issues, but it does introduce WTFs for local development. |
Member
|
No, sorry, Yikes was "this must have been a pain to diagnose". |
Contributor
Author
It's all good, tinygo-org/go-llvm#80 |
davecheney
added a commit
to davecheney/go-llvm
that referenced
this pull request
Sep 28, 2026
Fixes tinygo-org/tinygo#5781 Stat the file before passing the path to libllvm. This gives us a cleaner Go error message if the file is missing, and also announces to go test that the file is in scope for caching.
Member
|
Thank you for the improvement @davecheney and to @jakebailey for review. Now merging. |
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.
go testonly treats a file as a cache input if the test opened it through the os package. LLVM fixtures are read byllvm.NewMemoryBufferFromFile, which opens the file in C, so a fixture is never hashed and editing one leaves a stale cached pass.
A stopgap for #5780. I'm working on the go-llvm change next.