diff options
author | Jeff Morriss <jeff.morriss@ulticom.com> | 2012-04-27 17:58:06 +0000 |
---|---|---|
committer | Jeff Morriss <jeff.morriss@ulticom.com> | 2012-04-27 17:58:06 +0000 |
commit | 642099c485bd96085a603efec282a70d382dc942 (patch) | |
tree | 124ab9984bb0ea207a60f840597badec10866ba2 /tools | |
parent | e191fe2a99c449c5a7743d53b7cd264cee304346 (diff) |
Fix r42293: Make the script actually fail when tshark fails: use a new variable to indicate when we've caught a signal rather than (re-)using MAX_PASSES.
svn path=/trunk/; revision=42295
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/fuzz-test.sh | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/tools/fuzz-test.sh b/tools/fuzz-test.sh index ab750d46ec..217670558c 100755 --- a/tools/fuzz-test.sh +++ b/tools/fuzz-test.sh @@ -28,6 +28,9 @@ ERR_FILE=$BASE_NAME.err # Loop this many times (< 1 loops forever) MAX_PASSES=0 +# Did we catch a signal? +DONE=0 + # Perform a two pass analysis on the capture file? TWO_PASS= @@ -137,7 +140,7 @@ echo "Running $TSHARK with args: $TSHARK_ARGS ($HOWMANY)" echo "" # Clean up on <ctrl>C, etc -trap "MAX_PASSES=1; echo 'Caught signal'" HUP INT TERM +trap "DONE=1; echo 'Caught signal'" HUP INT TERM ############################################################################## @@ -179,14 +182,13 @@ export MallocBadFreeAbort=1 # Iterate over our capture files. PASS=0 -while [ $PASS -lt $MAX_PASSES -o $MAX_PASSES -lt 1 ] ; do +while [ \( $PASS -lt $MAX_PASSES -o $MAX_PASSES -lt 1 \) -a $DONE -ne 1 ] ; do PASS=`expr $PASS + 1` echo "Starting pass $PASS:" RUN=0 for CF in "$@" ; do - if [ $PASS -gt $MAX_PASSES -a $MAX_PASSES -gt 1 ] - then + if [ $DONE -eq 1 ]; then break # We caught a signal fi RUN=$(( $RUN + 1 )) @@ -204,7 +206,7 @@ while [ $PASS -lt $MAX_PASSES -o $MAX_PASSES -lt 1 ] ; do echo "Not a valid capture file" rm -f $TMP_DIR/$ERR_FILE continue - elif [ $RETVAL -ne 0 ] ; then + elif [ $RETVAL -ne 0 -a $DONE -ne 1 ] ; then # Some other error echo "" echo " ERROR" @@ -234,7 +236,7 @@ while [ $PASS -lt $MAX_PASSES -o $MAX_PASSES -lt 1 ] ; do # checking. #grep -i "dissector bug" $TMP_DIR/$ERR_FILE \ # > /dev/null 2>&1 && DISSECTOR_BUG=1 - if [ \( $RETVAL -ne 0 -o $DISSECTOR_BUG -ne 0 \) -a $PASS -le $MAX_PASSES ] ; then + if [ \( $RETVAL -ne 0 -o $DISSECTOR_BUG -ne 0 \) -a $DONE -ne 1 ] ; then echo "" echo " ERROR" echo -e "Processing failed. Capture info follows:\n" |