Skip to content

Commit 1b291b7

Browse files
cherrymuidr2chase
authored andcommitted
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 <[email protected]> Reviewed-by: David Chase <[email protected]>
1 parent d30884b commit 1b291b7

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/simd/archsimd/internal/simd_test/simd_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,22 @@
77
package simd_test
88

99
import (
10+
"fmt"
11+
"os"
1012
"reflect"
1113
"simd/archsimd"
1214
"slices"
1315
"testing"
1416
)
1517

18+
func TestMain(m *testing.M) {
19+
if !archsimd.X86.AVX() {
20+
fmt.Fprintln(os.Stderr, "Skipping tests: AVX is not available")
21+
os.Exit(0)
22+
}
23+
os.Exit(m.Run())
24+
}
25+
1626
var sink any
1727

1828
func TestType(t *testing.T) {

src/simd/archsimd/pkginternal_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,21 @@
77
package archsimd_test
88

99
import (
10+
"fmt"
11+
"os"
1012
"simd/archsimd"
1113
"simd/archsimd/internal/test_helpers"
1214
"testing"
1315
)
1416

17+
func TestMain(m *testing.M) {
18+
if !archsimd.X86.AVX() {
19+
fmt.Fprintln(os.Stderr, "Skipping tests: AVX is not available")
20+
os.Exit(0)
21+
}
22+
os.Exit(m.Run())
23+
}
24+
1525
func TestConcatSelectedConstant64(t *testing.T) {
1626
a := make([]int64, 2)
1727
x := archsimd.LoadInt64x2Slice([]int64{4, 5})

0 commit comments

Comments
 (0)