From b9e2977f1d62bba2df652a3b57b4fdd15a756601 Mon Sep 17 00:00:00 2001 From: Filippo Valsorda Date: Fri, 8 Aug 2025 00:16:27 +0200 Subject: [PATCH] crypto/internal/cryptotest: use linux-amd64_avx512 builder for SHA-NI Updates #74772 Fixes #69592 Change-Id: I6a6a69647ab1785ed953f3ed2dfa04cd55576f2b Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64_avx512 Reviewed-on: https://go-review.googlesource.com/c/go/+/701315 Reviewed-by: Daniel McCarney Reviewed-by: Mark Freeman Auto-Submit: Filippo Valsorda LUCI-TryBot-Result: Go LUCI Reviewed-by: Michael Knyszek --- .../internal/cryptotest/implementations.go | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/crypto/internal/cryptotest/implementations.go b/src/crypto/internal/cryptotest/implementations.go index f0ba665403..2b6cf4b75f 100644 --- a/src/crypto/internal/cryptotest/implementations.go +++ b/src/crypto/internal/cryptotest/implementations.go @@ -10,6 +10,7 @@ import ( "internal/goarch" "internal/goos" "internal/testenv" + "strings" "testing" ) @@ -38,22 +39,33 @@ func TestAllImplementations(t *testing.T, pkg string, f func(t *testing.T)) { t.Run(name, func(t *testing.T) { // Report an error if we're on the most capable builder for the // architecture and the builder can't test this implementation. - flagship := goos.GOOS == "linux" && goarch.GOARCH != "arm64" || - goos.GOOS == "darwin" && goarch.GOARCH == "arm64" - if testenv.Builder() != "" && flagship { - if name == "SHA-NI" { - t.Skip("known issue, see golang.org/issue/69592") - } + if flagshipBuilder() { t.Error("builder doesn't support CPU features needed to test this implementation") } else { t.Skip("implementation not supported") } }) } - } // Test the generic implementation. impl.Select(pkg, "") t.Run("Base", f) } + +func flagshipBuilder() bool { + builder := testenv.Builder() + if builder == "" { + return false + } + switch goarch.GOARCH { + case "amd64": + return strings.Contains(builder, "_avx512") + case "arm64": + // Apple M chips support everything we use. + return goos.GOOS == "darwin" + default: + // Presumably the Linux builders are the most capable. + return goos.GOOS == "linux" + } +} -- 2.52.0