Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Unified Diff: tools/valgrind/chrome_tests.sh

Issue 8505028: Update chrome_tests.sh to run DrMemory from Cygwin Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/valgrind/valgrind_test.py » ('j') | tools/valgrind/valgrind_test.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/valgrind/chrome_tests.sh
===================================================================
--- tools/valgrind/chrome_tests.sh (revision 109287)
+++ tools/valgrind/chrome_tests.sh (working copy)
@@ -7,64 +7,42 @@
# Set up some paths and re-direct the arguments to chrome_tests.py
export THISDIR=`dirname $0`
+ARGV_COPY="$@"
-TOOL_OPTION=0
-# If --tool is omitted, default to --tool=memcheck
-NEEDS_VALGRIND=1
-
# We need to set CHROME_VALGRIND iff using Memcheck or TSan-Valgrind:
# tools/valgrind/chrome_tests.sh --tool memcheck
# or
# tools/valgrind/chrome_tests.sh --tool=memcheck
# (same for "--tool=tsan")
-# TODO(glider): can this be made more compact?
-for flag in $@
+tool=""
Alexander Potapenko 2011/11/10 12:12:13 How about initially setting $tool to "memcheck" ?
Reid Kleckner (google) 2011/11/10 14:00:30 Done.
+while (( "$#" ))
do
- if [ "$flag" == "--tool" ]
+ if [[ "$1" == "--tool" ]]
then
- # Need to check that the next argument is either "memcheck", "tsan"
- # or "tsan_rv".
- TOOL_OPTION=1
- NEEDS_VALGRIND=0
- continue
- elif [ "$flag" == "--tool=tsan" ]
+ tool="$2"
+ shift
+ elif [[ "$1" =~ --tool=(.*) ]]
then
- NEEDS_VALGRIND=1
- break
- elif [ "$flag" == "--tool=tsan_rv" ]
- then
- NEEDS_VALGRIND=1
- break
- elif [ "$flag" == "--tool=memcheck" ]
- then
- NEEDS_VALGRIND=1
- break
- elif [ $(echo $flag | sed "s/=.*//") == "--tool" ]
- then
- # This is a non-Valgrind tool.
- NEEDS_VALGRIND=0
- break
+ tool="${BASH_REMATCH[1]}"
fi
- if [ "$TOOL_OPTION" == "1" ]
- then
- if [ "$flag" == "memcheck" ]
- then
- NEEDS_VALGRIND=1
- break
- elif [ "$flag" == "tsan" ]
- then
- NEEDS_VALGRIND=1
- break
- elif [ "$flag" == "tsan_rv" ]
- then
- NEEDS_VALGRIND=1
- break
- else
- TOOL_OPTION=0
- fi
- fi
+ shift
done
+NEEDS_VALGRIND=0
+NEEDS_DRMEMORY=0
+
+case "$tool" in
+ "memcheck" | "") # No --tool arg means memcheck.
Alexander Potapenko 2011/11/10 12:12:13 No "--tool" flag means memcheck, but a missing val
Reid Kleckner (google) 2011/11/10 14:00:30 The loop above would set $tool to -t in your examp
+ NEEDS_VALGRIND=1
+ ;;
+ "tsan" | "tsan_rv")
+ NEEDS_VALGRIND=1
+ ;;
+ "drmemory" | "drmemory_light" | "drmemory_full")
+ NEEDS_DRMEMORY=1
+ ;;
+esac
+
if [ "$NEEDS_VALGRIND" == "1" ]
then
CHROME_VALGRIND=`sh $THISDIR/locate_valgrind.sh`
@@ -82,4 +60,21 @@
export VALGRIND_LIB_INNER="$CHROME_VALGRIND/lib/valgrind"
fi
-PYTHONPATH=$THISDIR/../python/google "$THISDIR/chrome_tests.py" "$@"
+if [ "$NEEDS_DRMEMORY" == "1" ]
+then
+ export DRMEMORY_PATH=$THISDIR/../../third_party/drmemory
+ export 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
+
+PYTHONPATH=$THISDIR/../python/google "$THISDIR/chrome_tests.py" $ARGV_COPY
« no previous file with comments | « no previous file | tools/valgrind/valgrind_test.py » ('j') | tools/valgrind/valgrind_test.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698