aboutsummaryrefslogtreecommitdiffstats
path: root/tools/randpkt-test.sh
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2012-08-17 16:28:28 +0000
committerGerald Combs <gerald@wireshark.org>2012-08-17 16:28:28 +0000
commitfaf3cdf75d6bad2b1701685ff7a9e9a51c6a99b8 (patch)
treea266048171cfe874191cc7453e906b85dc855383 /tools/randpkt-test.sh
parentf5ed684cf29ddd51cc0d773492356810e66c877d (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/randpkt-test.sh')
-rwxr-xr-xtools/randpkt-test.sh29
1 files changed, 21 insertions, 8 deletions
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