Init files for fuzzing

This commit is contained in:
Darren Ldl 2020-12-08 17:18:00 +11:00
parent fcd1247ec8
commit d1c09eb558
5 changed files with 56 additions and 0 deletions

2
.gitignore vendored
View file

@ -12,3 +12,5 @@ setup.*
.ignore
_opam
*.exe
fuzz-*-input
fuzz-*-output

View file

@ -0,0 +1,3 @@
let () =
Crowbar.add_test ~name:"ccsexp_parse_string_does_not_crash" [ Crowbar.bytes ]
(fun s -> CCSexp.parse_string s |> ignore)

8
fuzz/dune Normal file
View file

@ -0,0 +1,8 @@
(executables
(flags (-w "+a-4-9-29-37-40-42-44-48-50-32" -g))
(names ccsexp_parse_string_does_not_crash
)
(libraries crowbar
containers
)
)

15
fuzz/list.sh Executable file
View file

@ -0,0 +1,15 @@
#!/bin/bash
script_dir=$(dirname $(readlink -f "$0"))
echo "Building"
dune build @all
echo ""
echo "Fuzzing tests available:"
for file in "$script_dir"/../_build/default/fuzz/*.exe; do
echo "- "$(basename $file | sed 's/\.exe$//')
done

28
fuzz/run.sh Executable file
View file

@ -0,0 +1,28 @@
#!/bin/bash
script_dir=$(dirname $(readlink -f "$0"))
echo "Building"
dune build @all
if [[ "$1" == "" ]]; then
echo "Please enter a fuzzing test to run"
exit 1
fi
name=$(echo "$1" | sed 's/\.exe$//')
echo "Creating input directory"
input_dir="fuzz-""$name""-input"
output_dir="fuzz-""$name""-output"
mkdir -p "$input_dir"
echo "abcd" > "$input_dir"/dummy
mkdir -p "$output_dir"
afl-fuzz -t 1000 -i "$input_dir" -o "$output_dir" "$script_dir"/../_build/default/fuzz/"$name".exe @@