File tree 1 file changed +10
-4
lines changed
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -67,10 +67,16 @@ func TestLargeXXHash(t *testing.T) {
67
67
}
68
68
}
69
69
70
- func FuzzXXHash (f * testing.F ) {
71
- if _ , err := os .Stat ("/usr/bin/xxhsum" ); err != nil {
72
- f .Skip ("skipping because /usr/bin/xxhsum does not exist" )
70
+ func findXxhsum (t testing.TB ) string {
71
+ xxhsum , err := exec .LookPath ("xxhsum" )
72
+ if err != nil {
73
+ t .Skip ("skipping because xxhsum not found" )
73
74
}
75
+ return xxhsum
76
+ }
77
+
78
+ func FuzzXXHash (f * testing.F ) {
79
+ xxhsum := findXxhsum (f )
74
80
75
81
for _ , test := range xxHashTests {
76
82
f .Add ([]byte (test .data ))
@@ -84,7 +90,7 @@ func FuzzXXHash(f *testing.F) {
84
90
f .Add (bigData (f ))
85
91
86
92
f .Fuzz (func (t * testing.T , b []byte ) {
87
- cmd := exec .Command ("/usr/bin/ xxhsum" , "-H64" )
93
+ cmd := exec .Command (xxhsum , "-H64" )
88
94
cmd .Stdin = bytes .NewReader (b )
89
95
var hhsumHash bytes.Buffer
90
96
cmd .Stdout = & hhsumHash
You can’t perform that action at this time.
0 commit comments