From 11309ba0e651bbbec0ff9d7200bb51b56a5c0f49 Mon Sep 17 00:00:00 2001 From: Alex Brainman Date: Sat, 14 Apr 2018 14:14:28 +1000 Subject: [PATCH] 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 TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- src/cmd/internal/obj/arm64/asm_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cmd/internal/obj/arm64/asm_test.go b/src/cmd/internal/obj/arm64/asm_test.go index 68f5b0b346..2182301212 100644 --- a/src/cmd/internal/obj/arm64/asm_test.go +++ b/src/cmd/internal/obj/arm64/asm_test.go @@ -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) }