summaryrefslogtreecommitdiff
path: root/tools/fuzz-test.sh
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2013-01-26 20:36:57 +0000
committerGerald Combs <gerald@wireshark.org>2013-01-26 20:36:57 +0000
commit3c66ac4b83bebd3d93b86074db48f6597cdb94cd (patch)
treefe534fd19064e0c800cb5862b132c1bbff19596d /tools/fuzz-test.sh
parent1cb988eb4cb6086467d344077ba9aabb0df01f8b (diff)
downloadwireshark-3c66ac4b83bebd3d93b86074db48f6597cdb94cd.tar.gz
Forward-port r47305 from trunk-1.8:
------------------------------------------------------------------------ r47305 | gerald | 2013-01-26 12:12:52 -0800 (Sat, 26 Jan 2013) | 6 lines Changed paths: M /trunk-1.8/tools/fuzz-test.sh Instead of setting resource limits on the fuzz-test.sh process itself, set limits on the TShark subprocess. This should hopefully take care of the strange fuzz failures we've seen lately. Reduce the maximum CPU time to 5 minutes while we're at it. ------------------------------------------------------------------------ svn path=/trunk/; revision=47307
Diffstat (limited to 'tools/fuzz-test.sh')
-rwxr-xr-xtools/fuzz-test.sh13
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/fuzz-test.sh b/tools/fuzz-test.sh
index 176fc40a31..059af29990 100755
--- a/tools/fuzz-test.sh
+++ b/tools/fuzz-test.sh
@@ -159,8 +159,17 @@ while [ \( $PASS -lt $MAX_PASSES -o $MAX_PASSES -lt 1 \) -a $DONE -ne 1 ] ; do
for ARGS in "${RUNNER_ARGS[@]}" ; do
echo -n "($ARGS) "
echo -e "Command and args: $RUNNER $ARGS\n" > $TMP_DIR/$ERR_FILE
- "$RUNNER" $ARGS $TMP_DIR/$TMP_FILE \
- > /dev/null 2>> $TMP_DIR/$ERR_FILE
+
+ # Run in a child process with limits, e.g. stop it if it's running
+ # longer then MAX_CPU_TIME seconds. (ulimit may not be supported
+ # well on some platforms, particularly cygwin.)
+ (
+ ulimit -S -t $MAX_CPU_TIME -v $MAX_VMEM -s $MAX_STACK
+ ulimit -c unlimited
+
+ "$RUNNER" $ARGS $TMP_DIR/$TMP_FILE \
+ > /dev/null 2>> $TMP_DIR/$ERR_FILE
+ )
RETVAL=$?
if [ $RETVAL -ne 0 ] ; then break ; fi
done