diff options
author | Alberto Donizetti <alb.donizetti@gmail.com> | 2018-03-29 18:52:12 +0200 |
---|---|---|
committer | Alberto Donizetti <alb.donizetti@gmail.com> | 2018-03-29 19:00:10 +0000 |
commit | aacf7a1846f56db248bd558f33859291d0b1823e (patch) | |
tree | f3f9a7578c1e630117af1b92cd372149d1326104 /test/run.go | |
parent | 014a9048d4f25b4afd090c9d5e7efe0b7c7b6dda (diff) | |
download | go-aacf7a1846f56db248bd558f33859291d0b1823e.tar.gz go-aacf7a1846f56db248bd558f33859291d0b1823e.zip |
test: avoid touching GOOS/GOARCH in codegen driver
This change modifies the codegen test harness driver so that it no
longer modifies the environment GOOS/GOARCH, since that seems to cause
flakiness in other concurrently-running tests.
The change also enables the codegen tests in run.go.
Fixes #24538
Change-Id: I997ac1eb38eb92054efff67fe5c4d3cccc86412b
Reviewed-on: https://go-review.googlesource.com/103455
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'test/run.go')
-rw-r--r-- | test/run.go | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/test/run.go b/test/run.go index c992c7e9d1..8313a0d741 100644 --- a/test/run.go +++ b/test/run.go @@ -52,7 +52,7 @@ var ( // dirs are the directories to look for *.go files in. // TODO(bradfitz): just use all directories? - dirs = []string{".", "ken", "chan", "interface", "syntax", "dwarf", "fixedbugs"} + dirs = []string{".", "ken", "chan", "interface", "syntax", "dwarf", "fixedbugs", "codegen"} // ratec controls the max number of tests running at a time. ratec chan bool @@ -612,18 +612,20 @@ func (t *test) run() { case "asmcheck": ops, archs := t.wantedAsmOpcodes(long) for _, arch := range archs { - os.Setenv("GOOS", "linux") - os.Setenv("GOARCH", arch) - - cmdline := []string{goTool(), "build", "-gcflags", "-S"} + cmdline := []string{"build", "-gcflags", "-S"} cmdline = append(cmdline, flags...) cmdline = append(cmdline, long) - out, err := runcmd(cmdline...) - if err != nil { + cmd := exec.Command(goTool(), cmdline...) + cmd.Env = append(os.Environ(), "GOOS=linux", "GOARCH="+arch) + + var buf bytes.Buffer + cmd.Stdout, cmd.Stderr = &buf, &buf + if err := cmd.Run(); err != nil { t.err = err return } - t.err = t.asmCheck(string(out), long, arch, ops[arch]) + + t.err = t.asmCheck(buf.String(), long, arch, ops[arch]) if t.err != nil { return } |