Files
espeak-ng/tests/fuzzing/minimize-corpus.sh
T
1f76c4b8bd adding fuzzer for espeak_synth (#1178)
* Add: fuzzer files and modifications in config & compil
* add configure.ac change
* add minimize-corpus.sh
* add fuzzing directory and readme
* add to check if CC support libfuzzer
* Make workflow dump the crash POC
* Add debugging information
* Run fuzzing only once a week for now

Co-authored-by: kmamadoudram <kalilou.mamadou-drame@etu.u-bordeaux.fr>
Co-authored-by: yocvito <nicolas.morel@etu.u-bordeaux.fr>
Co-authored-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2022-06-30 13:06:47 +02:00

37 lines
697 B
Bash
Executable File

#!/bin/bash
if [[ $# -lt 1 ]]
then
echo "Usage: $0 <corpus-dir>"
echo "Usage: $0 --preserve-txt <corpus-dir> (minimize corpus but keep .txt files intact)"
exit 1
fi
preserve_txt=0
if [[ "$1" == "--preserve-txt" ]]
then
preserve_txt=1
CORPUS_DIR=$2
else
CORPUS_DIR=$1
fi
export FUZZ_VOICE=en
FUZZER=./synth_fuzzer
TMP_DIR=$(mktemp -d)
echo "Merging..."
`$FUZZER -merge=1 $TMP_DIR $CORPUS_DIR`
echo "Removing old files..."
if [[ $preserve_txt -eq 1 ]]
then
echo " => Preserve .txt files"
rm -rvf $(find $CORPUS_DIR | grep -vE "*.txt|$CORPUS_DIR") 2>/dev/null
else
rm -rf $CORPUS_DIR/* 2>/dev/null
fi
cp $TMP_DIR/* $CORPUS_DIR 2>/dev/null
rm -rf $TMP_DIR
echo "Merging done !"