blob: df5e8e745f2bef9b1da5d094b95dfe6a6f2e3839 [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
[email protected]3d7e2c52011-09-12 08:27:0012# We need to set CHROME_VALGRIND iff using Memcheck or TSan-Valgrind:
13# tools/valgrind/chrome_tests.sh --tool memcheck
14# or
15# tools/valgrind/chrome_tests.sh --tool=memcheck
16# (same for "--tool=tsan")
[email protected]6da38092011-11-22 10:37:0917tool="memcheck" # Default to memcheck.
18while (( "$#" ))
[email protected]3d7e2c52011-09-12 08:27:0019do
[email protected]6da38092011-11-22 10:37:0920 if [[ "$1" == "--tool" ]]
[email protected]3d7e2c52011-09-12 08:27:0021 then
[email protected]6da38092011-11-22 10:37:0922 tool="$2"
23 shift
24 elif [[ "$1" =~ --tool=(.*) ]]
[email protected]3d7e2c52011-09-12 08:27:0025 then
[email protected]6da38092011-11-22 10:37:0926 tool="${BASH_REMATCH[1]}"
[email protected]3d7e2c52011-09-12 08:27:0027 fi
[email protected]6da38092011-11-22 10:37:0928 shift
[email protected]3d7e2c52011-09-12 08:27:0029done
30
[email protected]6da38092011-11-22 10:37:0931NEEDS_VALGRIND=0
32NEEDS_DRMEMORY=0
33
34case "$tool" in
35 "memcheck")
36 NEEDS_VALGRIND=1
37 ;;
38 "tsan" | "tsan_rv")
[email protected]ecff4ad2012-02-22 19:52:3639 if [ "`uname -s`" == CYGWIN* ]
40 then
41 NEEDS_PIN=1
42 else
43 NEEDS_VALGRIND=1
44 fi
[email protected]6da38092011-11-22 10:37:0945 ;;
[email protected]2b037572012-06-21 22:20:3346 "drmemory" | "drmemory_light" | "drmemory_full" | "drmemory_pattern")
[email protected]6da38092011-11-22 10:37:0947 NEEDS_DRMEMORY=1
48 ;;
49esac
50
[email protected]3d7e2c52011-09-12 08:27:0051if [ "$NEEDS_VALGRIND" == "1" ]
52then
[email protected]19f66f22013-08-22 02:25:4453 export CHROME_VALGRIND=`sh $THISDIR/locate_valgrind.sh`
[email protected]3d7e2c52011-09-12 08:27:0054 if [ "$CHROME_VALGRIND" = "" ]
55 then
56 # locate_valgrind.sh failed
57 exit 1
58 fi
59 echo "Using valgrind binaries from ${CHROME_VALGRIND}"
60
61 PATH="${CHROME_VALGRIND}/bin:$PATH"
62 # We need to set these variables to override default lib paths hard-coded into
63 # Valgrind binary.
64 export VALGRIND_LIB="$CHROME_VALGRIND/lib/valgrind"
65 export VALGRIND_LIB_INNER="$CHROME_VALGRIND/lib/valgrind"
[email protected]d53faa3d2012-02-28 15:30:2966
67 # Clean up some /tmp directories that might be stale due to interrupted
68 # chrome_tests.py execution.
69 # FYI:
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
[email protected]3d7e2c52011-09-12 08:27:0076fi
[email protected]b9056e9d2010-01-20 19:41:1577
[email protected]6da38092011-11-22 10:37:0978if [ "$NEEDS_DRMEMORY" == "1" ]
79then
[email protected]6a58bba2011-12-06 17:50:4580 if [ -z "$DRMEMORY_COMMAND" ]
[email protected]6da38092011-11-22 10:37:0981 then
[email protected]6a58bba2011-12-06 17:50:4582 DRMEMORY_PATH="$THISDIR/../../third_party/drmemory"
83 DRMEMORY_SFX="$DRMEMORY_PATH/drmemory-windows-sfx.exe"
84 if [ ! -f "$DRMEMORY_SFX" ]
85 then
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."
89 exit 1
90 fi
[email protected]6da38092011-11-22 10:37:0991
[email protected]6a58bba2011-12-06 17:50:4592 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"
95 fi
[email protected]6da38092011-11-22 10:37:0996fi
97
[email protected]ecff4ad2012-02-22 19:52:3698if [ "$NEEDS_PIN" == "1" ]
99then
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/threadsanitizer/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
118fi
119
120
[email protected]6da38092011-11-22 10:37:09121PYTHONPATH=$THISDIR/../python/google python \
122 "$THISDIR/chrome_tests.py" $ARGV_COPY