]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/api: skip TestIssue29837 when -short is set
authorqmuntal <quimmuntal@gmail.com>
Fri, 9 Jun 2023 15:41:36 +0000 (17:41 +0200)
committerQuim Muntal <quimmuntal@gmail.com>
Thu, 15 Jun 2023 05:42:15 +0000 (05:42 +0000)
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>
src/cmd/api/api_test.go

index 53ae6fd2c8b3da18dd42d04e1511bf043703754d..a5ac49ce2d5a484675be291269e331850c813b83 100644 (file)
@@ -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)