Skip to content

Commit

Permalink
cmd/api: skip TestIssue29837 when -short is set
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
qmuntal committed Jun 15, 2023
1 parent 9fc8436 commit c546321
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions src/cmd/api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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")
Expand All @@ -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)
Expand Down

0 comments on commit c546321

Please sign in to comment.