diff options
author | qmuntal <quimmuntal@gmail.com> | 2023-06-09 17:41:36 +0200 |
---|---|---|
committer | Quim Muntal <quimmuntal@gmail.com> | 2023-06-15 05:42:15 +0000 |
commit | c5463218a228b082661df3f5f1ba0492a4d3df18 (patch) | |
tree | 1b0d329caff1de59ca8207d2c1283f4f0fa3d750 | |
parent | 9fc84363d1c317fd8d8f963de3bb10f8a8df05ac (diff) | |
download | go-c5463218a228b082661df3f5f1ba0492a4d3df18.tar.gz go-c5463218a228b082661df3f5f1ba0492a4d3df18.zip |
cmd/api: skip TestIssue29837 when -short is set
TestIssue29837 takes a long time to run, ~150s on my laptop
and ~40s on CI builders.
While here, warm up the go list cache in parallel, which reduces the
test time by ~10%.
Change-Id: Ib8d45b086453ee03e6c9f3f070d6f6b0d324bfd4
Reviewed-on: https://go-review.googlesource.com/c/go/+/502095
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
-rw-r--r-- | src/cmd/api/api_test.go | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/cmd/api/api_test.go b/src/cmd/api/api_test.go index 53ae6fd2c8..a5ac49ce2d 100644 --- a/src/cmd/api/api_test.go +++ b/src/cmd/api/api_test.go @@ -209,16 +209,7 @@ func BenchmarkAll(b *testing.B) { } } -func TestIssue21181(t *testing.T) { - if testing.Short() { - t.Skip("skipping with -short") - } - if *flagCheck { - // slow, not worth repeating in -check - t.Skip("skipping with -check set") - } - testenv.MustHaveGoBuild(t) - +var warmupCache = sync.OnceFunc(func() { // Warm up the import cache in parallel. var wg sync.WaitGroup for _, context := range contexts { @@ -230,6 +221,19 @@ func TestIssue21181(t *testing.T) { }() } wg.Wait() +}) + +func TestIssue21181(t *testing.T) { + if testing.Short() { + t.Skip("skipping with -short") + } + if *flagCheck { + // slow, not worth repeating in -check + t.Skip("skipping with -check set") + } + testenv.MustHaveGoBuild(t) + + warmupCache() for _, context := range contexts { w := NewWalker(context, "testdata/src/issue21181") @@ -243,11 +247,17 @@ func TestIssue21181(t *testing.T) { } func TestIssue29837(t *testing.T) { + if testing.Short() { + t.Skip("skipping with -short") + } if *flagCheck { // slow, not worth repeating in -check t.Skip("skipping with -check set") } testenv.MustHaveGoBuild(t) + + warmupCache() + for _, context := range contexts { w := NewWalker(context, "testdata/src/issue29837") _, err := w.ImportFrom("p", "", 0) |