]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: skip TestOldLink if the old linker does not exist
authorCherry Zhang <cherryyz@google.com>
Tue, 14 Jul 2020 22:55:29 +0000 (18:55 -0400)
committerCherry Zhang <cherryyz@google.com>
Wed, 15 Jul 2020 00:59:51 +0000 (00:59 +0000)
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>
src/cmd/link/link_test.go

index dc7adcb5fb02789fae00dc018603100719fd1eb9..8f417ec8db26b894792ee2a19710d0dfb5d10ebf 100644 (file)
@@ -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)
        }