1
0
mirror of https://github.com/golang/go synced 2024-11-11 20:01:37 -07:00

[dev.ssa] test: use SSA codegen for runnable tests

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>
This commit is contained in:
Josh Bleecher Snyder 2015-09-06 19:39:07 -07:00
parent ad5ceafa2c
commit 1fc52b61f2

View File

@ -493,6 +493,7 @@ func (t *test) run() {
} }
useTmp := true useTmp := true
ssaMain := false
runcmd := func(args ...string) ([]byte, error) { runcmd := func(args ...string) ([]byte, error) {
cmd := exec.Command(args[0], args[1:]...) cmd := exec.Command(args[0], args[1:]...)
var buf bytes.Buffer var buf bytes.Buffer
@ -501,6 +502,11 @@ func (t *test) run() {
if useTmp { if useTmp {
cmd.Dir = t.tempDir cmd.Dir = t.tempDir
cmd.Env = envForDir(cmd.Dir) 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() err := cmd.Run()
if err != nil { if err != nil {
@ -631,6 +637,12 @@ func (t *test) run() {
case "run": case "run":
useTmp = false 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...)...) out, err := runcmd(append([]string{"go", "run", t.goFileName()}, args...)...)
if err != nil { if err != nil {
t.err = err t.err = err
@ -656,6 +668,7 @@ func (t *test) run() {
t.err = fmt.Errorf("write tempfile:%s", err) t.err = fmt.Errorf("write tempfile:%s", err)
return return
} }
ssaMain = true
out, err = runcmd("go", "run", tfile) out, err = runcmd("go", "run", tfile)
if err != nil { if err != nil {
t.err = err t.err = err