Commit 9913a56c authored by Kamil Kisiel's avatar Kamil Kisiel Committed by GitHub

Merge pull request #66 from navytux/y/fuzz-sha1

fuzz: Export tests pickles to fuzz/corpus with stable filenames
parents 9ca4a70a 1e108391
(lp0
I1
aI2
aI3
aI01
a.
\ No newline at end of file
S'abc'
p0
.
\ No newline at end of file
S'abc'
.
\ No newline at end of file
(dp0
.
\ No newline at end of file
(a1b2d.
\ No newline at end of file
(dS'a'
S'1'
sS'b'
S'2'
s.
\ No newline at end of file
}(UaU1UbU2u.
\ No newline at end of file
(dp0
S'a'
p1
S'1'
p2
sS'b'
p3
S'2'
p4
s.
\ No newline at end of file
(UaU1d.
\ No newline at end of file
(ŒaŒ1d.
\ No newline at end of file
(UaU1UbU2d.
\ No newline at end of file
(a1b2d.
\ No newline at end of file
(dS'a'
S'1'
sS'b'
S'2'
s.
\ No newline at end of file
}(UaU1UbU2u.
\ No newline at end of file
(dp0
S'a'
p1
S'1'
p2
sS'b'
p3
S'2'
p4
s.
\ No newline at end of file
ŒfooŒbar“.
\ No newline at end of file
S'foo'
S'bar'
.
\ No newline at end of file
abcQ.
\ No newline at end of file
abcQ.
\ No newline at end of file
abc
dQ.
\ No newline at end of file
((FooQuxBarKdl.
\ No newline at end of file
((UFooUQuxUBarKdl.
\ No newline at end of file
((FooQuxBarKdl.
\ No newline at end of file
K.
\ No newline at end of file
I1
.
\ No newline at end of file
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
package ogórek package ogórek
import ( import (
"crypto/sha1"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"log" "log"
...@@ -15,16 +16,14 @@ import ( ...@@ -15,16 +16,14 @@ import (
// //
// It is triggered to be run by go:generate from ogorek_test.go . // It is triggered to be run by go:generate from ogorek_test.go .
func TestFuzzGenerate(t *testing.T) { func TestFuzzGenerate(t *testing.T) {
for i, test := range tests { for _, test := range tests {
j := 0
for _, pickle := range test.picklev { for _, pickle := range test.picklev {
if pickle.err != nil { if pickle.err != nil {
continue continue
} }
j++
err := ioutil.WriteFile( err := ioutil.WriteFile(
fmt.Sprintf("fuzz/corpus/test-%d-%d.pickle", i, j), fmt.Sprintf("fuzz/corpus/test-%x.pickle", sha1.Sum([]byte(pickle.data))),
[]byte(pickle.data), 0666) []byte(pickle.data), 0666)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment