1- //+build !noasm
2- //+build !appengine
3- //+build gc
1+ //go:build !noasm && !appengine && gc
2+ // +build !noasm,!appengine,gc
43
54/*
65 * MinIO Cloud Storage, (C) 2020 MinIO, Inc.
@@ -31,7 +30,9 @@ import (
3130)
3231
3332func TestFinalizeStructurals (t * testing.T ) {
34-
33+ if ! SupportedCPU () {
34+ t .SkipNow ()
35+ }
3536 testCases := []struct {
3637 structurals uint64
3738 whitespace uint64
@@ -92,6 +93,9 @@ func testFindNewlineDelimiters(t *testing.T, f func([]byte, uint64) uint64) {
9293}
9394
9495func TestFindNewlineDelimiters (t * testing.T ) {
96+ if ! SupportedCPU () {
97+ t .SkipNow ()
98+ }
9599 t .Run ("avx2" , func (t * testing.T ) {
96100 testFindNewlineDelimiters (t , _find_newline_delimiters )
97101 })
@@ -103,7 +107,9 @@ func TestFindNewlineDelimiters(t *testing.T) {
103107}
104108
105109func testExcludeNewlineDelimitersWithinQuotes (t * testing.T , f func ([]byte , uint64 ) uint64 ) {
106-
110+ if ! SupportedCPU () {
111+ t .SkipNow ()
112+ }
107113 input := []byte (` "-------------------------------------" ` )
108114 input [10 ] = 0x0a // within quoted string, so should be ignored
109115 input [50 ] = 0x0a // outside quoted string, so should be found
@@ -122,6 +128,9 @@ func testExcludeNewlineDelimitersWithinQuotes(t *testing.T, f func([]byte, uint6
122128}
123129
124130func TestExcludeNewlineDelimitersWithinQuotes (t * testing.T ) {
131+ if ! SupportedCPU () {
132+ t .SkipNow ()
133+ }
125134 t .Run ("avx2" , func (t * testing.T ) {
126135 testExcludeNewlineDelimitersWithinQuotes (t , _find_newline_delimiters )
127136 })
@@ -190,6 +199,9 @@ func testFindOddBackslashSequences(t *testing.T, f func([]byte, *uint64) uint64)
190199}
191200
192201func TestFindOddBackslashSequences (t * testing.T ) {
202+ if ! SupportedCPU () {
203+ t .SkipNow ()
204+ }
193205 t .Run ("avx2" , func (t * testing.T ) {
194206 testFindOddBackslashSequences (t , find_odd_backslash_sequences )
195207 })
@@ -291,6 +303,9 @@ func testFindQuoteMaskAndBits(t *testing.T, f func([]byte, uint64, *uint64, *uin
291303}
292304
293305func TestFindQuoteMaskAndBits (t * testing.T ) {
306+ if ! SupportedCPU () {
307+ t .SkipNow ()
308+ }
294309 t .Run ("avx2" , func (t * testing.T ) {
295310 testFindQuoteMaskAndBits (t , find_quote_mask_and_bits )
296311 })
@@ -346,6 +361,9 @@ func testFindStructuralBits(t *testing.T, f func([]byte, *uint64, *uint64, *uint
346361}
347362
348363func TestFindStructuralBits (t * testing.T ) {
364+ if ! SupportedCPU () {
365+ t .SkipNow ()
366+ }
349367 t .Run ("avx2" , func (t * testing.T ) {
350368 testFindStructuralBits (t , find_structural_bits )
351369 })
@@ -404,6 +422,9 @@ func testFindStructuralBitsWhitespacePadding(t *testing.T, f func([]byte, *uint6
404422}
405423
406424func TestFindStructuralBitsWhitespacePadding (t * testing.T ) {
425+ if ! SupportedCPU () {
426+ t .SkipNow ()
427+ }
407428 t .Run ("avx2" , func (t * testing.T ) {
408429 testFindStructuralBitsWhitespacePadding (t , find_structural_bits_in_slice )
409430 })
@@ -459,6 +480,9 @@ func testFindStructuralBitsLoop(t *testing.T, f func([]byte, *uint64, *uint64, *
459480}
460481
461482func TestFindStructuralBitsLoop (t * testing.T ) {
483+ if ! SupportedCPU () {
484+ t .SkipNow ()
485+ }
462486 t .Run ("avx2" , func (t * testing.T ) {
463487 testFindStructuralBitsLoop (t , find_structural_bits_in_slice )
464488 })
@@ -491,6 +515,9 @@ func benchmarkFindStructuralBits(b *testing.B, f func([]byte, *uint64, *uint64,
491515}
492516
493517func BenchmarkFindStructuralBits (b * testing.B ) {
518+ if ! SupportedCPU () {
519+ b .SkipNow ()
520+ }
494521 b .Run ("avx2" , func (b * testing.B ) {
495522 benchmarkFindStructuralBits (b , find_structural_bits )
496523 })
@@ -531,6 +558,9 @@ func benchmarkFindStructuralBitsLoop(b *testing.B, f func([]byte, *uint64, *uint
531558}
532559
533560func BenchmarkFindStructuralBitsLoop (b * testing.B ) {
561+ if ! SupportedCPU () {
562+ b .SkipNow ()
563+ }
534564 b .Run ("avx2" , func (b * testing.B ) {
535565 benchmarkFindStructuralBitsLoop (b , find_structural_bits_in_slice )
536566 })
@@ -578,6 +608,10 @@ func benchmarkFindStructuralBitsParallelLoop(b *testing.B, f func([]byte, *uint6
578608}
579609
580610func BenchmarkFindStructuralBitsParallelLoop (b * testing.B ) {
611+ if ! SupportedCPU () {
612+ b .SkipNow ()
613+ }
614+
581615 b .Run ("avx2" , func (b * testing.B ) {
582616 benchmarkFindStructuralBitsParallelLoop (b , find_structural_bits_in_slice )
583617 })
@@ -655,6 +689,10 @@ func testFindWhitespaceAndStructurals(t *testing.T, f func([]byte, *uint64, *uin
655689}
656690
657691func TestFindWhitespaceAndStructurals (t * testing.T ) {
692+ if ! SupportedCPU () {
693+ t .SkipNow ()
694+ }
695+
658696 t .Run ("avx2" , func (t * testing.T ) {
659697 testFindWhitespaceAndStructurals (t , find_whitespace_and_structurals )
660698 })
@@ -666,6 +704,9 @@ func TestFindWhitespaceAndStructurals(t *testing.T) {
666704}
667705
668706func TestFlattenBitsIncremental (t * testing.T ) {
707+ if ! SupportedCPU () {
708+ t .SkipNow ()
709+ }
669710
670711 testCases := []struct {
671712 masks []uint64
@@ -732,6 +773,9 @@ func TestFlattenBitsIncremental(t *testing.T) {
732773}
733774
734775func BenchmarkFlattenBits (b * testing.B ) {
776+ if ! SupportedCPU () {
777+ b .SkipNow ()
778+ }
735779
736780 msg := loadCompressed (b , "twitter" )
737781
0 commit comments