mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2026-01-29 12:24:50 -05:00
Init files for fuzzing
This commit is contained in:
parent
fcd1247ec8
commit
d1c09eb558
5 changed files with 56 additions and 0 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -12,3 +12,5 @@ setup.*
|
|||
.ignore
|
||||
_opam
|
||||
*.exe
|
||||
fuzz-*-input
|
||||
fuzz-*-output
|
||||
|
|
|
|||
3
fuzz/ccsexp_parse_string_does_not_crash.ml
Normal file
3
fuzz/ccsexp_parse_string_does_not_crash.ml
Normal 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
8
fuzz/dune
Normal 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
15
fuzz/list.sh
Executable 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
28
fuzz/run.sh
Executable 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 @@
|
||||
Loading…
Add table
Reference in a new issue