]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.ssa] test: use SSA codegen for runnable tests
authorJosh Bleecher Snyder <josharian@gmail.com>
Mon, 7 Sep 2015 02:39:07 +0000 (19:39 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Mon, 7 Sep 2015 18:29:09 +0000 (18:29 +0000)
Now that the standard library tests
are all passing, add the
test directory tests.

These contain a number of edge case tests
that are of particular interest for compilers.

Some kinds of tests are not well-suited
for a new backend, such as errorcheck tests.
To start, use SSA only for run and runoutput.

There are three failing tests now.
Just mark them as such for now,
so that we can prevent regressions.

This code will all be unwound once SSA
codegen matures and becomes the default.

Change-Id: Ic51e6d0cc1cd48ef1e2fe2c9a743bf0cce275200
Reviewed-on: https://go-review.googlesource.com/14344
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

test/run.go

index 6e1cde9390000aadc408ee58b52c5c7c139ad698..f2618e027b0f0d16822945df89a3e09e0a3f272c 100644 (file)
@@ -493,6 +493,7 @@ func (t *test) run() {
        }
 
        useTmp := true
+       ssaMain := false
        runcmd := func(args ...string) ([]byte, error) {
                cmd := exec.Command(args[0], args[1:]...)
                var buf bytes.Buffer
@@ -501,6 +502,11 @@ func (t *test) run() {
                if useTmp {
                        cmd.Dir = t.tempDir
                        cmd.Env = envForDir(cmd.Dir)
+               } else {
+                       cmd.Env = os.Environ()
+               }
+               if ssaMain && os.Getenv("GOARCH") == "amd64" {
+                       cmd.Env = append(cmd.Env, "GOSSAPKG=main")
                }
                err := cmd.Run()
                if err != nil {
@@ -631,6 +637,12 @@ func (t *test) run() {
 
        case "run":
                useTmp = false
+               switch t.gofile {
+               case "bug434.go", "recover.go", "recover1.go", "issue4066.go":
+                       // TODO fix these failures
+               default:
+                       ssaMain = true
+               }
                out, err := runcmd(append([]string{"go", "run", t.goFileName()}, args...)...)
                if err != nil {
                        t.err = err
@@ -656,6 +668,7 @@ func (t *test) run() {
                        t.err = fmt.Errorf("write tempfile:%s", err)
                        return
                }
+               ssaMain = true
                out, err = runcmd("go", "run", tfile)
                if err != nil {
                        t.err = err