aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2016-09-21 15:38:16 -0700
committerPascal Quantin <pascal.quantin@gmail.com>2016-09-24 21:04:31 +0000
commit17546ad88378fbeaad25e571e0fa35e7a5bfa622 (patch)
tree8ec6e26fd8d5a5002513fe2e27428911139d1810 /tools
parent8b047554ee93fbbf7731da371df0779acc9fc87a (diff)
Check for ASAN when fuzzing.
Try to determine if we passed -fsanitize=address to gcc or clang and adjust the ASAN variable fuzz-test.sh, randpkt-test.sh and test-captures.sh accordingly. Change-Id: I88a34828fb5875e1a74a3b180ffb3da37daac0bd Reviewed-on: https://code.wireshark.org/review/17848 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/fuzz-test.sh2
-rwxr-xr-xtools/randpkt-test.sh2
-rwxr-xr-xtools/test-captures.sh4
-rwxr-xr-xtools/test-common.sh9
4 files changed, 13 insertions, 4 deletions
diff --git a/tools/fuzz-test.sh b/tools/fuzz-test.sh
index d1ca629dd6..7c6c7b7d02 100755
--- a/tools/fuzz-test.sh
+++ b/tools/fuzz-test.sh
@@ -46,7 +46,7 @@ CONFIG_PROFILE=
VALGRIND=0
# Run under AddressSanitizer ?
-ASAN=0
+ASAN=$CONFIGURED_WITH_ASAN
# Don't skip any byte from being changed
CHANGE_OFFSET=0
diff --git a/tools/randpkt-test.sh b/tools/randpkt-test.sh
index e309b9257b..60a3b32f34 100755
--- a/tools/randpkt-test.sh
+++ b/tools/randpkt-test.sh
@@ -10,7 +10,7 @@ TEST_TYPE="randpkt"
. `dirname $0`/test-common.sh || exit 1
# Run under AddressSanitizer ?
-ASAN=0
+ASAN=$CONFIGURED_WITH_ASAN
# Trigger an abort if a dissector finds a bug.
# Uncomment to disable
diff --git a/tools/test-captures.sh b/tools/test-captures.sh
index ab82c1c96e..6cbb208665 100755
--- a/tools/test-captures.sh
+++ b/tools/test-captures.sh
@@ -31,9 +31,9 @@ TEST_TYPE="manual"
. `dirname $0`/test-common.sh || exit 1
# Run under AddressSanitizer ?
-ASAN=0
+ASAN=$CONFIGURED_WITH_ASAN
-while getopts "a:b:" OPTCHAR ; do
+while getopts "ab:" OPTCHAR ; do
case $OPTCHAR in
a) ASAN=1 ;;
b) WIRESHARK_BIN_DIR=$OPTARG ;;
diff --git a/tools/test-common.sh b/tools/test-common.sh
index 9b8cbc03fa..c3715b9f19 100755
--- a/tools/test-common.sh
+++ b/tools/test-common.sh
@@ -123,6 +123,15 @@ export MallocBadFreeAbort=1
# Address Sanitizer options
export ASAN_OPTIONS=detect_leaks=0
+# See if we were configured with gcc or clang's AddressSanitizer.
+CONFIGURED_WITH_ASAN=0
+if [ -r "$WIRESHARK_BIN_DIR/Makefile" ] ; then
+ grep -- "-fsanitize=address" "$WIRESHARK_BIN_DIR/Makefile" > /dev/null 2>&1 && CONFIGURED_WITH_ASAN=1
+elif [ -r "$WIRESHARK_BIN_DIR/../CMakeFiles/tshark.dir/flags.make" ] ; then
+ grep -- "-fsanitize=address" "$WIRESHARK_BIN_DIR/../CMakeFiles/tshark.dir/flags.make" > /dev/null 2>&1 && CONFIGURED_WITH_ASAN=1
+fi
+export CONFIGURED_WITH_ASAN
+
# Create an error report
function ws_exit_error() {
echo -e "\n ERROR"