From 9f83418b83a43029ce8801ef10162dd94fdba81d Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Fri, 15 Jan 2021 13:19:31 -0500 Subject: [PATCH] cmd/link: remove GOROOT write in TestBuildForTvOS Tests should avoid writing to GOROOT when possible. Such writes would fail if GOROOT is non-writeable, and it can interfere with other tests that don't expect GOROOT to change during test execution. Updates #28387. Change-Id: I7d72614f218df3375540f5c2f9c9f8c11034f602 Reviewed-on: https://go-review.googlesource.com/c/go/+/284293 Trust: Dmitri Shuralyov Reviewed-by: Cherry Zhang Reviewed-by: Bryan C. Mills --- src/cmd/link/link_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cmd/link/link_test.go b/src/cmd/link/link_test.go index 7eeb7ef568fb6..8153c0b31b543 100644 --- a/src/cmd/link/link_test.go +++ b/src/cmd/link/link_test.go @@ -320,6 +320,7 @@ func TestBuildForTvOS(t *testing.T) { } link := exec.Command(CC[0], CC[1:]...) + link.Args = append(link.Args, "-o", filepath.Join(tmpDir, "a.out")) // Avoid writing to package directory. link.Args = append(link.Args, ar, filepath.Join("testdata", "testBuildFortvOS", "main.m")) if out, err := link.CombinedOutput(); err != nil { t.Fatalf("%v: %v:\n%s", link.Args, err, out)