]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: drop flaky part of TestGoTestJSON
authorRuss Cox <rsc@golang.org>
Thu, 16 Nov 2017 16:43:39 +0000 (11:43 -0500)
committerRuss Cox <rsc@golang.org>
Thu, 16 Nov 2017 16:59:15 +0000 (16:59 +0000)
Still failing on builders. I give up.
(For example https://build.golang.org/log/4fa5ba031c2fab5df397ac894f8b81392a93728e.)

Change-Id: Ifa87813e27e1adfe9920c7e657b0ff129eb5bf2f
Reviewed-on: https://go-review.googlesource.com/78315
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/go/go_test.go

index cbcc85bfa34e025566c92d1403ba1270fc3945f2..a1f8a7f4eb8ecd41e5ff92e650b9e378b22eabc7 100644 (file)
@@ -5173,44 +5173,14 @@ func TestGoTestJSON(t *testing.T) {
        tg.setenv("GOCACHE", tg.tempdir)
        tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata"))
 
-       // Test that math and fmt output is interlaced.
-       // This has the potential to be a flaky test,
-       // especially on uniprocessor systems, so only
-       // require interlacing if we have at least 4 CPUs.
-       // We also try twice, hoping that the cache will be
-       // warmed up the second time.
-       needInterlace := runtime.GOMAXPROCS(-1) >= 4
-       for try := 0; ; try++ {
-               tg.run("test", "-json", "-short", "-v", "sleepy1", "sleepy2")
-               sawSleepy1 := false
-               sawSleepy2 := false
-               state := 0
-               for _, line := range strings.Split(tg.getStdout(), "\n") {
-                       if strings.Contains(line, `"Package":"sleepy1"`) {
-                               sawSleepy1 = true
-                               if state == 0 {
-                                       state = 1
-                               }
-                               if state == 2 {
-                                       state = 3
-                               }
-                       }
-                       if strings.Contains(line, `"Package":"sleepy2"`) {
-                               sawSleepy2 = true
-                               if state == 1 {
-                                       state = 2
-                               }
-                       }
-               }
-               if !sawSleepy1 || !sawSleepy2 {
-                       t.Fatalf("did not see output from both sleepy1 and sleepy2")
-               }
-               if needInterlace && state != 3 {
-                       if try < 1 {
-                               continue
-                       }
-                       t.Fatalf("did not find sleepy1 interlaced with sleepy2")
+       // It would be nice to test that the output is interlaced
+       // but it seems to be impossible to do that in a short test
+       // that isn't also flaky. Just check that we get JSON output.
+       tg.run("test", "-json", "-short", "-v", "errors")
+       for _, line := range strings.Split(tg.getStdout(), "\n") {
+               if strings.Contains(line, `"Package":"errors"`) {
+                       return
                }
-               break
        }
+       t.Fatalf("did not see JSON output")
 }