provision tests: load the three platforms side by side; census tests parallel
TestPlan14RootInputInventoryCoverage loads the module once per platform (linux, darwin, windows), and each packages.Load gets dependency types from export data, which means compiling the module for that platform: 28 s of the package's 39 s on a cold cache, 4.8 s warm. The three loads are independent and now run concurrently; the merge still takes them in the fixed linux, darwin, windows order, so a declaration reached on several platforms records the same caller as before. The coverage test and TestPlan14RootReadCensus read only the source tree, testdata and read-only package maps, so both run in parallel instead of ahead of the package's serial tests. Test files only; no production file in provision changes, so the root read census is untouched. Local, /tmp on tmpfs: package 39 s (cold) to 10.7 s.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+22
−2
internal/provision/plan14_input_inventory_test.go+19 −2internal/provision/plan14_root_reads_test.go+3 −0
CI cancelled — superseded by a newer push — run details
diff --git a/internal/provision/plan14_input_inventory_test.go b/internal/provision/plan14_input_inventory_test.go| index 36bb1091d..7e85fe71c 100644 |
| --- a/internal/provision/plan14_input_inventory_test.go |
| +++ b/internal/provision/plan14_input_inventory_test.go |
| @@ -11,6 +11,7 @@ import ( |
| "path/filepath" |
| "sort" |
| "strings" |
| + "sync" |
| "testing" |
| "golang.org/x/tools/go/packages" |
| @@ -130,9 +131,21 @@ func inputTests(root string) (map[string]bool, error) { |
| // Type/var declarations use references (not imaginary calls). Tests never enter |
| // the graph. Every accepted row records its reachable immediate predecessor. |
| func inputCallers(root string) (map[string]string, error) { |
| + // Each platform's load type-checks the whole module (most of this |
| + // test's time), and the three are independent, so they run side by |
| + // side. The merge below still takes them in this fixed order, so a key |
| + // reached on several platforms records the same caller as before. |
| + platforms := []string{"linux", "darwin", "windows"} |
| + loaded := make([]map[string]string, len(platforms)) |
| + errs := make([]error, len(platforms)) |
| + var wg sync.WaitGroup |
| + for i, platform := range platforms { |
| + wg.Go(func() { loaded[i], errs[i] = inputPlatformCallers(root, platform) }) |
| + } |
| + wg.Wait() |
| out := map[string]string{} |
| - for _, platform := range []string{"linux", "darwin", "windows"} { |
| - callers, err := inputPlatformCallers(root, platform) |
| + for i, platform := range platforms { |
| + callers, err := loaded[i], errs[i] |
| if err != nil { |
| return nil, err |
| } |
| @@ -429,6 +442,10 @@ func checkInputRow(e classifiedRootRead, callers map[string]string, tests map[st |
| } |
| func TestPlan14RootInputInventoryCoverage(t *testing.T) { |
| + // Reads the source tree and read-only package maps only, and spends |
| + // most of its time type-checking the module, so it runs in parallel |
| + // rather than holding up the package's serial tests. |
| + t.Parallel() |
| root := censusRoot(t) |
| inv := inputInventory(t) |
| tests, err := inputTests(root) |
diff --git a/internal/provision/plan14_root_reads_test.go b/internal/provision/plan14_root_reads_test.go| index fbe046f3d..26876c899 100644 |
| --- a/internal/provision/plan14_root_reads_test.go |
| +++ b/internal/provision/plan14_root_reads_test.go |
| @@ -585,6 +585,9 @@ func compareRootReads(got rootReadScan, want rootReadInventory) []string { |
| } |
| func TestPlan14RootReadCensus(t *testing.T) { |
| + // Reads the source tree and testdata only (go list writes nothing |
| + // here but the build cache), so it runs in parallel. |
| + t.Parallel() |
| root := censusRoot(t) |
| got, err := rootReadProduction(root) |
| if err != nil { |