1
0
mirror of https://github.com/golang/go synced 2024-11-25 04:47:57 -07:00

test/run: fix builders

Let the outer environment filter down to the commands being run.

TBR=r
CC=golang-dev
https://golang.org/cl/5758066
This commit is contained in:
Russ Cox 2012-03-07 02:22:08 -05:00
parent 987a580b9f
commit 712473612f

View File

@ -265,6 +265,10 @@ func (t *test) run() {
err = ioutil.WriteFile(filepath.Join(t.tempDir, t.gofile), srcBytes, 0644) err = ioutil.WriteFile(filepath.Join(t.tempDir, t.gofile), srcBytes, 0644)
check(err) check(err)
// A few tests (of things like the environment) require these to be set.
os.Setenv("GOOS", runtime.GOOS)
os.Setenv("GOARCH", runtime.GOARCH)
useTmp := true useTmp := true
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:]...)
@ -274,7 +278,6 @@ func (t *test) run() {
if useTmp { if useTmp {
cmd.Dir = t.tempDir cmd.Dir = t.tempDir
} }
cmd.Env = append(cmd.Env, "GOOS="+runtime.GOOS, "GOARCH="+runtime.GOARCH)
err := cmd.Run() err := cmd.Run()
return buf.Bytes(), err return buf.Bytes(), err
} }