Skip to content

Commit 0d9ed06

Browse files
committed
test: skip -buildmode=pie tests on alpine
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 <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Cherry Mui <[email protected]>
1 parent c7942f8 commit 0d9ed06

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

misc/cgo/testshared/shared_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,9 @@ func checkPIE(t *testing.T, name string) {
528528
}
529529

530530
func TestTrivialPIE(t *testing.T) {
531+
if strings.HasSuffix(os.Getenv("GO_BUILDER_NAME"), "-alpine") {
532+
t.Skip("skipping on alpine until issue #54354 resolved")
533+
}
531534
name := "trivial_pie"
532535
goCmd(t, "build", "-buildmode=pie", "-o="+name, "./trivial")
533536
defer os.Remove(name)

src/cmd/dist/test.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -700,8 +700,12 @@ func (t *tester) registerTests() {
700700
})
701701
}
702702

703+
// Stub out following test on alpine until 54354 resolved.
704+
builderName := os.Getenv("GO_BUILDER_NAME")
705+
disablePIE := strings.HasSuffix(builderName, "-alpine")
706+
703707
// Test internal linking of PIE binaries where it is supported.
704-
if t.internalLinkPIE() {
708+
if t.internalLinkPIE() && !disablePIE {
705709
t.tests = append(t.tests, distTest{
706710
name: "pie_internal",
707711
heading: "internal linking of -buildmode=pie",
@@ -711,7 +715,7 @@ func (t *tester) registerTests() {
711715
},
712716
})
713717
// Also test a cgo package.
714-
if t.cgoEnabled && t.internalLink() {
718+
if t.cgoEnabled && t.internalLink() && !disablePIE {
715719
t.tests = append(t.tests, distTest{
716720
name: "pie_internal_cgo",
717721
heading: "internal linking of -buildmode=pie",
@@ -1188,6 +1192,10 @@ func (t *tester) cgoTest(dt *distTest) error {
11881192
cmd := t.addCmd(dt, "misc/cgo/test", t.goTest(), ".")
11891193
setEnv(cmd, "GOFLAGS", "-ldflags=-linkmode=auto")
11901194

1195+
// Stub out various buildmode=pie tests on alpine until 54354 resolved.
1196+
builderName := os.Getenv("GO_BUILDER_NAME")
1197+
disablePIE := strings.HasSuffix(builderName, "-alpine")
1198+
11911199
if t.internalLink() {
11921200
cmd := t.addCmd(dt, "misc/cgo/test", t.goTest(), "-tags=internal", ".")
11931201
setEnv(cmd, "GOFLAGS", "-ldflags=-linkmode=internal")
@@ -1206,7 +1214,8 @@ func (t *tester) cgoTest(dt *distTest) error {
12061214

12071215
t.addCmd(dt, "misc/cgo/test", t.goTest(), "-ldflags", "-linkmode=external -s", ".")
12081216

1209-
if t.supportedBuildmode("pie") {
1217+
if t.supportedBuildmode("pie") && !disablePIE {
1218+
12101219
t.addCmd(dt, "misc/cgo/test", t.goTest(), "-buildmode=pie", ".")
12111220
if t.internalLink() && t.internalLinkPIE() {
12121221
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 {
12621271
}
12631272
}
12641273

1265-
if t.supportedBuildmode("pie") {
1274+
if t.supportedBuildmode("pie") && !disablePIE {
12661275
t.addCmd(dt, "misc/cgo/test", t.goTest(), "-buildmode=pie", ".")
12671276
if t.internalLink() && t.internalLinkPIE() {
12681277
t.addCmd(dt, "misc/cgo/test", t.goTest(), "-buildmode=pie", "-ldflags=-linkmode=internal", "-tags=internal,internal_pie", ".")

src/cmd/go/go_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2147,6 +2147,10 @@ func TestBuildmodePIE(t *testing.T) {
21472147
default:
21482148
t.Skipf("skipping test because buildmode=pie is not supported on %s", platform)
21492149
}
2150+
// Skip on alpine until https://go.dev/issues/54354 resolved.
2151+
if strings.HasSuffix(testenv.Builder(), "-alpine") {
2152+
t.Skip("skipping PIE tests on alpine; see https://go.dev/issues/54354")
2153+
}
21502154
t.Run("non-cgo", func(t *testing.T) {
21512155
testBuildmodePIE(t, false, true)
21522156
})

0 commit comments

Comments
 (0)