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
5 # found in the LICENSE file.
7 # Set up some paths and re-direct the arguments to chrome_tests.py
9 export THISDIR
=`dirname $0`
12 # We need to set CHROME_VALGRIND iff using Memcheck or TSan-Valgrind:
13 # 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.
20 if [[ "$1" == "--tool" ]]
24 elif [[ "$1" =~
--tool=(.
*) ]]
26 tool
="${BASH_REMATCH[1]}"
39 if [ "`uname -s`" == CYGWIN
* ]
46 "drmemory" |
"drmemory_light" |
"drmemory_full" |
"drmemory_pattern")
51 if [ "$NEEDS_VALGRIND" == "1" ]
53 export CHROME_VALGRIND
=`sh $THISDIR/locate_valgrind.sh`
54 if [ "$CHROME_VALGRIND" = "" ]
56 # locate_valgrind.sh failed
59 echo "Using valgrind binaries from ${CHROME_VALGRIND}"
61 PATH
="${CHROME_VALGRIND}/bin:$PATH"
62 # We need to set these variables to override default lib paths hard-coded into
64 export VALGRIND_LIB
="$CHROME_VALGRIND/lib/valgrind"
65 export VALGRIND_LIB_INNER
="$CHROME_VALGRIND/lib/valgrind"
67 # Clean up some /tmp directories that might be stale due to interrupted
68 # chrome_tests.py execution.
70 # -mtime +1 <- only print files modified more than 24h ago,
71 # -print0/-0 are needed to handle possible newlines in the filenames.
72 echo "Cleanup /tmp from Valgrind stuff"
73 find /tmp
-maxdepth 1 \
(\
74 -name "vgdb-pipe-*" -or -name "vg_logs_*" -or -name "valgrind.*" \
75 \
) -mtime +1 -print0 |
xargs -0 rm -rf
78 if [ "$NEEDS_DRMEMORY" == "1" ]
80 if [ -z "$DRMEMORY_COMMAND" ]
82 DRMEMORY_PATH
="$THISDIR/../../third_party/drmemory"
83 DRMEMORY_SFX
="$DRMEMORY_PATH/drmemory-windows-sfx.exe"
84 if [ ! -f "$DRMEMORY_SFX" ]
86 echo "Can't find Dr. Memory executables."
87 echo "See http://www.chromium.org/developers/how-tos/using-valgrind/dr-memory"
88 echo "for the instructions on how to get them."
92 chmod +x
"$DRMEMORY_SFX" # Cygwin won't run it without +x.
93 "$DRMEMORY_SFX" -o"$DRMEMORY_PATH/unpacked" -y
94 export DRMEMORY_COMMAND
="$DRMEMORY_PATH/unpacked/bin/drmemory.exe"
98 if [ "$NEEDS_PIN" == "1" ]
100 if [ -z "$PIN_COMMAND" ]
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"
106 if [ ! -f $TSAN_SFX ]
108 echo "Can't find ThreadSanitizer executables."
109 echo "See http://www.chromium.org/developers/how-tos/using-valgrind/threadsanitizer/threadsanitizer-on-windows"
110 echo "for the instructions on how to get them."
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"
121 PYTHONPATH
=$THISDIR/..
/python
/google python \
122 "$THISDIR/chrome_tests.py" $ARGV_COPY