]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.ssa] cmd/compile: run std tests with SSA codegen as part of all.bash
authorJosh Bleecher Snyder <josharian@gmail.com>
Fri, 4 Sep 2015 15:50:28 +0000 (08:50 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Sat, 5 Sep 2015 20:12:23 +0000 (20:12 +0000)
Todd Neal has made all the stdlib tests pass.
Now the trybots and build dashboard can
help us keep them passing.

All of this code will be unwound bit by bit
as SSA matures and then becomes the default.

Change-Id: I52ac7e72a87d329ccce974d6671c054374828d11
Reviewed-on: https://go-review.googlesource.com/14294
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/dist/test.go

index d0e634640c067d1abb8264fab318f548f8635b1c..4cc181f61063de8ba030c971d136a7967657ac6e 100755 (executable)
@@ -12,6 +12,7 @@ import (
        "log"
        "os"
        "os/exec"
+       "path"
        "path/filepath"
        "regexp"
        "strconv"
@@ -274,6 +275,39 @@ func (t *tester) registerStdTest(pkg string) {
        })
 }
 
+// TODO: Remove when SSA codegen is used by default.
+func (t *tester) registerSSATest(pkg string) {
+       switch pkg {
+       // known failures due to GOGC=off
+       case "runtime", "runtime/pprof", "runtime/trace", "sync":
+               return
+       // TODO: fix these failures
+       case "math/big", "cmd/compile/internal/big":
+               return
+       }
+       t.tests = append(t.tests, distTest{
+               name:    "go_test_ssa:" + pkg,
+               heading: "Testing packages with SSA codegen.",
+               fn: func() error {
+                       args := []string{
+                               "test",
+                               "-short",
+                               t.timeout(180 * 3), // SSA generates slower code right now
+                               "-gcflags=" + os.Getenv("GO_GCFLAGS"),
+                       }
+                       if t.race {
+                               args = append(args, "-race")
+                       }
+                       args = append(args, pkg)
+                       cmd := exec.Command("go", args...)
+                       cmd.Env = mergeEnvLists([]string{"GOSSAPKG=" + path.Base(pkg), "GOGC=off"}, os.Environ())
+                       cmd.Stdout = os.Stdout
+                       cmd.Stderr = os.Stderr
+                       return cmd.Run()
+               },
+       })
+}
+
 func (t *tester) registerRaceBenchTest(pkg string) {
        testName := "go_test_bench:" + pkg
        if t.runRx == nil || t.runRx.MatchString(testName) {
@@ -317,6 +351,9 @@ func (t *tester) registerTests() {
                        if strings.HasPrefix(name, "go_test_bench:") {
                                t.registerRaceBenchTest(strings.TrimPrefix(name, "go_test_bench:"))
                        }
+                       if t.goarch == "amd64" && strings.HasPrefix(name, "go_test_ssa:") {
+                               t.registerSSATest(strings.TrimPrefix(name, "go_test_ssa:"))
+                       }
                }
        } else {
                // Use a format string to only list packages and commands that have tests.
@@ -333,6 +370,11 @@ func (t *tester) registerTests() {
                for _, pkg := range pkgs {
                        t.registerStdTest(pkg)
                }
+               if t.goarch == "amd64" {
+                       for _, pkg := range pkgs {
+                               t.registerSSATest(pkg)
+                       }
+               }
                if t.race {
                        for _, pkg := range pkgs {
                                t.registerRaceBenchTest(pkg)