Skip to content

Commit c5d7f2f

Browse files
committed
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent fa98f46 commit c5d7f2f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/cmd/link/link_test.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,13 @@ func TestOldLink(t *testing.T) {
541541

542542
testenv.MustHaveGoBuild(t)
543543

544+
// Check that the old linker exists (we don't ship it in binary releases,
545+
// see issue 39509).
546+
cmd := exec.Command(testenv.GoToolPath(t), "tool", "-n", "oldlink")
547+
if err := cmd.Run(); err != nil {
548+
t.Skip("skipping because cannot find installed cmd/oldlink binary")
549+
}
550+
544551
tmpdir, err := ioutil.TempDir("", "TestOldLink")
545552
if err != nil {
546553
t.Fatal(err)
@@ -553,7 +560,7 @@ func TestOldLink(t *testing.T) {
553560
t.Fatal(err)
554561
}
555562

556-
cmd := exec.Command(testenv.GoToolPath(t), "run", "-gcflags=all=-go115newobj=false", "-asmflags=all=-go115newobj=false", "-ldflags=-go115newobj=false", src)
563+
cmd = exec.Command(testenv.GoToolPath(t), "run", "-gcflags=all=-go115newobj=false", "-asmflags=all=-go115newobj=false", "-ldflags=-go115newobj=false", src)
557564
if out, err := cmd.CombinedOutput(); err != nil {
558565
t.Errorf("%v: %v:\n%s", cmd.Args, err, out)
559566
}

0 commit comments

Comments
 (0)