add script to automate fuzzing

This commit is contained in:
Krzysztof Kowalczyk 2018-01-30 22:55:07 -08:00
parent 9598d10343
commit 5a8bcf1386
2 changed files with 22 additions and 0 deletions

2
.gitignore vendored
View File

@ -6,3 +6,5 @@ _obj
_test*
markdown
tags
fuzz-workdir/
markdown-fuzz.zip

20
s/fuzz.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
set -u -e -o pipefail
# This runs a go-fuzz as described in:
# https://medium.com/@dgryski/go-fuzz-github-com-arolek-ase-3c74d5a3150c
# https://github.com/dvyukov/go-fuzz
go get github.com/dvyukov/go-fuzz/go-fuzz
go get github.com/dvyukov/go-fuzz/go-fuzz-build
# this step is expensive, so re-use previous runs if possible
if [ ! -f ./markdown-fuzz.zip ]; then
mkdir -p fuzz-workdir/corpus
cp testdata/*.text fuzz-workdir/corpus
echo "running go-fuzz-build, might take a while..."
go-fuzz-build github.com/gomarkdown/markdown
fi
echo "running go-fuzz"
go-fuzz -bin=./markdown-fuzz.zip -workdir=fuzz-workdir