Fix bug in load time stats.
[chromium-blink-merge.git] / tools / valgrind / locate_valgrind.sh
blobb3a25c97f96681a9850940384c8b3f83fa962cbd
1 #!/bin/bash
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 # Prints a path to Valgrind binaries to be used for Chromium.
8 # Select the valgrind from third_party/valgrind by default,
9 # but allow users to override this default without editing scripts and
10 # without specifying a commandline option
12 export THISDIR=`dirname $0`
14 # User may use his own valgrind by giving its path with CHROME_VALGRIND env.
15 if [ "$CHROME_VALGRIND" = "" ]
16 then
17 # Guess which binaries we should use by uname
18 case "$(uname -a)" in
19 *Linux*x86_64*)
20 PLATFORM="linux_x64"
22 *Linux*86*)
23 PLATFORM="linux_x86"
25 *Darwin*9.[678].[01]*i386*)
26 # Didn't test other kernels.
27 PLATFORM="mac"
29 *Darwin*10.[0-9].[0-9]*i386*)
30 PLATFORM="mac_10.6"
32 *Darwin*10.[0-9].[0-9]*x86_64*)
33 PLATFORM="mac_10.6"
35 *Darwin*11.[0-9].[0-9]*x86_64*)
36 PLATFORM="mac_10.7"
39 echo "Unknown platform:" >&2
40 uname -a >&2
41 echo "We'll try to search for valgrind binaries installed in /usr/local" >&2
42 PLATFORM=
43 esac
45 if [ "$PLATFORM" != "" ]
46 then
47 # The binaries should be in third_party/valgrind
48 # (checked out from deps/third_party/valgrind/binaries).
49 CHROME_VALGRIND="$THISDIR/../../third_party/valgrind/$PLATFORM"
51 # TODO(timurrrr): readlink -f is not present on Mac...
52 if [ "$PLATFORM" != "mac" ] && \
53 [ "$PLATFORM" != "mac_10.6" ] && \
54 [ "$PLATFORM" != "mac_10.7" ]
55 then
56 # Get rid of all "../" dirs
57 CHROME_VALGRIND=`readlink -f $CHROME_VALGRIND`
60 if ! test -x $CHROME_VALGRIND/bin/valgrind
61 then
62 # We couldn't find the binaries in third_party/valgrind
63 CHROME_VALGRIND=""
68 if ! test -x $CHROME_VALGRIND/bin/valgrind
69 then
70 echo "Could not find valgrind binaries anywhere. Please see" >&2
71 echo "http://dev.chromium.org/developers/how-tos/using-valgrind/building-valgrind" >&2
72 echo "for the instructions on how to get them." >&2
73 exit 1
76 echo $CHROME_VALGRIND