Source File
implementations.go
Belonging Package
crypto/internal/cryptotest
// Copyright 2024 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package cryptotest
import (
)
// TestAllImplementations runs the provided test function with each available
// implementation of the package registered with crypto/internal/impl. If there
// are no alternative implementations for pkg, f is invoked directly once.
func ( *testing.T, string, func( *testing.T)) {
// BoringCrypto bypasses the multiple Go implementations.
if boring.Enabled {
()
return
}
:= impl.List()
if len() == 0 {
()
return
}
.Cleanup(func() { impl.Reset() })
for , := range {
if := impl.Select(, ); {
.Run(, )
} else {
.Run(, func( *testing.T) {
// Report an error if we're on the most capable builder for the
// architecture and the builder can't test this implementation.
:= goos.GOOS == "linux" && goarch.GOARCH != "arm64" ||
goos.GOOS == "darwin" && goarch.GOARCH == "arm64"
if testenv.Builder() != "" && {
if == "SHA-NI" {
.Skip("known issue, see golang.org/issue/69592")
}
.Error("builder doesn't support CPU features needed to test this implementation")
} else {
.Skip("implementation not supported")
}
})
}
}
// Test the generic implementation.
impl.Select(, "")
.Run("Base", )
}
![]() |
The pages are generated with Golds v0.7.7-preview. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |