diff options
author | Gerald Combs <gerald@wireshark.org> | 2012-08-17 16:28:28 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2012-08-17 16:28:28 +0000 |
commit | faf3cdf75d6bad2b1701685ff7a9e9a51c6a99b8 (patch) | |
tree | a266048171cfe874191cc7453e906b85dc855383 /tools | |
parent | f5ed684cf29ddd51cc0d773492356810e66c877d (diff) |
Move error reporting to a common function. Lot information about the
most recent revision / commit.
svn path=/trunk/; revision=44552
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/fuzz-test.sh | 34 | ||||
-rwxr-xr-x | tools/randpkt-test.sh | 29 |
2 files changed, 41 insertions, 22 deletions
diff --git a/tools/fuzz-test.sh b/tools/fuzz-test.sh index 75135abe73..8bf888c958 100755 --- a/tools/fuzz-test.sh +++ b/tools/fuzz-test.sh @@ -191,6 +191,24 @@ export MallocCheckHeapAbort=1 # Call abort() if an illegal free() call is made export MallocBadFreeAbort=1 +function exit_error() { + echo -e "\n ERROR" + echo -e "Processing failed. Capture info follows:\n" + echo " Input file: $CF" + + if [ -d .svn ] ; then + echo -e "\nSubversion revision" >> $TMP_DIR/$ERR_FILE + svn log -l 1 >> $TMP_DIR/$ERR_FILE + elif [ -d .git ] ; then + echo -e "\nGit commit" >> $TMP_DIR/$ERR_FILE + svn log -l 1 >> $TMP_DIR/$ERR_FILE + fi + + echo -e "stderr follows:\n" + cat $TMP_DIR/$ERR_FILE + + exit 1 +} # Iterate over our capture files. PASS=0 @@ -220,13 +238,7 @@ while [ \( $PASS -lt $MAX_PASSES -o $MAX_PASSES -lt 1 \) -a $DONE -ne 1 ] ; do continue elif [ $RETVAL -ne 0 -a $DONE -ne 1 ] ; then # Some other error - echo "" - echo " ERROR" - echo -e "Processing failed. Capture info follows:\n" - echo " Input file: $CF" - echo -e "stderr follows:\n" - cat $TMP_DIR/$ERR_FILE - exit 1 + exit_error fi DISSECTOR_BUG=0 @@ -261,13 +273,7 @@ while [ \( $PASS -lt $MAX_PASSES -o $MAX_PASSES -lt 1 \) -a $DONE -ne 1 ] ; do if [ \( $RETVAL -ne 0 -o $DISSECTOR_BUG -ne 0 -o $VG_ERR_CNT -ne 0 \) \ -a $DONE -ne 1 ] ; then - echo "" - echo " ERROR" - echo -e "Processing failed. Capture info follows:\n" - echo " Output file: $TMP_DIR/$TMP_FILE" - echo -e "stderr follows:\n" - cat $TMP_DIR/$ERR_FILE - exit 1 + exit_error fi echo " OK" diff --git a/tools/randpkt-test.sh b/tools/randpkt-test.sh index 176e53cd7d..a241c08c37 100755 --- a/tools/randpkt-test.sh +++ b/tools/randpkt-test.sh @@ -82,6 +82,25 @@ echo "" trap "MAX_PASSES=1; echo 'Caught signal'" HUP INT TERM +function exit_error() { + echo -e "\n ERROR" + echo -e "Processing failed. Capture info follows:\n" + echo " Input file: $CF" + + if [ -d .svn ] ; then + echo -e "\nSubversion revision" >> $TMP_DIR/$ERR_FILE + svn log -l 1 >> $TMP_DIR/$ERR_FILE + elif [ -d .git ] ; then + echo -e "\nGit commit" >> $TMP_DIR/$ERR_FILE + svn log -l 1 >> $TMP_DIR/$ERR_FILE + fi + + echo -e "stderr follows:\n" + cat $TMP_DIR/$ERR_FILE + + exit 1 +} + # Iterate over our capture files. PASS=0 while [ $PASS -lt $MAX_PASSES -o $MAX_PASSES -lt 1 ] ; do @@ -104,16 +123,10 @@ while [ $PASS -lt $MAX_PASSES -o $MAX_PASSES -lt 1 ] ; do > /dev/null 2>&1 && DISSECTOR_BUG=1 if [ $RETVAL -ne 0 -o $DISSECTOR_BUG -ne 0 ] ; then RAND_FILE="randpkt-`$DATE +%Y-%m-%d`-$$.pcap" - echo "" - echo " ERROR" - echo -e "Processing failed. Capture info follows:\n" mv $TMP_DIR/$TMP_FILE $TMP_DIR/$RAND_FILE echo " Output file: $TMP_DIR/$RAND_FILE" - if [ $DISSECTOR_BUG -ne 0 ] ; then - echo -e "stderr follows:\n" - cat $TMP_DIR/$ERR_FILE - fi - exit 1 + + exit_error fi echo " OK" rm -f $TMP_DIR/$TMP_FILE $TMP_DIR/$ERR_FILE |