]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: remove GOROOT write in TestBuildForTvOS
authorDmitri Shuralyov <dmitshur@golang.org>
Fri, 15 Jan 2021 18:19:31 +0000 (13:19 -0500)
committerDmitri Shuralyov <dmitshur@golang.org>
Fri, 15 Jan 2021 21:46:25 +0000 (21:46 +0000)
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 <dmitshur@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
src/cmd/link/link_test.go

index 7eeb7ef568fb640d52fb97638c757fd6a6f2c524..8153c0b31b543114f35cab5bf0e132b622c2d70a 100644 (file)
@@ -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)