aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2016-09-11 12:08:45 -0700
committerGuy Harris <guy@alum.mit.edu>2016-09-11 19:09:24 +0000
commit11d3a0f963e5bd7426c6b29f1e6520420299559f (patch)
treec2896ca6abf16e38d2c957ddf660b8f87190636b /tools
parent9360f419590831a7d7d3f6889b717ed36a1e4de9 (diff)
Add a -a flag to specify running under ASan, and don't set ulimit -v if so.
You can't run ASan-built programs with a ulimit, as ASan allocates a huge amount of shadow memory. Change-Id: Ic4d3c2fae77719f65d4594774bc8aa92d2a3a035 Ping-Bug: 12797 Reviewed-on: https://code.wireshark.org/review/17645 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/randpkt-test.sh22
1 files changed, 20 insertions, 2 deletions
diff --git a/tools/randpkt-test.sh b/tools/randpkt-test.sh
index 3928e704d1..3cf3938af0 100755
--- a/tools/randpkt-test.sh
+++ b/tools/randpkt-test.sh
@@ -9,13 +9,17 @@
TEST_TYPE="randpkt"
. `dirname $0`/test-common.sh || exit 1
+# Run under AddressSanitizer ?
+ASAN=0
+
# Trigger an abort if a dissector finds a bug.
# Uncomment to disable
WIRESHARK_ABORT_ON_DISSECTOR_BUG="True"
# To do: add options for file names and limits
-while getopts ":b:d:p:t:" OPTCHAR ; do
+while getopts "a:b:d:p:t:" OPTCHAR ; do
case $OPTCHAR in
+ a) ASAN=1 ;;
b) WIRESHARK_BIN_DIR=$OPTARG ;;
d) TMP_DIR=$OPTARG ;;
p) MAX_PASSES=$OPTARG ;;
@@ -39,6 +43,13 @@ ws_check_exec "$TSHARK" "$RANDPKT" "$DATE" "$TMP_DIR"
declare -a TSHARK_ARGS=("-nVxr" "-nr")
RANDPKT_ARGS="-b 2000 -c 5000"
+if [ $ASAN -ne 0 ]; then
+ echo -n "ASan enabled. Virtual memory limit is "
+ ulimit -v
+else
+ echo "ASan disabled. Virtual memory limit is $MAX_VMEM"
+fi
+
HOWMANY="forever"
if [ $MAX_PASSES -gt 0 ]; then
HOWMANY="$MAX_PASSES passes"
@@ -77,8 +88,15 @@ while [ $PASS -lt $MAX_PASSES -o $MAX_PASSES -lt 1 ] ; do
# 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 -S -t $MAX_CPU_TIME -s $MAX_STACK
ulimit -c unlimited
+
+ # Don't enable ulimit -v when using ASAN. See
+ # https://github.com/google/sanitizers/wiki/AddressSanitizer#ulimit--v
+ if [ $ASAN -eq 0 ]; then
+ ulimit -v $MAX_VMEM
+ fi
+
"$TSHARK" $ARGS $TMP_DIR/$TMP_FILE \
> /dev/null 2>> $TMP_DIR/$ERR_FILE
)