Skip to content

Commit

Permalink
Fuzzer - fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RoelVdP committed Feb 6, 2018
1 parent 0e1178d commit cf406c7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
30 changes: 20 additions & 10 deletions fuzzer-run.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ DICTIONARY=${SCRIPT_PWD}/mysql-dictionary.fuzz
BASE_BIN="$(echo "${BASEDIR}/bin/mysql_embedded")" # Only use the embedded server, or a setup where client+server are integrated into one binary, compiled/instrumented with afl-gcc or afl-g++ (instrumentation wrappers for gcc/g++)

exit_help(){
echo "This script expects one startup option: M or S (Master or Slaves) as the first option. Also remember to set BASEDIR etc. variables inside the script."
echo "This script expects one startup option: M or S (Master or Slaves) as the first option."
echo "Also remember to set BASEDIR etc. variables inside the script."
echo "Note that it is recommended to run M (Master) in a seperate terminal from S (Slaves), allowing better output analysis."
echo "Warning: running this script will remove ALL data directories in BASEDIR!"
echo "Terminating."; exit 1
Expand All @@ -28,23 +29,32 @@ if [ "${1}" == "" ]; then
exit_help
elif [ "${1}" != "M" -a "${1}" != "S" ]; then
exit_help
elif [ "${1}" == "M" ]; then
cd /sys/devices/system/cpu
sudo echo performance | sudo tee cpu*/cpufreq/scaling_governor
fi
cd ${BASEDIR}
if [ "${PWD}" != "${BASEDIR}" ]; then
echo 'Safety assert: $PWD!=$BASEDIR, please check your BASEDIR path. Tip; avoid double and traling slashe(s).'
echo "${PWD}!=${BASEDIR}"
fi
if [ ! -d in ]; then
echo "Please create your in directory with a starting testcase, for example ./in/start.sql"
echo "Terminating."; exit 1
fi
if [ ! -d out ]; then
mkdir out
else
echo "Found existing 'out' directory - please ensure that this is what you want; re-use data from a previous run. Sleeping 5 seconds"
sleep 5
elif [ "${1}" == "M" ]; then
echo "(!) Found existing 'out' directory - please ensure that this is what you want; re-use data from a previous run. Sleeping 10 seconds"
sleep 10
fi
if [ "${1}" == "M" ]; then
killall afl-fuzz 2>/dev/null
rm -Rf afldata* data_TEMPLATE data fuzzer*
${SCRIPT_PWD}/startup.sh
./all_no_cl
mv data data_TEMPLATE
fi
killall afl-fuzz
rm -Rf afldata* data_TEMPLATE data fuzzer*
${SCRIPT_PWD}/startup.sh
./all
mv data data_TEMPLATE

# TERMINAL 1 (master)
if [ "${1}" == "M" ]; then
Expand All @@ -64,7 +74,7 @@ if [ "${1}" == "S" ]; then
done
# Cleanup screen in background (can be done manually as well, all processes are in background
clear; sleep 2; clear
$(sleep 60; echo "clear)" &
$(sleep 60; echo "clear)") &
$(sleep 120; echo "clear") &
$(sleep 180; echo "clear") &
$(sleep 240; echo "clear") &
Expand Down
2 changes: 1 addition & 1 deletion startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ echo "rm -f log/master.*" >> init
echo 'MYEXTRA_OPT="$*"' > all
echo "./stop >/dev/null 2>&1;rm -f socket.sock socket.sock.lock;./wipe \${MYEXTRA_OPT};./start \${MYEXTRA_OPT};./cl" >> all
echo 'MYEXTRA_OPT="$*"' > all_no_cl
echo "./stop >/dev/null 2>&1;./wipe \${MYEXTRA_OPT};./start \${MYEXTRA_OPT}" >> all_no_cl
echo "./stop >/dev/null 2>&1;rm -f socket.sock socket.sock.lock;./wipe \${MYEXTRA_OPT};./start \${MYEXTRA_OPT}" >> all_no_cl
chmod +x start start_valgrind start_gypsy stop setup cl cl_noprompt cl_noprompt_nobinary test kill init wipe all all_no_cl prepare run measure gdb myrocks_tokudb_init pmm_os_agent pmm-mysql-agent repl_setup 2>/dev/null
echo "Setting up server with default directories"
./stop >/dev/null 2>&1
Expand Down

0 comments on commit cf406c7

Please sign in to comment.