]> Cypherpunks.ru repositories - gostls13.git/commitdiff
test: skip -buildmode=pie tests on alpine
authorThan McIntosh <thanm@google.com>
Tue, 9 Aug 2022 14:32:59 +0000 (10:32 -0400)
committerThan McIntosh <thanm@google.com>
Tue, 9 Aug 2022 15:13:01 +0000 (15:13 +0000)
Skip a collection of -buildmode=pie tests on alpine, which are
currently failing on the linux-amd64-alpine builder. Once #54354 has
been investigated and resolved we can turn these tests back on.

Updates #54354.

Change-Id: I99d4016a40873ee6bb4eda571a64eddbe719c76a
Reviewed-on: https://go-review.googlesource.com/c/go/+/422295
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
misc/cgo/testshared/shared_test.go
src/cmd/dist/test.go
src/cmd/go/go_test.go

index 634d7556a8f9d8073adcf6fd23f1677616b401bd..92c2166674f40b52915be19ec41a91e400494355 100644 (file)
@@ -528,6 +528,9 @@ func checkPIE(t *testing.T, name string) {
 }
 
 func TestTrivialPIE(t *testing.T) {
+       if strings.HasSuffix(os.Getenv("GO_BUILDER_NAME"), "-alpine") {
+               t.Skip("skipping on alpine until issue #54354 resolved")
+       }
        name := "trivial_pie"
        goCmd(t, "build", "-buildmode=pie", "-o="+name, "./trivial")
        defer os.Remove(name)
index 536a214773fe526ac7f5f3aa68d67486de1de76f..42ff0f939167db75ed5f31f36e80ac05a9f27ea0 100644 (file)
@@ -700,8 +700,12 @@ func (t *tester) registerTests() {
                })
        }
 
+       // Stub out following test on alpine until 54354 resolved.
+       builderName := os.Getenv("GO_BUILDER_NAME")
+       disablePIE := strings.HasSuffix(builderName, "-alpine")
+
        // Test internal linking of PIE binaries where it is supported.
-       if t.internalLinkPIE() {
+       if t.internalLinkPIE() && !disablePIE {
                t.tests = append(t.tests, distTest{
                        name:    "pie_internal",
                        heading: "internal linking of -buildmode=pie",
@@ -711,7 +715,7 @@ func (t *tester) registerTests() {
                        },
                })
                // Also test a cgo package.
-               if t.cgoEnabled && t.internalLink() {
+               if t.cgoEnabled && t.internalLink() && !disablePIE {
                        t.tests = append(t.tests, distTest{
                                name:    "pie_internal_cgo",
                                heading: "internal linking of -buildmode=pie",
@@ -1188,6 +1192,10 @@ func (t *tester) cgoTest(dt *distTest) error {
        cmd := t.addCmd(dt, "misc/cgo/test", t.goTest(), ".")
        setEnv(cmd, "GOFLAGS", "-ldflags=-linkmode=auto")
 
+       // Stub out various buildmode=pie tests  on alpine until 54354 resolved.
+       builderName := os.Getenv("GO_BUILDER_NAME")
+       disablePIE := strings.HasSuffix(builderName, "-alpine")
+
        if t.internalLink() {
                cmd := t.addCmd(dt, "misc/cgo/test", t.goTest(), "-tags=internal", ".")
                setEnv(cmd, "GOFLAGS", "-ldflags=-linkmode=internal")
@@ -1206,7 +1214,8 @@ func (t *tester) cgoTest(dt *distTest) error {
 
                t.addCmd(dt, "misc/cgo/test", t.goTest(), "-ldflags", "-linkmode=external -s", ".")
 
-               if t.supportedBuildmode("pie") {
+               if t.supportedBuildmode("pie") && !disablePIE {
+
                        t.addCmd(dt, "misc/cgo/test", t.goTest(), "-buildmode=pie", ".")
                        if t.internalLink() && t.internalLinkPIE() {
                                t.addCmd(dt, "misc/cgo/test", t.goTest(), "-buildmode=pie", "-ldflags=-linkmode=internal", "-tags=internal,internal_pie", ".")
@@ -1262,7 +1271,7 @@ func (t *tester) cgoTest(dt *distTest) error {
                                }
                        }
 
-                       if t.supportedBuildmode("pie") {
+                       if t.supportedBuildmode("pie") && !disablePIE {
                                t.addCmd(dt, "misc/cgo/test", t.goTest(), "-buildmode=pie", ".")
                                if t.internalLink() && t.internalLinkPIE() {
                                        t.addCmd(dt, "misc/cgo/test", t.goTest(), "-buildmode=pie", "-ldflags=-linkmode=internal", "-tags=internal,internal_pie", ".")
index a0082a31641c004a020893891a0ffa9965b9b97c..d573a7aecc84b510159d5646eaa1499765578ddf 100644 (file)
@@ -2147,6 +2147,10 @@ func TestBuildmodePIE(t *testing.T) {
        default:
                t.Skipf("skipping test because buildmode=pie is not supported on %s", platform)
        }
+       // Skip on alpine until https://go.dev/issues/54354 resolved.
+       if strings.HasSuffix(testenv.Builder(), "-alpine") {
+               t.Skip("skipping PIE tests on alpine; see https://go.dev/issues/54354")
+       }
        t.Run("non-cgo", func(t *testing.T) {
                testBuildmodePIE(t, false, true)
        })