ThreadSanitizer and Dr Memory for Windows
Added new wrapper script webrtc_tests.bat for executing memory/threading tests on Windows. Updated webrtc_tests.sh to include modifications in chrome_tests.sh that has happened since we copied it. To setup TSAN for Windows, see http://www.chromium.org/developers/how-tos/using-valgrind/threadsanitizer I did like this: 1. Added "third_party/tsan": "http://src.chromium.org/chrome/trunk/deps/third_party/tsan" to custom_deps in my .gclient file 2. gclient sync 3. SET GYP_DEFINES=build_with_tool=tsan && gclient runhooks 4. Compiled. 5. Ran the test using the wrapper script (see below). To setup Dr Memory for Windows, see http://www.chromium.org/developers/how-tos/using-drmemory I did like this: 1. Added "third_party/drmemory": "http://src.chromium.org/svn/trunk/deps/third_party/drmemory", to custom_deps in my .gclient file (using the drmemory.DEPS as described on Chromium's wiki ends up in the wrong location) 2. gclient sync 3. SET GYP_DEFINES=build_with_tool=drmemory && gclient runhooks 4. Compiled. 5. Ran the test using the wrapper script (see below). TEST= On Windows: tools\valgrind-webrtc\webrtc_tests.bat --tool=tsan --test build\Debug\voice_engine_unittests.exe tools\valgrind-webrtc\webrtc_tests.bat --tool=drmemory_light --test build\Debug\voice_engine_unittests.exe tools\valgrind-webrtc\webrtc_tests.bat --tool=drmemory_full --test build\Debug\voice_engine_unittests.exe On Linux: tools/valgrind-webrtc/webrtc_tests.sh --tool=memcheck --test out/Release/test_support_unittests tools/valgrind-webrtc/webrtc_tests.sh --tool=tsan --test out/Release/test_support_unittests tools/valgrind-webrtc/webrtc_tests.sh --tool=asan --test out/Release/test_support_unittests Review URL: https://webrtc-codereview.appspot.com/845004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2846 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -22,9 +22,9 @@ export THISDIR=`dirname $0`
|
||||
ARGV_COPY="$@"
|
||||
|
||||
# We need to set CHROME_VALGRIND iff using Memcheck or TSan-Valgrind:
|
||||
# tools/valgrind/chrome_tests.sh --tool memcheck
|
||||
# tools/valgrind-webrtc/webrtc_tests.sh --tool memcheck
|
||||
# or
|
||||
# tools/valgrind/chrome_tests.sh --tool=memcheck
|
||||
# tools/valgrind-webrtc/webrtc_tests.sh --tool=memcheck
|
||||
# (same for "--tool=tsan")
|
||||
tool="memcheck" # Default to memcheck.
|
||||
while (( "$#" ))
|
||||
@ -48,9 +48,14 @@ case "$tool" in
|
||||
NEEDS_VALGRIND=1
|
||||
;;
|
||||
"tsan" | "tsan_rv")
|
||||
NEEDS_VALGRIND=1
|
||||
if [ "`uname -s`" == CYGWIN* ]
|
||||
then
|
||||
NEEDS_PIN=1
|
||||
else
|
||||
NEEDS_VALGRIND=1
|
||||
fi
|
||||
;;
|
||||
"drmemory" | "drmemory_light" | "drmemory_full")
|
||||
"drmemory" | "drmemory_light" | "drmemory_full" | "drmemory_pattern")
|
||||
NEEDS_DRMEMORY=1
|
||||
;;
|
||||
esac
|
||||
@ -74,6 +79,16 @@ then
|
||||
# Valgrind binary.
|
||||
export VALGRIND_LIB="$CHROME_VALGRIND/lib/valgrind"
|
||||
export VALGRIND_LIB_INNER="$CHROME_VALGRIND/lib/valgrind"
|
||||
|
||||
# Clean up some /tmp directories that might be stale due to interrupted
|
||||
# chrome_tests.py execution.
|
||||
# FYI:
|
||||
# -mtime +1 <- only print files modified more than 24h ago,
|
||||
# -print0/-0 are needed to handle possible newlines in the filenames.
|
||||
echo "Cleanup /tmp from Valgrind stuff"
|
||||
find /tmp -maxdepth 1 \(\
|
||||
-name "vgdb-pipe-*" -or -name "vg_logs_*" -or -name "valgrind.*" \
|
||||
\) -mtime +1 -print0 | xargs -0 rm -rf
|
||||
fi
|
||||
|
||||
if [ "$NEEDS_DRMEMORY" == "1" ]
|
||||
@ -96,6 +111,28 @@ then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$NEEDS_PIN" == "1" ]
|
||||
then
|
||||
if [ -z "$PIN_COMMAND" ]
|
||||
then
|
||||
# Set up PIN_COMMAND to invoke TSan.
|
||||
TSAN_PATH="$THISDIR/../../third_party/tsan"
|
||||
TSAN_SFX="$TSAN_PATH/tsan-x86-windows-sfx.exe"
|
||||
echo "$TSAN_SFX"
|
||||
if [ ! -f $TSAN_SFX ]
|
||||
then
|
||||
echo "Can't find ThreadSanitizer executables."
|
||||
echo "See http://www.chromium.org/developers/how-tos/using-valgrind/threadsanitizer/threadsanitizer-on-windows"
|
||||
echo "for the instructions on how to get them."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
chmod +x "$TSAN_SFX" # Cygwin won't run it without +x.
|
||||
"$TSAN_SFX" -o"$TSAN_PATH"/unpacked -y
|
||||
export PIN_COMMAND="$TSAN_PATH/unpacked/tsan-x86-windows/tsan.bat"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Add Chrome's Valgrind scripts dir to the PYTHON_PATH since it contains
|
||||
# the scripts that are needed for this script to run
|
||||
PYTHONPATH=$THISDIR/../python/google:$CHROME_VALGRIND_SCRIPTS python \
|
||||
|
||||
Reference in New Issue
Block a user