diff options
author | Cherry Zhang <cherryyz@google.com> | 2020-07-14 18:55:29 -0400 |
---|---|---|
committer | Cherry Zhang <cherryyz@google.com> | 2020-07-15 00:59:51 +0000 |
commit | c5d7f2f1cbaca8938a31a022058b1a3300817e33 (patch) | |
tree | b810fb7971e526a9fd212b7d47b0ac9a25e49879 | |
parent | fa98f46741f818913a8c11b877520a548715131f (diff) | |
download | go-c5d7f2f1cbaca8938a31a022058b1a3300817e33.tar.gz go-c5d7f2f1cbaca8938a31a022058b1a3300817e33.zip |
cmd/link: skip TestOldLink if the old linker does not exist
We don't ship the old linker in binary releases. Skip the test if
we cannot find the old linker.
Fixes #39509.
Change-Id: I1af5552bc56aff5314a384bcb5f3717b725d68e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/242604
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
-rw-r--r-- | src/cmd/link/link_test.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/cmd/link/link_test.go b/src/cmd/link/link_test.go index dc7adcb5fb..8f417ec8db 100644 --- a/src/cmd/link/link_test.go +++ b/src/cmd/link/link_test.go @@ -541,6 +541,13 @@ func TestOldLink(t *testing.T) { testenv.MustHaveGoBuild(t) + // Check that the old linker exists (we don't ship it in binary releases, + // see issue 39509). + cmd := exec.Command(testenv.GoToolPath(t), "tool", "-n", "oldlink") + if err := cmd.Run(); err != nil { + t.Skip("skipping because cannot find installed cmd/oldlink binary") + } + tmpdir, err := ioutil.TempDir("", "TestOldLink") if err != nil { t.Fatal(err) @@ -553,7 +560,7 @@ func TestOldLink(t *testing.T) { t.Fatal(err) } - cmd := exec.Command(testenv.GoToolPath(t), "run", "-gcflags=all=-go115newobj=false", "-asmflags=all=-go115newobj=false", "-ldflags=-go115newobj=false", src) + cmd = exec.Command(testenv.GoToolPath(t), "run", "-gcflags=all=-go115newobj=false", "-asmflags=all=-go115newobj=false", "-ldflags=-go115newobj=false", src) if out, err := cmd.CombinedOutput(); err != nil { t.Errorf("%v: %v:\n%s", cmd.Args, err, out) } |