test(googlesql): build the Spanner harness once per test binary, in a temp dir - #437
Merged
Merged
Conversation
… temp dir
Every googlesql oracle test built harness/googlesql-spanner into the module
dir and exec'd it from there. CI runs packages with `go test -p=8`, so the
analysis and parser test binaries could build into the same path at once and
one exec'd a file the other was still writing:
oracle_test.go:96: starting harness: fork/exec .../googlesql-spanner:
text file busy
spannertest.HarnessBinary now builds the harness once per test binary
(sync.Once) into a private os.MkdirTemp dir, so no two processes touch the
same file. The eight per-file build blocks (analysis, corpus, datatypes, ddl,
expr, pivot_unpivot, select, spanner_ddl) collapse to one call. A TestMain in
each package removes the temp dir at exit; the harness module is untouched.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Problem
TestAnalysisDifferentialfailed in CI (run 35838145547) with:Eight googlesql oracle tests (analysis, and corpus/datatypes/ddl/expr/pivot_unpivot/select/spanner_ddl in parser) each ran
go build -o harness/googlesql-spanner/googlesql-spanner .and exec'd that path. CI runs packages withgo test -p=8, so the analysis and parser test binaries could build into the same file at once and one exec'd a binary the other was still writing.Fix
spannertest.HarnessBinary(t)builds the harness once per test binary (sync.Once) into a privateos.MkdirTempdir, so no two processes touch the same file. It skips when the harness project is absent and fails with the build output on error.TestMainingooglesql/parserandgooglesql/analysisremoves the temp dir at exit so the 49 MB binary does not accumulate across local runs.Verification
go test ./googlesql/analysis/ ./googlesql/parser/ -count=1 -p=8run six times against the auto-started emulator: all pass, no temp dir or module-dir binary left behind.gofmt -landgo vetclean on touched files.🤖 Generated with Claude Code