blob: d9594f48483a1a834d77f19ed989758f972e956f [file] [log] [blame]
kjellander0393de42017-06-18 13:21:21 -07001#!/bin/bash
2
3# Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
4#
5# Use of this source code is governed by a BSD-style license
6# that can be found in the LICENSE file in the root of the source
7# tree. An additional intellectual property rights grant can be found
8# in the file PATENTS. All contributing project authors may
9# be found in the AUTHORS file in the root of the source tree.
10
11# Prints a path to Valgrind binaries to be used for Chromium.
12# Select the valgrind from third_party/valgrind by default,
13# but allow users to override this default without editing scripts and
14# without specifying a commandline option
15
16export THISDIR=`dirname $0`
17
18# User may use their own valgrind by giving its path with CHROME_VALGRIND env.
19if [ "$CHROME_VALGRIND" = "" ]
20then
21 # Guess which binaries we should use by uname
22 case "$(uname -a)" in
23 *Linux*x86_64*)
24 PLATFORM="linux_x64"
25 ;;
26 *Linux*86*)
27 PLATFORM="linux_x86"
28 ;;
29 *Darwin*9.[678].[01]*i386*)
30 # Didn't test other kernels.
31 PLATFORM="mac"
32 ;;
33 *Darwin*10.[0-9].[0-9]*i386*)
34 PLATFORM="mac_10.6"
35 ;;
36 *Darwin*10.[0-9].[0-9]*x86_64*)
37 PLATFORM="mac_10.6"
38 ;;
39 *Darwin*11.[0-9].[0-9]*x86_64*)
40 PLATFORM="mac_10.7"
41 ;;
42 *)
43 (echo "Sorry, your platform is not supported:" &&
44 uname -a
45 echo
46 echo "If you're on Mac OS X, please see http://crbug.com/441425") >&2
47 exit 42
48 esac
49
50 # The binaries should be in third_party/valgrind
51 # (checked out from deps/third_party/valgrind/binaries).
52 CHROME_VALGRIND="$THISDIR/../../third_party/valgrind/$PLATFORM"
53
54 # TODO(timurrrr): readlink -f is not present on Mac...
55 if [ "$PLATFORM" != "mac" ] && \
56 [ "$PLATFORM" != "mac_10.6" ] && \
57 [ "$PLATFORM" != "mac_10.7" ]
58 then
59 # Get rid of all "../" dirs
60 CHROME_VALGRIND=$(readlink -f $CHROME_VALGRIND)
61 fi
62fi
63
64if ! test -x $CHROME_VALGRIND/bin/valgrind
65then
66 echo "Oops, could not find Valgrind binaries in your checkout." >&2
67 echo "Please see" >&2
68 echo " http://dev.chromium.org/developers/how-tos/using-valgrind/get-valgrind" >&2
69 echo "for the instructions on how to download pre-built binaries." >&2
70 exit 1
71fi
72
73echo $CHROME_VALGRIND