OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 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 ARGV_COPY="$@" | 10 ARGV_COPY="$@" |
11 | 11 |
12 # We need to set CHROME_VALGRIND iff using Memcheck or TSan-Valgrind: | 12 # We need to set CHROME_VALGRIND iff using Memcheck: |
13 # tools/valgrind/chrome_tests.sh --tool memcheck | 13 # tools/valgrind/chrome_tests.sh --tool memcheck |
14 # or | 14 # or |
15 # tools/valgrind/chrome_tests.sh --tool=memcheck | 15 # tools/valgrind/chrome_tests.sh --tool=memcheck |
16 # (same for "--tool=tsan") | |
17 tool="memcheck" # Default to memcheck. | 16 tool="memcheck" # Default to memcheck. |
18 while (( "$#" )) | 17 while (( "$#" )) |
19 do | 18 do |
20 if [[ "$1" == "--tool" ]] | 19 if [[ "$1" == "--tool" ]] |
21 then | 20 then |
22 tool="$2" | 21 tool="$2" |
23 shift | 22 shift |
24 elif [[ "$1" =~ --tool=(.*) ]] | 23 elif [[ "$1" =~ --tool=(.*) ]] |
25 then | 24 then |
26 tool="${BASH_REMATCH[1]}" | 25 tool="${BASH_REMATCH[1]}" |
27 fi | 26 fi |
28 shift | 27 shift |
29 done | 28 done |
30 | 29 |
31 NEEDS_VALGRIND=0 | 30 NEEDS_VALGRIND=0 |
32 NEEDS_DRMEMORY=0 | 31 NEEDS_DRMEMORY=0 |
33 | 32 |
34 case "$tool" in | 33 case "$tool" in |
35 "memcheck") | 34 "memcheck") |
36 NEEDS_VALGRIND=1 | 35 NEEDS_VALGRIND=1 |
37 ;; | 36 ;; |
38 "tsan" | "tsan_rv") | |
39 if [ "`uname -s`" == CYGWIN* ] | |
40 then | |
41 NEEDS_PIN=1 | |
42 else | |
43 NEEDS_VALGRIND=1 | |
44 fi | |
45 ;; | |
46 "drmemory" | "drmemory_light" | "drmemory_full" | "drmemory_pattern") | 37 "drmemory" | "drmemory_light" | "drmemory_full" | "drmemory_pattern") |
47 NEEDS_DRMEMORY=1 | 38 NEEDS_DRMEMORY=1 |
48 ;; | 39 ;; |
49 esac | 40 esac |
50 | 41 |
51 if [ "$NEEDS_VALGRIND" == "1" ] | 42 if [ "$NEEDS_VALGRIND" == "1" ] |
52 then | 43 then |
53 export CHROME_VALGRIND=`sh $THISDIR/locate_valgrind.sh` | 44 export CHROME_VALGRIND=`sh $THISDIR/locate_valgrind.sh` |
54 if [ "$CHROME_VALGRIND" = "" ] | 45 if [ "$CHROME_VALGRIND" = "" ] |
55 then | 46 then |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 echo "for the instructions on how to get them." | 79 echo "for the instructions on how to get them." |
89 exit 1 | 80 exit 1 |
90 fi | 81 fi |
91 | 82 |
92 chmod +x "$DRMEMORY_SFX" # Cygwin won't run it without +x. | 83 chmod +x "$DRMEMORY_SFX" # Cygwin won't run it without +x. |
93 "$DRMEMORY_SFX" -o"$DRMEMORY_PATH/unpacked" -y | 84 "$DRMEMORY_SFX" -o"$DRMEMORY_PATH/unpacked" -y |
94 export DRMEMORY_COMMAND="$DRMEMORY_PATH/unpacked/bin/drmemory.exe" | 85 export DRMEMORY_COMMAND="$DRMEMORY_PATH/unpacked/bin/drmemory.exe" |
95 fi | 86 fi |
96 fi | 87 fi |
97 | 88 |
98 if [ "$NEEDS_PIN" == "1" ] | |
99 then | |
100 if [ -z "$PIN_COMMAND" ] | |
101 then | |
102 # Set up PIN_COMMAND to invoke TSan. | |
103 TSAN_PATH="$THISDIR/../../third_party/tsan" | |
104 TSAN_SFX="$TSAN_PATH/tsan-x86-windows-sfx.exe" | |
105 echo "$TSAN_SFX" | |
106 if [ ! -f $TSAN_SFX ] | |
107 then | |
108 echo "Can't find ThreadSanitizer executables." | |
109 echo "See http://www.chromium.org/developers/how-tos/using-valgrind/thread
sanitizer/threadsanitizer-on-windows" | |
110 echo "for the instructions on how to get them." | |
111 exit 1 | |
112 fi | |
113 | |
114 chmod +x "$TSAN_SFX" # Cygwin won't run it without +x. | |
115 "$TSAN_SFX" -o"$TSAN_PATH"/unpacked -y | |
116 export PIN_COMMAND="$TSAN_PATH/unpacked/tsan-x86-windows/tsan.bat" | |
117 fi | |
118 fi | |
119 | |
120 | |
121 PYTHONPATH=$THISDIR/../python/google python \ | 89 PYTHONPATH=$THISDIR/../python/google python \ |
122 "$THISDIR/chrome_tests.py" $ARGV_COPY | 90 "$THISDIR/chrome_tests.py" $ARGV_COPY |
OLD | NEW |