From 1fc52b61f24c210514d4b14e9cc2f8e0aa3f3d9b Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Sun, 6 Sep 2015 19:39:07 -0700 Subject: [PATCH] [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 Run-TryBot: Josh Bleecher Snyder TryBot-Result: Gobot Gobot --- test/run.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/run.go b/test/run.go index 6e1cde9390..f2618e027b 100644 --- a/test/run.go +++ b/test/run.go @@ -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 -- 2.48.1