blob: 479138e7ab4941cbd98c178093ad013eb0e36e34 [file] [log] [blame]
[email protected]3d7e2c52011-09-12 08:27:001#!/bin/bash
[email protected]f14a91b02009-01-09 01:08:372
[email protected]ecff4ad2012-02-22 19:52:363# Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]e46cdae2009-08-25 20:59:274# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
[email protected]a0570412010-01-26 22:40:067# Set up some paths and re-direct the arguments to chrome_tests.py
[email protected]e5686192009-08-12 20:19:078
[email protected]b9056e9d2010-01-20 19:41:159export THISDIR=`dirname $0`
[email protected]6da38092011-11-22 10:37:0910ARGV_COPY="$@"
[email protected]81e0a0d32011-09-09 13:00:1711
gliderd6b3c7e02014-12-30 09:57:2012# We need to set CHROME_VALGRIND iff using Memcheck:
[email protected]3d7e2c52011-09-12 08:27:0013# tools/valgrind/chrome_tests.sh --tool memcheck
14# or
15# tools/valgrind/chrome_tests.sh --tool=memcheck
[email protected]6da38092011-11-22 10:37:0916tool="memcheck" # Default to memcheck.
17while (( "$#" ))
[email protected]3d7e2c52011-09-12 08:27:0018do
[email protected]6da38092011-11-22 10:37:0919 if [[ "$1" == "--tool" ]]
[email protected]3d7e2c52011-09-12 08:27:0020 then
[email protected]6da38092011-11-22 10:37:0921 tool="$2"
22 shift
23 elif [[ "$1" =~ --tool=(.*) ]]
[email protected]3d7e2c52011-09-12 08:27:0024 then
[email protected]6da38092011-11-22 10:37:0925 tool="${BASH_REMATCH[1]}"
[email protected]3d7e2c52011-09-12 08:27:0026 fi
[email protected]6da38092011-11-22 10:37:0927 shift
[email protected]3d7e2c52011-09-12 08:27:0028done
29
[email protected]6da38092011-11-22 10:37:0930NEEDS_VALGRIND=0
31NEEDS_DRMEMORY=0
32
33case "$tool" in
34 "memcheck")
35 NEEDS_VALGRIND=1
36 ;;
[email protected]2b037572012-06-21 22:20:3337 "drmemory" | "drmemory_light" | "drmemory_full" | "drmemory_pattern")
[email protected]6da38092011-11-22 10:37:0938 NEEDS_DRMEMORY=1
39 ;;
40esac
41
[email protected]3d7e2c52011-09-12 08:27:0042if [ "$NEEDS_VALGRIND" == "1" ]
43then
[email protected]19f66f22013-08-22 02:25:4444 export CHROME_VALGRIND=`sh $THISDIR/locate_valgrind.sh`
[email protected]3d7e2c52011-09-12 08:27:0045 if [ "$CHROME_VALGRIND" = "" ]
46 then
47 # locate_valgrind.sh failed
48 exit 1
49 fi
50 echo "Using valgrind binaries from ${CHROME_VALGRIND}"
51
52 PATH="${CHROME_VALGRIND}/bin:$PATH"
53 # We need to set these variables to override default lib paths hard-coded into
54 # Valgrind binary.
55 export VALGRIND_LIB="$CHROME_VALGRIND/lib/valgrind"
56 export VALGRIND_LIB_INNER="$CHROME_VALGRIND/lib/valgrind"
[email protected]d53faa3d2012-02-28 15:30:2957
58 # Clean up some /tmp directories that might be stale due to interrupted
59 # chrome_tests.py execution.
60 # FYI:
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
[email protected]3d7e2c52011-09-12 08:27:0067fi
[email protected]b9056e9d2010-01-20 19:41:1568
[email protected]6da38092011-11-22 10:37:0969if [ "$NEEDS_DRMEMORY" == "1" ]
70then
[email protected]6a58bba2011-12-06 17:50:4571 if [ -z "$DRMEMORY_COMMAND" ]
[email protected]6da38092011-11-22 10:37:0972 then
[email protected]6a58bba2011-12-06 17:50:4573 DRMEMORY_PATH="$THISDIR/../../third_party/drmemory"
74 DRMEMORY_SFX="$DRMEMORY_PATH/drmemory-windows-sfx.exe"
75 if [ ! -f "$DRMEMORY_SFX" ]
76 then
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."
80 exit 1
81 fi
[email protected]6da38092011-11-22 10:37:0982
[email protected]6a58bba2011-12-06 17:50:4583 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"
86 fi
[email protected]6da38092011-11-22 10:37:0987fi
88
89PYTHONPATH=$THISDIR/../python/google python \
90 "$THISDIR/chrome_tests.py" $ARGV_COPY