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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/valgrind/common.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 2
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 # Set up some paths and re-direct the arguments to chrome_tests.py 7 # Set up some paths and re-direct the arguments to chrome_tests.py
8 8
9 export THISDIR=`dirname $0` 9 export THISDIR=`dirname $0`
10 10 ARGV_COPY="$@"
11 TOOL_OPTION=0
12 # If --tool is omitted, default to --tool=memcheck
13 NEEDS_VALGRIND=1
14 11
15 # We need to set CHROME_VALGRIND iff using Memcheck or TSan-Valgrind: 12 # We need to set CHROME_VALGRIND iff using Memcheck or TSan-Valgrind:
16 # tools/valgrind/chrome_tests.sh --tool memcheck 13 # tools/valgrind/chrome_tests.sh --tool memcheck
17 # or 14 # or
18 # tools/valgrind/chrome_tests.sh --tool=memcheck 15 # tools/valgrind/chrome_tests.sh --tool=memcheck
19 # (same for "--tool=tsan") 16 # (same for "--tool=tsan")
20 # TODO(glider): can this be made more compact? 17 tool="memcheck" # Default to memcheck.
21 for flag in $@ 18 while (( "$#" ))
22 do 19 do
23 if [ "$flag" == "--tool" ] 20 if [[ "$1" == "--tool" ]]
24 then 21 then
25 # Need to check that the next argument is either "memcheck", "tsan" 22 tool="$2"
26 # or "tsan_rv". 23 shift
27 TOOL_OPTION=1 24 elif [[ "$1" =~ --tool=(.*) ]]
28 NEEDS_VALGRIND=0
29 continue
30 elif [ "$flag" == "--tool=tsan" ]
31 then 25 then
26 tool="${BASH_REMATCH[1]}"
27 fi
28 shift
29 done
30
31 NEEDS_VALGRIND=0
32 NEEDS_DRMEMORY=0
33
34 case "$tool" in
35 "memcheck")
32 NEEDS_VALGRIND=1 36 NEEDS_VALGRIND=1
33 break 37 ;;
34 elif [ "$flag" == "--tool=tsan_rv" ] 38 "tsan" | "tsan_rv")
35 then
36 NEEDS_VALGRIND=1 39 NEEDS_VALGRIND=1
37 break 40 ;;
38 elif [ "$flag" == "--tool=memcheck" ] 41 "drmemory" | "drmemory_light" | "drmemory_full")
39 then 42 NEEDS_DRMEMORY=1
40 NEEDS_VALGRIND=1 43 ;;
41 break 44 esac
42 elif [ $(echo $flag | sed "s/=.*//") == "--tool" ]
43 then
44 # This is a non-Valgrind tool.
45 NEEDS_VALGRIND=0
46 break
47 fi
48 if [ "$TOOL_OPTION" == "1" ]
49 then
50 if [ "$flag" == "memcheck" ]
51 then
52 NEEDS_VALGRIND=1
53 break
54 elif [ "$flag" == "tsan" ]
55 then
56 NEEDS_VALGRIND=1
57 break
58 elif [ "$flag" == "tsan_rv" ]
59 then
60 NEEDS_VALGRIND=1
61 break
62 else
63 TOOL_OPTION=0
64 fi
65 fi
66 done
67 45
68 if [ "$NEEDS_VALGRIND" == "1" ] 46 if [ "$NEEDS_VALGRIND" == "1" ]
69 then 47 then
70 CHROME_VALGRIND=`sh $THISDIR/locate_valgrind.sh` 48 CHROME_VALGRIND=`sh $THISDIR/locate_valgrind.sh`
71 if [ "$CHROME_VALGRIND" = "" ] 49 if [ "$CHROME_VALGRIND" = "" ]
72 then 50 then
73 # locate_valgrind.sh failed 51 # locate_valgrind.sh failed
74 exit 1 52 exit 1
75 fi 53 fi
76 echo "Using valgrind binaries from ${CHROME_VALGRIND}" 54 echo "Using valgrind binaries from ${CHROME_VALGRIND}"
77 55
78 PATH="${CHROME_VALGRIND}/bin:$PATH" 56 PATH="${CHROME_VALGRIND}/bin:$PATH"
79 # We need to set these variables to override default lib paths hard-coded into 57 # We need to set these variables to override default lib paths hard-coded into
80 # Valgrind binary. 58 # Valgrind binary.
81 export VALGRIND_LIB="$CHROME_VALGRIND/lib/valgrind" 59 export VALGRIND_LIB="$CHROME_VALGRIND/lib/valgrind"
82 export VALGRIND_LIB_INNER="$CHROME_VALGRIND/lib/valgrind" 60 export VALGRIND_LIB_INNER="$CHROME_VALGRIND/lib/valgrind"
83 fi 61 fi
84 62
85 PYTHONPATH=$THISDIR/../python/google "$THISDIR/chrome_tests.py" "$@" 63 if [ "$NEEDS_DRMEMORY" == "1" ]
64 then
65 export DRMEMORY_PATH=$THISDIR/../../third_party/drmemory
66 export DRMEMORY_SFX=$DRMEMORY_PATH/drmemory-windows-sfx.exe
67 if [ ! -f "$DRMEMORY_SFX" ]
68 then
69 echo "Can't find Dr. Memory executables."
70 echo "See http://www.chromium.org/developers/how-tos/using-valgrind/dr-memor y"
71 echo "for the instructions on how to get them."
72 exit 1
73 fi
74
75 chmod +x "$DRMEMORY_SFX" # Cygwin won't run it without +x.
76 "$DRMEMORY_SFX" -o"$DRMEMORY_PATH/unpacked" -y
77 export DRMEMORY_COMMAND=$DRMEMORY_PATH/unpacked/bin/drmemory.exe
78 fi
79
80 PYTHONPATH=$THISDIR/../python/google "$THISDIR/chrome_tests.py" $ARGV_COPY
OLDNEW
« no previous file with comments | « no previous file | tools/valgrind/common.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698