]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/dist: shard shootout test units
authorBrad Fitzpatrick <bradfitz@golang.org>
Fri, 18 Sep 2015 16:39:35 +0000 (16:39 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 18 Sep 2015 18:32:56 +0000 (18:32 +0000)
Instead of a 10 second test unit, make it 13 sub-second ones. This
takes advantage of multiple builders better.

Fixes #12623

Change-Id: I3fb2eb02f899f25749e34b546b9d41b742a746cd
Reviewed-on: https://go-review.googlesource.com/14738
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/dist/test.go

index 510dc30f949f929d8b92fbd70778aef9a5c87899..fa1a5e67d66a8233589873a84e847c5e2619e644 100644 (file)
@@ -9,6 +9,7 @@ import (
        "errors"
        "flag"
        "fmt"
+       "io/ioutil"
        "log"
        "os"
        "os/exec"
@@ -449,7 +450,9 @@ func (t *tester) registerTests() {
                t.registerTest("doc_progs", "../doc/progs", "time", "go", "run", "run.go")
                t.registerTest("wiki", "../doc/articles/wiki", "./test.bash")
                t.registerTest("codewalk", "../doc/codewalk", "time", "./run")
-               t.registerTest("shootout", "../test/bench/shootout", "time", "./timing.sh", "-test")
+               for _, name := range t.shootoutTests() {
+                       t.registerTest("shootout:"+name, "../test/bench/shootout", "time", "./timing.sh", "-test", name)
+               }
        }
        if t.goos != "android" && !t.iOS() {
                t.registerTest("bench_go1", "../test/bench/go1", "go", "test")
@@ -847,6 +850,18 @@ func (t *tester) testDirTest(shard, shards int) error {
        ).Run()
 }
 
+func (t *tester) shootoutTests() []string {
+       sh, err := ioutil.ReadFile(filepath.Join(t.goroot, "test", "bench", "shootout", "timing.sh"))
+       if err != nil {
+               log.Fatal(err)
+       }
+       m := regexp.MustCompile(`(?m)^\s+run="([\w+ ]+)"\s*$`).FindSubmatch(sh)
+       if m == nil {
+               log.Fatal("failed to find run=\"...\" line in test/bench/shootout/timing.sh")
+       }
+       return strings.Fields(string(m[1]))
+}
+
 // mergeEnvLists merges the two environment lists such that
 // variables with the same name in "in" replace those in "out".
 // out may be mutated.