]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/dist: spin up fewer test dir runners
authorJosh Bleecher Snyder <josharian@gmail.com>
Tue, 2 May 2017 12:35:55 +0000 (05:35 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Tue, 2 May 2017 13:39:51 +0000 (13:39 +0000)
5 shards, each of which spins up NumCPU processes,
each of which is running at GOMAXPROCS=NumCPU,
is too much for one machine. It makes my laptop unusable.

It might also be in part responsible for test flakes
that require a moderately responsive system,
like #18589 (backedge scheduling) and #19276 (locklinear).

It's possible that Go should be a better neighbor in general;
that's #17969. In the meantime, fix this corner of the world.

Builders snapshot the world and run shards on different
machines, so keeping sharding high for them is good.

This is a partial reversion of CL 18199.

Fixes #20141.

Change-Id: I123cf9436f4f4da3550372896265c38117b78071
Reviewed-on: https://go-review.googlesource.com/42431
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/dist/test.go

index 6026d26a9b0053975ce40245f32d44587400cbef..fc2b58a0823f1320daed44879e506870914c68d7 100644 (file)
@@ -597,7 +597,13 @@ func (t *tester) registerTests() {
                t.registerTest("bench_go1", "../test/bench/go1", "go", "test", t.timeout(600), t.runFlag(""))
        }
        if t.goos != "android" && !t.iOS() {
-               const nShards = 5
+               // Only start multiple test dir shards on builders,
+               // where they get distributed to multiple machines.
+               // See issue 20141.
+               nShards := 1
+               if os.Getenv("GO_BUILDER_NAME") != "" {
+                       nShards = 10
+               }
                for shard := 0; shard < nShards; shard++ {
                        shard := shard
                        t.tests = append(t.tests, distTest{
@@ -1143,7 +1149,7 @@ func (t *tester) testDirTest(dt *distTest, shard, shards int) error {
        runtest.Do(func() {
                const exe = "runtest.exe" // named exe for Windows, but harmless elsewhere
                cmd := t.dirCmd("test", "go", "build", "-o", exe, "run.go")
-               cmd.Env = append(os.Environ(), "GOOS="+t.gohostos, "GOARCH="+t.gohostarch, "GOMAXPROCS=")
+               cmd.Env = append(os.Environ(), "GOOS="+t.gohostos, "GOARCH="+t.gohostarch)
                runtest.exe = filepath.Join(cmd.Dir, exe)
                if err := cmd.Run(); err != nil {
                        runtest.err = err