From d6a271939f3321aad5c3c5c3a9e34641c26400d3 Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Thu, 8 Feb 2024 15:59:07 +0000 Subject: [release-branch.go1.22] cmd/cgo/internal/testsanitizers: disable location checking for clang Pending a resolution to #65606, this CL marks clang's ASAN runtime as unable to symbolize stack traces to unblock the LUCI clang builder. For #65606. For #65469. Fixes #65641. Change-Id: I649773085aff30e5703e7f7ac2c72a0430a015c2 Cq-Include-Trybots: luci.golang.try:go1.22-linux-amd64-clang15 Reviewed-on: https://go-review.googlesource.com/c/go/+/562675 Reviewed-by: Dmitri Shuralyov Reviewed-by: Dmitri Shuralyov LUCI-TryBot-Result: Go LUCI (cherry picked from commit d94ab597af9b3f8e8ba371023314d80f6b3be5a5) Reviewed-on: https://go-review.googlesource.com/c/go/+/563015 --- src/cmd/cgo/internal/testsanitizers/cc_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/cmd/cgo/internal/testsanitizers/cc_test.go b/src/cmd/cgo/internal/testsanitizers/cc_test.go index e212a4fd98..e650de835a 100644 --- a/src/cmd/cgo/internal/testsanitizers/cc_test.go +++ b/src/cmd/cgo/internal/testsanitizers/cc_test.go @@ -16,8 +16,10 @@ import ( "encoding/json" "errors" "fmt" + "internal/testenv" "os" "os/exec" + "os/user" "path/filepath" "regexp" "strconv" @@ -266,12 +268,28 @@ func compilerSupportsLocation() bool { case "gcc": return compiler.major >= 10 case "clang": + // TODO(65606): The clang toolchain on the LUCI builders is not built against + // zlib, the ASAN runtime can't actually symbolize its own stack trace. Once + // this is resolved, one way or another, switch this back to 'true'. We still + // have coverage from the 'gcc' case above. + if inLUCIBuild() { + return false + } return true default: return false } } +// inLUCIBuild returns true if we're currently executing in a LUCI build. +func inLUCIBuild() bool { + u, err := user.Current() + if err != nil { + return false + } + return testenv.Builder() != "" && u.Username == "swarming" +} + // compilerRequiredTsanVersion reports whether the compiler is the version required by Tsan. // Only restrictions for ppc64le are known; otherwise return true. func compilerRequiredTsanVersion(goos, goarch string) bool { -- cgit v1.2.3-54-g00ecf