Commit 11309ba0 authored by Alex Brainman's avatar Alex Brainman Committed by Brad Fitzpatrick

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: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 73ab594c
...@@ -42,7 +42,7 @@ func TestLarge(t *testing.T) { ...@@ -42,7 +42,7 @@ func TestLarge(t *testing.T) {
// build generated file // build generated file
cmd := exec.Command(testenv.GoToolPath(t), "tool", "asm", "-o", filepath.Join(dir, "x.o"), tmpfile) 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() out, err := cmd.CombinedOutput()
if err != nil { if err != nil {
t.Errorf("Build failed: %v, output: %s", err, out) t.Errorf("Build failed: %v, output: %s", err, out)
...@@ -74,7 +74,7 @@ func TestNoRet(t *testing.T) { ...@@ -74,7 +74,7 @@ func TestNoRet(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
cmd := exec.Command(testenv.GoToolPath(t), "tool", "asm", "-o", filepath.Join(dir, "x.o"), tmpfile) 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 { if out, err := cmd.CombinedOutput(); err != nil {
t.Errorf("%v\n%s", err, out) t.Errorf("%v\n%s", err, out)
} }
......
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