]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: skip gold-specific part of TestNoteReading if gold is unavailable
authorMichael Munday <mike.munday@ibm.com>
Fri, 20 Oct 2017 14:21:05 +0000 (10:21 -0400)
committerMichael Munday <mike.munday@ibm.com>
Fri, 20 Oct 2017 14:45:44 +0000 (14:45 +0000)
The test already contained logic to do this however it did not match
the error "cannot find 'ld'" which appears to be how gcc fails when
ld.gold is missing.

Fixes #22340.

Change-Id: I841248cc489b8fa72bc00a95000ad405f9ef8a4f
Reviewed-on: https://go-review.googlesource.com/72111
Run-TryBot: Michael Munday <mike.munday@ibm.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/go/note_test.go

index 13ccfc74c016483912ed2b330535077873d76106..d198138d83831aabac76ee2cd91f32c83f6b472b 100644 (file)
@@ -54,10 +54,14 @@ func TestNoteReading(t *testing.T) {
                // Test while forcing use of the gold linker, since in the past
                // we've had trouble reading the notes generated by gold.
                err := tg.doRun([]string{"build", "-ldflags", "-buildid=" + buildID + " -linkmode=external -extldflags=-fuse-ld=gold", "-o", tg.path("hello3.exe"), tg.path("hello.go")})
-               if err != nil && (tg.grepCountBoth("invalid linker") > 0 || tg.grepCountBoth("gold") > 0) {
-                       // It's not an error if gold isn't there.
-                       t.Log("skipping gold test")
-                       break
+               if err != nil {
+                       if tg.grepCountBoth("(invalid linker|gold|cannot find 'ld')") > 0 {
+                               // It's not an error if gold isn't there. gcc claims it "cannot find 'ld'" if
+                               // ld.gold is missing, see issue #22340.
+                               t.Log("skipping gold test")
+                               break
+                       }
+                       t.Fatalf("building hello binary: %v", err)
                }
                id, err = buildid.ReadFile(tg.path("hello3.exe"))
                if err != nil {