1
0
mirror of https://github.com/golang/go synced 2024-09-30 14:28:33 -06:00

cmd/internal/obj/arm64: do not clear environment in TestLarge and TestNoRet

Windows process cannot run properly, if it only has
GOOS and GOARCH environment variables set. It needs
other environment variables. So adjust TestLarge and
TestNoRet to add GOOS and GOARCH to the existing
variables set instead of clearing environment.

Fixes #24855

Change-Id: I9fd9430d89031c3bacdbc6283450efaa4819e616
Reviewed-on: https://go-review.googlesource.com/107035
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Alex Brainman 2018-04-14 14:14:28 +10:00 committed by Brad Fitzpatrick
parent 73ab594c52
commit 11309ba0e6

View File

@ -42,7 +42,7 @@ func TestLarge(t *testing.T) {
// build generated file
cmd := exec.Command(testenv.GoToolPath(t), "tool", "asm", "-o", filepath.Join(dir, "x.o"), tmpfile)
cmd.Env = []string{"GOARCH=arm64", "GOOS=linux"}
cmd.Env = append(os.Environ(), "GOARCH=arm64", "GOOS=linux")
out, err := cmd.CombinedOutput()
if err != nil {
t.Errorf("Build failed: %v, output: %s", err, out)
@ -74,7 +74,7 @@ func TestNoRet(t *testing.T) {
t.Fatal(err)
}
cmd := exec.Command(testenv.GoToolPath(t), "tool", "asm", "-o", filepath.Join(dir, "x.o"), tmpfile)
cmd.Env = []string{"GOARCH=arm64", "GOOS=linux"}
cmd.Env = append(os.Environ(), "GOARCH=arm64", "GOOS=linux")
if out, err := cmd.CombinedOutput(); err != nil {
t.Errorf("%v\n%s", err, out)
}