Skip to content

Commit 842a928

Browse files
committed
gopls/internal/regtest: only run in 'singleton' mode on certain GOOS
The gopls regtests have highly variable performance on certain operating systems, we believe due to kernel contention. Flakes are a problem, and it's better to have coverage of our default execution mode than no coverage at all. For golang/go#44099 For golang/go#42789 Change-Id: Ie9f3f93bb950930401aac3ce55cdffb889d0f0e1 Reviewed-on: https://go-review.googlesource.com/c/tools/+/289692 Trust: Robert Findley <[email protected]> Run-TryBot: Robert Findley <[email protected]> gopls-CI: kokoro <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Rebecca Stambler <[email protected]>
1 parent bd8508e commit 842a928

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

gopls/internal/regtest/regtest.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,24 @@ func (r RunMultiple) Run(t *testing.T, files string, f TestFunc) {
6262
}
6363
}
6464

65+
// The regtests run significantly slower on these operating systems, due to (we
66+
// believe) kernel locking behavior. Only run in singleton mode on these
67+
// operating system when using -short.
68+
var slowGOOS = map[string]bool{
69+
"darwin": true,
70+
"openbsd": true,
71+
"plan9": true,
72+
}
73+
6574
func DefaultModes() Mode {
75+
normal := Singleton | Experimental
76+
if slowGOOS[runtime.GOOS] && testing.Short() {
77+
normal = Singleton
78+
}
6679
if *runSubprocessTests {
67-
return NormalModes | SeparateProcess
80+
return normal | SeparateProcess
6881
}
69-
return NormalModes
82+
return normal
7083
}
7184

7285
// Main sets up and tears down the shared regtest state.

gopls/internal/regtest/runner.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ const (
4747
// Experimental enables all of the experimental configurations that are
4848
// being developed. Currently, it enables the workspace module.
4949
Experimental
50-
// NormalModes are the global default execution modes, when unmodified by
51-
// test flags or by individual test options.
52-
NormalModes = Singleton | Experimental
5350
)
5451

5552
// A Runner runs tests in gopls execution environments, as specified by its

0 commit comments

Comments
 (0)