diff options
author | Gerald Combs <gerald@wireshark.org> | 2005-04-17 18:55:42 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2005-04-17 18:55:42 +0000 |
commit | e39e982856d12ee1241cdcbd6e81709814e6919e (patch) | |
tree | 54837015ce3860b66582aade4b32559dcbeeb7be /tools/fuzz-test.sh | |
parent | 02f67fd19f4a275778c1884fcf38263b33003860 (diff) | |
download | wireshark-e39e982856d12ee1241cdcbd6e81709814e6919e.tar.gz |
Add a description and usage message. Handle invalid capture files.
svn path=/trunk/; revision=14114
Diffstat (limited to 'tools/fuzz-test.sh')
-rwxr-xr-x | tools/fuzz-test.sh | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/tools/fuzz-test.sh b/tools/fuzz-test.sh index 76e9664fed..047b9a04e6 100755 --- a/tools/fuzz-test.sh +++ b/tools/fuzz-test.sh @@ -2,6 +2,13 @@ # # $Id$ +# Fuzz-testing script for Tethereal +# +# This script uses Editcap to add random errors ("fuzz") to a set of +# capture files specified on the command line. It runs Tethereal on +# each fuzzed file and checks for errors. The files are processed +# repeatedly until an error is found. + # This needs to point to a 'date' that supports %s. DATE=/bin/date @@ -16,6 +23,21 @@ ERR_PROB=0.02 ulimit -S -t $MAX_CPU_TIME +# Make sure we have a valid test set +FOUND=0 +for CF in "$@" ; do + ./capinfos $CF > /dev/null 2>&1 && FOUND=1 +done + +if [ $FOUND -eq 0 ] ; then + cat <<FIN +Error: No valid capture files found. + +Usage: `basename $0` capture file 1 [capture file 2]... +FIN + exit 1 +fi + echo "Running tethereal with args:" $TETHEREAL_ARGS echo "" @@ -27,8 +49,21 @@ while [ 1 ] ; do for CF in "$@" ; do echo -n " $CF: " + + ./capinfos $CF > /dev/null 2>&1 + if [ $? -ne 0 ] ; then + echo "Not a valid capture file" + continue + fi + DISSECTOR_BUG=0 - ./editcap -E $ERR_PROB "$CF" $TMP_DIR/editcap.out + + ./editcap -E $ERR_PROB "$CF" $TMP_DIR/editcap.out > /dev/null 2>&1 + if [ $? -ne 0 ] ; then + echo "Invalid format for editcap" + continue + fi + ./tethereal -nxVr $TMP_DIR/editcap.out \ > /dev/null 2> $TMP_DIR/stderr.out RETVAL=$? |