diff options
| author | Cherry Mui <cherryyz@google.com> | 2025-12-12 22:33:57 -0500 |
|---|---|---|
| committer | David Chase <drchase@google.com> | 2025-12-13 07:51:12 -0800 |
| commit | 1b291b70dff51732415da5b68debe323704d8e8d (patch) | |
| tree | 52825a17d1e6fc8b05cc5b4976f9ed8d4955eaf1 | |
| parent | d30884ba1f798b9604fa6586c6d50ca5de8655d5 (diff) | |
| download | go-1b291b70dff51732415da5b68debe323704d8e8d.tar.xz | |
simd/archsimd: skip tests if AVX is not available
The simd operations require AVX. If AVX is not available, skip the
tests.
Change-Id: I3c384ba07e1e6c2c198dfb27bc84a2e27f825680
Reviewed-on: https://go-review.googlesource.com/c/go/+/729820
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
| -rw-r--r-- | src/simd/archsimd/internal/simd_test/simd_test.go | 10 | ||||
| -rw-r--r-- | src/simd/archsimd/pkginternal_test.go | 10 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/simd/archsimd/internal/simd_test/simd_test.go b/src/simd/archsimd/internal/simd_test/simd_test.go index 1f57f609f7..83925ae789 100644 --- a/src/simd/archsimd/internal/simd_test/simd_test.go +++ b/src/simd/archsimd/internal/simd_test/simd_test.go @@ -7,12 +7,22 @@ package simd_test import ( + "fmt" + "os" "reflect" "simd/archsimd" "slices" "testing" ) +func TestMain(m *testing.M) { + if !archsimd.X86.AVX() { + fmt.Fprintln(os.Stderr, "Skipping tests: AVX is not available") + os.Exit(0) + } + os.Exit(m.Run()) +} + var sink any func TestType(t *testing.T) { diff --git a/src/simd/archsimd/pkginternal_test.go b/src/simd/archsimd/pkginternal_test.go index a20da340af..2b9dea1374 100644 --- a/src/simd/archsimd/pkginternal_test.go +++ b/src/simd/archsimd/pkginternal_test.go @@ -7,11 +7,21 @@ package archsimd_test import ( + "fmt" + "os" "simd/archsimd" "simd/archsimd/internal/test_helpers" "testing" ) +func TestMain(m *testing.M) { + if !archsimd.X86.AVX() { + fmt.Fprintln(os.Stderr, "Skipping tests: AVX is not available") + os.Exit(0) + } + os.Exit(m.Run()) +} + func TestConcatSelectedConstant64(t *testing.T) { a := make([]int64, 2) x := archsimd.LoadInt64x2Slice([]int64{4, 5}) |
