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:
13 # tools/valgrind/chrome_tests.sh --tool memcheck
15 # tools/valgrind/chrome_tests.sh --tool=memcheck
16 tool
="memcheck" # Default to memcheck.
19 if [[ "$1" == "--tool" ]]
23 elif [[ "$1" =~
--tool=(.
*) ]]
25 tool
="${BASH_REMATCH[1]}"
37 "drmemory" |
"drmemory_light" |
"drmemory_full" |
"drmemory_pattern")
42 if [ "$NEEDS_VALGRIND" == "1" ]
44 export CHROME_VALGRIND
=`sh $THISDIR/locate_valgrind.sh`
45 if [ "$CHROME_VALGRIND" = "" ]
47 # locate_valgrind.sh failed
50 echo "Using valgrind binaries from ${CHROME_VALGRIND}"
52 PATH
="${CHROME_VALGRIND}/bin:$PATH"
53 # We need to set these variables to override default lib paths hard-coded into
55 export VALGRIND_LIB
="$CHROME_VALGRIND/lib/valgrind"
56 export VALGRIND_LIB_INNER
="$CHROME_VALGRIND/lib/valgrind"
58 # Clean up some /tmp directories that might be stale due to interrupted
59 # chrome_tests.py execution.
61 # -mtime +1 <- only print files modified more than 24h ago,
62 # -print0/-0 are needed to handle possible newlines in the filenames.
63 echo "Cleanup /tmp from Valgrind stuff"
64 find /tmp
-maxdepth 1 \
(\
65 -name "vgdb-pipe-*" -or -name "vg_logs_*" -or -name "valgrind.*" \
66 \
) -mtime +1 -print0 |
xargs -0 rm -rf
69 if [ "$NEEDS_DRMEMORY" == "1" ]
71 if [ -z "$DRMEMORY_COMMAND" ]
73 DRMEMORY_PATH
="$THISDIR/../../third_party/drmemory"
74 DRMEMORY_SFX
="$DRMEMORY_PATH/drmemory-windows-sfx.exe"
75 if [ ! -f "$DRMEMORY_SFX" ]
77 echo "Can't find Dr. Memory executables."
78 echo "See http://www.chromium.org/developers/how-tos/using-valgrind/dr-memory"
79 echo "for the instructions on how to get them."
83 chmod +x
"$DRMEMORY_SFX" # Cygwin won't run it without +x.
84 "$DRMEMORY_SFX" -o"$DRMEMORY_PATH/unpacked" -y
85 export DRMEMORY_COMMAND
="$DRMEMORY_PATH/unpacked/bin/drmemory.exe"
89 PYTHONPATH
=$THISDIR/..
/python
/google python \
90 "$THISDIR/chrome_tests.py" $ARGV_COPY