webrtc/tools/valgrind-webrtc/webrtc_tests.sh

140 lines
4.3 KiB
Bash
Raw Normal View History

This CL introduces a new directory for WebRTC utility scripts for Valgrind: tools/valgrind-webrtc To be able to re-use as much as possible from Chromium's scripts, I've created two customized scripts for running tests: - webrtc_tests.py: a customized version of chrome_tests.py with WebRTC tests instead. - webrtc_tests.sh: a customized version of the chrome_tests.sh wrapper script, to launch the above script. The webrtc_tests.sh script is setting up PYTHONPATH so that tools/valgrind is available for the webrtc_tests.py script. The webrtc_tests.py script inherits the chrome_tests.py script as much as possible, to minimize maintenance and maximize readability. Having this mirrored setup of directories, allows us to use the same directory hierarchy for suppression files too. This CL only adds suppression files for memcheck, but we can add files for tsan later easily. The suppression file is currently empty for Linux. For Mac I copied all the Chromium third-party suppressions. We will need a lot more added for Mac before Valgrind runs becomes usable for that platform. The platform specific naming of the suppression files are handled automatically when webrtc_tests.sh is used to launch the tests. Example: Plain memcheck (default tool): tools/valgrind-webrtc/webrtc_tests.sh -t system_wrappers Run ThreadSanitizer: tools/valgrind-webrtc/webrtc_tests.sh --tool=tsan -t system_wrappers Previously mentioned AddressSanitizer requires additional scripts to be added and it not covered in this CL. BUG= TEST= Review URL: http://webrtc-codereview.appspot.com/322010 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1240 4adac7df-926f-26a2-2b94-8c16560cd09d
2011-12-20 09:53:41 +01:00
#!/bin/bash
# Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
# Set up some paths and re-direct the arguments to webrtc_tests.py
# This script is a copy of the chrome_tests.sh wrapper script with the following
# changes:
# - The locate_valgrind.sh of Chromium's Valgrind scripts dir is used to locate
# the Valgrind framework install.
# - webrtc_tests.py is invoked instead of chrome_tests.py.
# - Chromium's Valgrind scripts directory is added to the PYTHONPATH to make it
# possible to execute the Python scripts properly.
export THISDIR=`dirname $0`
ARGV_COPY="$@"
# We need to set CHROME_VALGRIND iff using Memcheck or TSan-Valgrind:
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
2012-09-28 17:34:18 +02:00
# tools/valgrind-webrtc/webrtc_tests.sh --tool memcheck
This CL introduces a new directory for WebRTC utility scripts for Valgrind: tools/valgrind-webrtc To be able to re-use as much as possible from Chromium's scripts, I've created two customized scripts for running tests: - webrtc_tests.py: a customized version of chrome_tests.py with WebRTC tests instead. - webrtc_tests.sh: a customized version of the chrome_tests.sh wrapper script, to launch the above script. The webrtc_tests.sh script is setting up PYTHONPATH so that tools/valgrind is available for the webrtc_tests.py script. The webrtc_tests.py script inherits the chrome_tests.py script as much as possible, to minimize maintenance and maximize readability. Having this mirrored setup of directories, allows us to use the same directory hierarchy for suppression files too. This CL only adds suppression files for memcheck, but we can add files for tsan later easily. The suppression file is currently empty for Linux. For Mac I copied all the Chromium third-party suppressions. We will need a lot more added for Mac before Valgrind runs becomes usable for that platform. The platform specific naming of the suppression files are handled automatically when webrtc_tests.sh is used to launch the tests. Example: Plain memcheck (default tool): tools/valgrind-webrtc/webrtc_tests.sh -t system_wrappers Run ThreadSanitizer: tools/valgrind-webrtc/webrtc_tests.sh --tool=tsan -t system_wrappers Previously mentioned AddressSanitizer requires additional scripts to be added and it not covered in this CL. BUG= TEST= Review URL: http://webrtc-codereview.appspot.com/322010 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1240 4adac7df-926f-26a2-2b94-8c16560cd09d
2011-12-20 09:53:41 +01:00
# or
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
2012-09-28 17:34:18 +02:00
# tools/valgrind-webrtc/webrtc_tests.sh --tool=memcheck
This CL introduces a new directory for WebRTC utility scripts for Valgrind: tools/valgrind-webrtc To be able to re-use as much as possible from Chromium's scripts, I've created two customized scripts for running tests: - webrtc_tests.py: a customized version of chrome_tests.py with WebRTC tests instead. - webrtc_tests.sh: a customized version of the chrome_tests.sh wrapper script, to launch the above script. The webrtc_tests.sh script is setting up PYTHONPATH so that tools/valgrind is available for the webrtc_tests.py script. The webrtc_tests.py script inherits the chrome_tests.py script as much as possible, to minimize maintenance and maximize readability. Having this mirrored setup of directories, allows us to use the same directory hierarchy for suppression files too. This CL only adds suppression files for memcheck, but we can add files for tsan later easily. The suppression file is currently empty for Linux. For Mac I copied all the Chromium third-party suppressions. We will need a lot more added for Mac before Valgrind runs becomes usable for that platform. The platform specific naming of the suppression files are handled automatically when webrtc_tests.sh is used to launch the tests. Example: Plain memcheck (default tool): tools/valgrind-webrtc/webrtc_tests.sh -t system_wrappers Run ThreadSanitizer: tools/valgrind-webrtc/webrtc_tests.sh --tool=tsan -t system_wrappers Previously mentioned AddressSanitizer requires additional scripts to be added and it not covered in this CL. BUG= TEST= Review URL: http://webrtc-codereview.appspot.com/322010 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1240 4adac7df-926f-26a2-2b94-8c16560cd09d
2011-12-20 09:53:41 +01:00
# (same for "--tool=tsan")
tool="memcheck" # Default to memcheck.
while (( "$#" ))
do
if [[ "$1" == "--tool" ]]
then
tool="$2"
shift
elif [[ "$1" =~ --tool=(.*) ]]
then
tool="${BASH_REMATCH[1]}"
fi
shift
done
NEEDS_VALGRIND=0
NEEDS_DRMEMORY=0
case "$tool" in
"memcheck")
NEEDS_VALGRIND=1
;;
"tsan" | "tsan_rv")
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
2012-09-28 17:34:18 +02:00
if [ "`uname -s`" == CYGWIN* ]
then
NEEDS_PIN=1
else
NEEDS_VALGRIND=1
fi
This CL introduces a new directory for WebRTC utility scripts for Valgrind: tools/valgrind-webrtc To be able to re-use as much as possible from Chromium's scripts, I've created two customized scripts for running tests: - webrtc_tests.py: a customized version of chrome_tests.py with WebRTC tests instead. - webrtc_tests.sh: a customized version of the chrome_tests.sh wrapper script, to launch the above script. The webrtc_tests.sh script is setting up PYTHONPATH so that tools/valgrind is available for the webrtc_tests.py script. The webrtc_tests.py script inherits the chrome_tests.py script as much as possible, to minimize maintenance and maximize readability. Having this mirrored setup of directories, allows us to use the same directory hierarchy for suppression files too. This CL only adds suppression files for memcheck, but we can add files for tsan later easily. The suppression file is currently empty for Linux. For Mac I copied all the Chromium third-party suppressions. We will need a lot more added for Mac before Valgrind runs becomes usable for that platform. The platform specific naming of the suppression files are handled automatically when webrtc_tests.sh is used to launch the tests. Example: Plain memcheck (default tool): tools/valgrind-webrtc/webrtc_tests.sh -t system_wrappers Run ThreadSanitizer: tools/valgrind-webrtc/webrtc_tests.sh --tool=tsan -t system_wrappers Previously mentioned AddressSanitizer requires additional scripts to be added and it not covered in this CL. BUG= TEST= Review URL: http://webrtc-codereview.appspot.com/322010 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1240 4adac7df-926f-26a2-2b94-8c16560cd09d
2011-12-20 09:53:41 +01:00
;;
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
2012-09-28 17:34:18 +02:00
"drmemory" | "drmemory_light" | "drmemory_full" | "drmemory_pattern")
This CL introduces a new directory for WebRTC utility scripts for Valgrind: tools/valgrind-webrtc To be able to re-use as much as possible from Chromium's scripts, I've created two customized scripts for running tests: - webrtc_tests.py: a customized version of chrome_tests.py with WebRTC tests instead. - webrtc_tests.sh: a customized version of the chrome_tests.sh wrapper script, to launch the above script. The webrtc_tests.sh script is setting up PYTHONPATH so that tools/valgrind is available for the webrtc_tests.py script. The webrtc_tests.py script inherits the chrome_tests.py script as much as possible, to minimize maintenance and maximize readability. Having this mirrored setup of directories, allows us to use the same directory hierarchy for suppression files too. This CL only adds suppression files for memcheck, but we can add files for tsan later easily. The suppression file is currently empty for Linux. For Mac I copied all the Chromium third-party suppressions. We will need a lot more added for Mac before Valgrind runs becomes usable for that platform. The platform specific naming of the suppression files are handled automatically when webrtc_tests.sh is used to launch the tests. Example: Plain memcheck (default tool): tools/valgrind-webrtc/webrtc_tests.sh -t system_wrappers Run ThreadSanitizer: tools/valgrind-webrtc/webrtc_tests.sh --tool=tsan -t system_wrappers Previously mentioned AddressSanitizer requires additional scripts to be added and it not covered in this CL. BUG= TEST= Review URL: http://webrtc-codereview.appspot.com/322010 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1240 4adac7df-926f-26a2-2b94-8c16560cd09d
2011-12-20 09:53:41 +01:00
NEEDS_DRMEMORY=1
;;
esac
# For WebRTC, we'll use the locate_valgrind.sh script in Chromium's Valgrind
# scripts dir to locate the Valgrind framework install
CHROME_VALGRIND_SCRIPTS=$THISDIR/../valgrind
if [ "$NEEDS_VALGRIND" == "1" ]
then
CHROME_VALGRIND=`sh $CHROME_VALGRIND_SCRIPTS/locate_valgrind.sh`
if [ "$CHROME_VALGRIND" = "" ]
then
# locate_valgrind.sh failed
exit 1
fi
echo "Using valgrind binaries from ${CHROME_VALGRIND}"
PATH="${CHROME_VALGRIND}/bin:$PATH"
# We need to set these variables to override default lib paths hard-coded into
# Valgrind binary.
export VALGRIND_LIB="$CHROME_VALGRIND/lib/valgrind"
export VALGRIND_LIB_INNER="$CHROME_VALGRIND/lib/valgrind"
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
2012-09-28 17:34:18 +02:00
# 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
This CL introduces a new directory for WebRTC utility scripts for Valgrind: tools/valgrind-webrtc To be able to re-use as much as possible from Chromium's scripts, I've created two customized scripts for running tests: - webrtc_tests.py: a customized version of chrome_tests.py with WebRTC tests instead. - webrtc_tests.sh: a customized version of the chrome_tests.sh wrapper script, to launch the above script. The webrtc_tests.sh script is setting up PYTHONPATH so that tools/valgrind is available for the webrtc_tests.py script. The webrtc_tests.py script inherits the chrome_tests.py script as much as possible, to minimize maintenance and maximize readability. Having this mirrored setup of directories, allows us to use the same directory hierarchy for suppression files too. This CL only adds suppression files for memcheck, but we can add files for tsan later easily. The suppression file is currently empty for Linux. For Mac I copied all the Chromium third-party suppressions. We will need a lot more added for Mac before Valgrind runs becomes usable for that platform. The platform specific naming of the suppression files are handled automatically when webrtc_tests.sh is used to launch the tests. Example: Plain memcheck (default tool): tools/valgrind-webrtc/webrtc_tests.sh -t system_wrappers Run ThreadSanitizer: tools/valgrind-webrtc/webrtc_tests.sh --tool=tsan -t system_wrappers Previously mentioned AddressSanitizer requires additional scripts to be added and it not covered in this CL. BUG= TEST= Review URL: http://webrtc-codereview.appspot.com/322010 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1240 4adac7df-926f-26a2-2b94-8c16560cd09d
2011-12-20 09:53:41 +01:00
fi
if [ "$NEEDS_DRMEMORY" == "1" ]
then
if [ -z "$DRMEMORY_COMMAND" ]
then
DRMEMORY_PATH="$THISDIR/../../third_party/drmemory"
DRMEMORY_SFX="$DRMEMORY_PATH/drmemory-windows-sfx.exe"
if [ ! -f "$DRMEMORY_SFX" ]
then
echo "Can't find Dr. Memory executables."
echo "See http://www.chromium.org/developers/how-tos/using-valgrind/dr-memory"
echo "for the instructions on how to get them."
exit 1
fi
chmod +x "$DRMEMORY_SFX" # Cygwin won't run it without +x.
"$DRMEMORY_SFX" -o"$DRMEMORY_PATH/unpacked" -y
export DRMEMORY_COMMAND="$DRMEMORY_PATH/unpacked/bin/drmemory.exe"
fi
fi
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
2012-09-28 17:34:18 +02:00
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
This CL introduces a new directory for WebRTC utility scripts for Valgrind: tools/valgrind-webrtc To be able to re-use as much as possible from Chromium's scripts, I've created two customized scripts for running tests: - webrtc_tests.py: a customized version of chrome_tests.py with WebRTC tests instead. - webrtc_tests.sh: a customized version of the chrome_tests.sh wrapper script, to launch the above script. The webrtc_tests.sh script is setting up PYTHONPATH so that tools/valgrind is available for the webrtc_tests.py script. The webrtc_tests.py script inherits the chrome_tests.py script as much as possible, to minimize maintenance and maximize readability. Having this mirrored setup of directories, allows us to use the same directory hierarchy for suppression files too. This CL only adds suppression files for memcheck, but we can add files for tsan later easily. The suppression file is currently empty for Linux. For Mac I copied all the Chromium third-party suppressions. We will need a lot more added for Mac before Valgrind runs becomes usable for that platform. The platform specific naming of the suppression files are handled automatically when webrtc_tests.sh is used to launch the tests. Example: Plain memcheck (default tool): tools/valgrind-webrtc/webrtc_tests.sh -t system_wrappers Run ThreadSanitizer: tools/valgrind-webrtc/webrtc_tests.sh --tool=tsan -t system_wrappers Previously mentioned AddressSanitizer requires additional scripts to be added and it not covered in this CL. BUG= TEST= Review URL: http://webrtc-codereview.appspot.com/322010 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1240 4adac7df-926f-26a2-2b94-8c16560cd09d
2011-12-20 09:53:41 +01:00
# 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 \
"$THISDIR/webrtc_tests.py" $ARGV_COPY