]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go, misc/cgo: skip test if no .edata
authorJason A. Donenfeld <Jason@zx2c4.com>
Sat, 12 Jun 2021 10:34:40 +0000 (12:34 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Sun, 13 Jun 2021 08:17:17 +0000 (08:17 +0000)
Clang does not produce binaries with an .edata section, even when it
exports symbols properly, so just skip this binutils-specific test for
that case. Later we can rewrite these tests entirely to do something
more robust.

Updates #46719.

Change-Id: I864b3c2d91e66800c55454ae11d4ab1623693d14
Reviewed-on: https://go-review.googlesource.com/c/go/+/327549
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
misc/cgo/testcshared/cshared_test.go
src/cmd/go/go_test.go

index 90d8c365e6d2caf2ec193e84f91dd7ccd3dc9d35..fdc6df9602cceef41668c71e34fb4e7bf7822512 100644 (file)
@@ -400,7 +400,7 @@ func main() {
        defer f.Close()
        section := f.Section(".edata")
        if section == nil {
-               t.Fatalf(".edata section is not present")
+               t.Skip(".edata section is not present")
        }
 
        // TODO: deduplicate this struct from cmd/link/internal/ld/pe.go
index a059a6dd902a8ee0e7e5832cf8671dbdb5c3aab0..c0c86ab9f583b182f71abba5dc86abfecd7fc588 100644 (file)
@@ -72,7 +72,6 @@ func tooSlow(t *testing.T) {
 // (temp) directory.
 var testGOROOT string
 
-var testCC string
 var testGOCACHE string
 
 var testGo string
@@ -179,13 +178,6 @@ func TestMain(m *testing.M) {
                        os.Exit(2)
                }
 
-               out, err = exec.Command(gotool, "env", "CC").CombinedOutput()
-               if err != nil {
-                       fmt.Fprintf(os.Stderr, "could not find testing CC: %v\n%s", err, out)
-                       os.Exit(2)
-               }
-               testCC = strings.TrimSpace(string(out))
-
                cmd := exec.Command(testGo, "env", "CGO_ENABLED")
                cmd.Stderr = new(strings.Builder)
                if out, err := cmd.Output(); err != nil {
@@ -2185,7 +2177,7 @@ func testBuildmodePIE(t *testing.T, useCgo, setBuildmodeToPIE bool) {
                        // See https://sourceware.org/bugzilla/show_bug.cgi?id=19011
                        section := f.Section(".edata")
                        if section == nil {
-                               t.Fatalf(".edata section is not present")
+                               t.Skip(".edata section is not present")
                        }
                        // TODO: deduplicate this struct from cmd/link/internal/ld/pe.go
                        type IMAGE_EXPORT_DIRECTORY struct {