Created
August 1, 2016 05:19
-
-
Save eriknyquist/a3b9eb640eb204fec8ae4ed87e62ec0d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Number of data sets in generated Decathlon.dat; | |
# 1,000,000 is usually ~500MB | |
num_sets=1000000 | |
github="https://github.com" | |
rxvm="eriknyquist/regexvm" | |
fuzz="eriknyquist/ibm2016fuzz" | |
fuzzer="ibm2016fuzz/gen_decathlon_input" | |
rxvm_inc="/usr/local/include/librxvm" | |
rxvm_lib="/usr/local/lib/librxvm.a" | |
input="Decathlon.dat" | |
sub="Decathlon.py" | |
output="Decathlon.out" | |
install_rxvm () { | |
clone=$(basename $rxvm) | |
echo "" | |
echo "installing librxvm..." | |
[ -d $clone ] || git clone $github/$rxvm || exit 1 | |
cd $clone | |
./autogen.sh | |
./configure | |
sudo make clean install | |
cd .. | |
} | |
install_fuzzer () { | |
clone=$(basename $fuzz) | |
echo "" | |
echo "installing fuzzer..." | |
[ -d $clone ] || git clone $github/$fuzz || exit 1 | |
cd $clone | |
make clean all | |
cd .. | |
} | |
wait_file () { | |
file=$1 | |
pid=$2 | |
while [ 1 ] | |
do | |
size=$(du -h $file | awk '{print $1}') | |
echo -en "\r$file: $size " | |
sleep 0.2 | |
if ! kill -0 $pid 2> /dev/null; then break; fi; | |
done | |
} | |
if [ ! -f $sub ] | |
then | |
echo "" | |
echo "Test subject '$sub' not found. Place it your current directory." | |
exit 1 | |
fi | |
if [ ! -f $rxvm_lib ] || [ ! -d $rxvm_inc ] | |
then | |
install_rxvm | |
fi | |
if [ ! -f $fuzzer ] | |
then | |
install_fuzzer | |
fi | |
if [ ! -f $input ] | |
then | |
echo "" | |
echo "Generating $input..." | |
$fuzzer $num_sets > $input & pid=$! | |
wait_file $input $pid | |
fi | |
echo -e "\n\nRunning $sub..." | |
time python $sub & pid=$! | |
sleep 0.5 | |
wait_file $output $pid |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment