From 210225e22d56401ece1a217183a986c2df302c3b Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Thu, 14 Apr 2005 04:32:27 +0000 Subject: Add a script based on the "menagerie-fuzz" buildbot test. Running "./tools/fuzz-test.sh /path/to/capture/files/*" will iterate over the specified capture files, using editcap to introduce errors and tethereal to check for bugs. It will do this until tethereal exits abnormally or a dissector bug is encountered. svn path=/trunk/; revision=14073 --- tools/fuzz-test.sh | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100755 tools/fuzz-test.sh (limited to 'tools') diff --git a/tools/fuzz-test.sh b/tools/fuzz-test.sh new file mode 100755 index 0000000000..76e9664fed --- /dev/null +++ b/tools/fuzz-test.sh @@ -0,0 +1,52 @@ +#!/bin/bash +# +# $Id$ + +# This needs to point to a 'date' that supports %s. +DATE=/bin/date + +# Where our temp files are saved (editcap.out and stderr.out) +TMP_DIR=/tmp + +TETHEREAL_ARGS="-nVxr" + +# These may be set to your liking +MAX_CPU_TIME=900 +ERR_PROB=0.02 + +ulimit -S -t $MAX_CPU_TIME + +echo "Running tethereal with args:" $TETHEREAL_ARGS +echo "" + +# Iterate over our capture files. +PASS=0 +while [ 1 ] ; do + PASS=`expr $PASS + 1` + echo "Pass $PASS:" + + for CF in "$@" ; do + echo -n " $CF: " + DISSECTOR_BUG=0 + ./editcap -E $ERR_PROB "$CF" $TMP_DIR/editcap.out + ./tethereal -nxVr $TMP_DIR/editcap.out \ + > /dev/null 2> $TMP_DIR/stderr.out + RETVAL=$? + grep -i "dissector bug" $TMP_DIR/stderr.out \ + > /dev/null 2>&1 && DISSECTOR_BUG=1 + if [ $RETVAL -ne 0 -o $DISSECTOR_BUG -ne 0 ] ; then + SUF=`$DATE +%s` + echo " ERROR" + echo -e "Processing failed. Capture info follows:\n" + mv $TMP_DIR/editcap.out $TMP_DIR/editcap.out.$SUF + echo " Output file: $TMP_DIR/editcap.out.$SUF" + if [ $DISSECTOR_BUG -ne 0 ] ; then + echo -e "stderr follows:\n" + cat $TMP_DIR/stderr.out + fi + exit 1 + fi + echo " OK" + done +done + -- cgit v1.2.1