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 <daniel@binaryparadox.net>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
Filippo Valsorda 2025-08-08 00:16:27 +02:00 committed by Gopher Robot
parent 8105d0ccc2
commit b9e2977f1d

View file

@ -10,6 +10,7 @@ import (
"internal/goarch" "internal/goarch"
"internal/goos" "internal/goos"
"internal/testenv" "internal/testenv"
"strings"
"testing" "testing"
) )
@ -38,22 +39,33 @@ func TestAllImplementations(t *testing.T, pkg string, f func(t *testing.T)) {
t.Run(name, func(t *testing.T) { t.Run(name, func(t *testing.T) {
// Report an error if we're on the most capable builder for the // Report an error if we're on the most capable builder for the
// architecture and the builder can't test this implementation. // architecture and the builder can't test this implementation.
flagship := goos.GOOS == "linux" && goarch.GOARCH != "arm64" || if flagshipBuilder() {
goos.GOOS == "darwin" && goarch.GOARCH == "arm64"
if testenv.Builder() != "" && flagship {
if name == "SHA-NI" {
t.Skip("known issue, see golang.org/issue/69592")
}
t.Error("builder doesn't support CPU features needed to test this implementation") t.Error("builder doesn't support CPU features needed to test this implementation")
} else { } else {
t.Skip("implementation not supported") t.Skip("implementation not supported")
} }
}) })
} }
} }
// Test the generic implementation. // Test the generic implementation.
impl.Select(pkg, "") impl.Select(pkg, "")
t.Run("Base", f) 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"
}
}