Skip to content

Commit f84d28b

Browse files
zorrorffmbradfitz
authored andcommitted
cmd/dist: skip race detector test failure for unsupported VMA
Fixes #29948 Change-Id: I01d041655d34a5de32701dec8b360e347593a45d Reviewed-on: https://go-review.googlesource.com/c/go/+/160919 Reviewed-by: Russ Cox <[email protected]>
1 parent a21a6e4 commit f84d28b

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/cmd/dist/test.go

+20
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,13 @@ func (t *tester) runPending(nextTest *distTest) {
11031103
} else {
11041104
timelog("start", w.dt.name)
11051105
w.out, w.err = w.cmd.CombinedOutput()
1106+
if w.err != nil {
1107+
if isUnsupportedVMASize(w) {
1108+
timelog("skip", w.dt.name)
1109+
w.out = []byte(fmt.Sprintf("skipped due to unsupported VMA\n"))
1110+
w.err = nil
1111+
}
1112+
}
11061113
}
11071114
timelog("end", w.dt.name)
11081115
w.end <- true
@@ -1383,6 +1390,11 @@ func (t *tester) packageHasBenchmarks(pkg string) bool {
13831390
// raceDetectorSupported is a copy of the function
13841391
// cmd/internal/sys.RaceDetectorSupported, which can't be used here
13851392
// because cmd/dist has to be buildable by Go 1.4.
1393+
// The race detector only supports 48-bit VMA on arm64. But we don't have
1394+
// a good solution to check VMA size(See https://golang.org/issue/29948)
1395+
// raceDetectorSupported will always return true for arm64. But race
1396+
// detector tests may abort on non 48-bit VMA configuration, the tests
1397+
// will be marked as "skipped" in this case.
13861398
func raceDetectorSupported(goos, goarch string) bool {
13871399
switch goos {
13881400
case "linux":
@@ -1404,3 +1416,11 @@ func mSanSupported(goos, goarch string) bool {
14041416
return false
14051417
}
14061418
}
1419+
1420+
// isUnsupportedVMASize reports whether the failure is caused by an unsupported
1421+
// VMA for the race detector (for example, running the race detector on an
1422+
// arm64 machine configured with 39-bit VMA)
1423+
func isUnsupportedVMASize(w *work) bool {
1424+
unsupportedVMA := []byte("unsupported VMA range")
1425+
return w.dt.name == "race" && bytes.Contains(w.out, unsupportedVMA)
1426+
}

src/cmd/internal/sys/supported.go

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ package sys
66

77
// RaceDetectorSupported reports whether goos/goarch supports the race
88
// detector. There is a copy of this function in cmd/dist/test.go.
9+
// Race detector only supports 48-bit VMA on arm64. But it will always
10+
// return true for arm64, because we don't have VMA size information during
11+
// the compile time.
912
func RaceDetectorSupported(goos, goarch string) bool {
1013
switch goos {
1114
case "linux":

0 commit comments

Comments
 (0)