Commit aacf7a18 authored by Alberto Donizetti's avatar Alberto Donizetti

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: default avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 014a9048
...@@ -52,7 +52,7 @@ var ( ...@@ -52,7 +52,7 @@ var (
// dirs are the directories to look for *.go files in. // dirs are the directories to look for *.go files in.
// TODO(bradfitz): just use all directories? // 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 controls the max number of tests running at a time.
ratec chan bool ratec chan bool
...@@ -612,18 +612,20 @@ func (t *test) run() { ...@@ -612,18 +612,20 @@ func (t *test) run() {
case "asmcheck": case "asmcheck":
ops, archs := t.wantedAsmOpcodes(long) ops, archs := t.wantedAsmOpcodes(long)
for _, arch := range archs { for _, arch := range archs {
os.Setenv("GOOS", "linux") cmdline := []string{"build", "-gcflags", "-S"}
os.Setenv("GOARCH", arch)
cmdline := []string{goTool(), "build", "-gcflags", "-S"}
cmdline = append(cmdline, flags...) cmdline = append(cmdline, flags...)
cmdline = append(cmdline, long) cmdline = append(cmdline, long)
out, err := runcmd(cmdline...) cmd := exec.Command(goTool(), cmdline...)
if err != nil { 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 t.err = err
return 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 { if t.err != nil {
return return
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment