Commit 7fc82104 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

cmd/go, cmd/dist: temporarily disable race and PIE internal link tests on Alpine

In an effort to at least understand the complete set of things not
working on Alpine Linux, I've been trying to get the build passing
again, even with tests disabled.

The race detector is broken on Alpine. That is #14481 (and #9918).
So disable those tests for now.

Also, internal linking with PIE doesn't work on Alpine yet.
That is #18243. So disable that test for now.

With this CL, all.bash almost passes. There's some cgo test failing
still, but there's no bug yet, so that can be a separate CL.

Change-Id: I3ffbb0e787ed54cb82f298b6bd5bf3ccfbc82622
Reviewed-on: https://go-review.googlesource.com/41678
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent b692e749
...@@ -15,6 +15,7 @@ import ( ...@@ -15,6 +15,7 @@ import (
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"regexp" "regexp"
"runtime"
"strconv" "strconv"
"strings" "strings"
"sync" "sync"
...@@ -465,7 +466,10 @@ func (t *tester) registerTests() { ...@@ -465,7 +466,10 @@ func (t *tester) registerTests() {
} }
// Test internal linking of PIE binaries where it is supported. // Test internal linking of PIE binaries where it is supported.
if t.goos == "linux" && t.goarch == "amd64" { if t.goos == "linux" && t.goarch == "amd64" && !isAlpineLinux() {
// Issue 18243: We don't have a way to set the default
// dynamic linker used in internal linking mode. So
// this test is skipped on Alpine.
t.tests = append(t.tests, distTest{ t.tests = append(t.tests, distTest{
name: "pie_internal", name: "pie_internal",
heading: "internal linking of -buildmode=pie", heading: "internal linking of -buildmode=pie",
...@@ -1083,11 +1087,21 @@ func (t *tester) hasBash() bool { ...@@ -1083,11 +1087,21 @@ func (t *tester) hasBash() bool {
func (t *tester) raceDetectorSupported() bool { func (t *tester) raceDetectorSupported() bool {
switch t.gohostos { switch t.gohostos {
case "linux", "darwin", "freebsd", "windows": case "linux", "darwin", "freebsd", "windows":
return t.cgoEnabled && t.goarch == "amd64" && t.gohostos == t.goos // The race detector doesn't work on Alpine Linux:
// golang.org/issue/14481
return t.cgoEnabled && t.goarch == "amd64" && t.gohostos == t.goos && !isAlpineLinux()
} }
return false return false
} }
func isAlpineLinux() bool {
if runtime.GOOS != "linux" {
return false
}
fi, err := os.Lstat("/etc/alpine-release")
return err == nil && fi.Mode().IsRegular()
}
func (t *tester) runFlag(rx string) string { func (t *tester) runFlag(rx string) string {
if t.compileOnly { if t.compileOnly {
return "-run=^$" return "-run=^$"
......
...@@ -7,7 +7,6 @@ package main_test ...@@ -7,7 +7,6 @@ package main_test
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"go/build"
"go/format" "go/format"
"internal/race" "internal/race"
"internal/testenv" "internal/testenv"
...@@ -100,7 +99,9 @@ func TestMain(m *testing.M) { ...@@ -100,7 +99,9 @@ func TestMain(m *testing.M) {
switch runtime.GOOS { switch runtime.GOOS {
case "linux", "darwin", "freebsd", "windows": case "linux", "darwin", "freebsd", "windows":
canRace = canCgo && runtime.GOARCH == "amd64" // The race detector doesn't work on Alpine Linux:
// golang.org/issue/14481
canRace = canCgo && runtime.GOARCH == "amd64" && !isAlpineLinux()
} }
} }
...@@ -125,6 +126,14 @@ func TestMain(m *testing.M) { ...@@ -125,6 +126,14 @@ func TestMain(m *testing.M) {
os.Exit(r) os.Exit(r)
} }
func isAlpineLinux() bool {
if runtime.GOOS != "linux" {
return false
}
fi, err := os.Lstat("/etc/alpine-release")
return err == nil && fi.Mode().IsRegular()
}
// The length of an mtime tick on this system. This is an estimate of // The length of an mtime tick on this system. This is an estimate of
// how long we need to sleep to ensure that the mtime of two files is // how long we need to sleep to ensure that the mtime of two files is
// different. // different.
...@@ -3037,15 +3046,8 @@ func TestGoInstallPkgdir(t *testing.T) { ...@@ -3037,15 +3046,8 @@ func TestGoInstallPkgdir(t *testing.T) {
} }
func TestGoTestRaceInstallCgo(t *testing.T) { func TestGoTestRaceInstallCgo(t *testing.T) {
switch sys := runtime.GOOS + "/" + runtime.GOARCH; sys { if !canRace {
case "darwin/amd64", "freebsd/amd64", "linux/amd64", "windows/amd64": t.Skip("skipping because race detector not supported")
// ok
default:
t.Skip("no race detector on %s", sys)
}
if !build.Default.CgoEnabled {
t.Skip("no race detector without cgo")
} }
// golang.org/issue/10500. // golang.org/issue/10500.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment