Skip to content

Commit

Permalink
cmd/link: skip TestOldLink if the old linker does not exist
Browse files Browse the repository at this point in the history
We don't ship the old linker in binary releases. Skip the test if
we cannot find the old linker.

Fixes golang#39509.

Change-Id: I1af5552bc56aff5314a384bcb5f3717b725d68e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/242604
Run-TryBot: Cherry Zhang <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
  • Loading branch information
cherrymui committed Jul 15, 2020
1 parent fa98f46 commit c5d7f2f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/cmd/link/link_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
}
Expand Down

0 comments on commit c5d7f2f

Please sign in to comment.