diff options
author | timurrrr@chromium.org <timurrrr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-26 22:40:06 +0000 |
---|---|---|
committer | timurrrr@chromium.org <timurrrr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-26 22:40:06 +0000 |
commit | a05704154e821610ee1d3f4a21e5d9a46a6e9f8d (patch) | |
tree | 941b4f269347874d401abb095718cf2bb2da0a84 /tools | |
parent | cfd9fa44f742a6beabe130177b0b35b112ff339c (diff) | |
download | chromium_src-a05704154e821610ee1d3f4a21e5d9a46a6e9f8d.zip chromium_src-a05704154e821610ee1d3f4a21e5d9a46a6e9f8d.tar.gz chromium_src-a05704154e821610ee1d3f4a21e5d9a46a6e9f8d.tar.bz2 |
Guess the Valgrind PATH in a separate script
Review URL: http://codereview.chromium.org/556025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37158 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/valgrind/chrome_tests.sh | 70 | ||||
-rwxr-xr-x | tools/valgrind/locate_valgrind.sh | 77 | ||||
-rwxr-xr-x | tools/valgrind/valgrind.sh | 33 |
3 files changed, 96 insertions, 84 deletions
diff --git a/tools/valgrind/chrome_tests.sh b/tools/valgrind/chrome_tests.sh index 4792132..dd3a6b3 100755 --- a/tools/valgrind/chrome_tests.sh +++ b/tools/valgrind/chrome_tests.sh @@ -4,82 +4,22 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# Select the valgrind built by build-valgrind-for-chromium.sh by default, -# but allow users to override this default without editing scripts and -# without specifying a commandline option +# Set up some paths and re-direct the arguments to chrome_tests.py export THISDIR=`dirname $0` -# User may use his own valgrind by giving its path with CHROME_VALGRIND env. +CHROME_VALGRIND=`sh $THISDIR/locate_valgrind.sh` if [ "$CHROME_VALGRIND" = "" ] then - # Guess which binaries we should use by uname - case "$(uname -a)" in - *Linux*x86_64*) - PLATFORM="linux_x64" - ;; - *Linux*86*) - PLATFORM="linux_x86" - ;; - *Darwin*9.[678].[01]*i386*) - # Didn't test other kernels. - PLATFORM="mac" - ;; - *) - echo "Unknown platform:" - uname -a - echo "We'll try to search for valgrind binaries installed in /usr/local" - PLATFORM= - esac - - if [ "$PLATFORM" != "" ] - then - # The binaries should be in third_party/valgrind - # (checked out from deps/third_party/valgrind/binaries). - CHROME_VALGRIND="$THISDIR/../../third_party/valgrind/$PLATFORM" - - # TODO(timurrrr): readlink -f is not present on Mac... - if [ "$PLATFORM" != "mac" ] - then - # Get rid of all "../" dirs - CHROME_VALGRIND=`readlink -f $CHROME_VALGRIND` - fi - - if ! test -x $CHROME_VALGRIND/bin/valgrind - then - # We couldn't find the binaries in third_party/valgrind - CHROME_VALGRIND="" - fi - fi - - if [ "$CHROME_VALGRIND" = "" ] - then - # Couldn't find the binaries checked out from SVN. - # Let's try to find out valgrind in /usr/local. Use the most recent one. - # See build-valgrind-for-chromium.sh and its history for these constants. - for SVNREV in '10880-redzone' '10880' - do - CHROME_VALGRIND=/usr/local/valgrind-$SVNREV - test -x $CHROME_VALGRIND/bin/valgrind && break - done - fi -fi - -if ! test -x $CHROME_VALGRIND/bin/valgrind -then - # TODO(timurrrr): give a link to instructions on what to do in this case - # once the SVN-binaries Valgrind deployment method is out of experimental. - echo "Could not find valgrind binaries in ${CHROME_VALGRIND}." - echo "Please run build-valgrind-for-chromium.sh or set CHROME_VALGRIND." + # locate_valgrind.sh failed exit 1 fi +echo "Using valgrind binaries from ${CHROME_VALGRIND}" +PATH="${CHROME_VALGRIND}/bin:$PATH" # We need to set these variables to override default lib paths hard-coded into # Valgrind binary. export VALGRIND_LIB="$CHROME_VALGRIND/lib/valgrind" export VALGRIND_LIB_INNER="$CHROME_VALGRIND/lib/valgrind" -echo "Using valgrind binaries from ${CHROME_VALGRIND}" -PATH="${CHROME_VALGRIND}/bin:$PATH" - PYTHONPATH=$THISDIR/../../webkit/tools/layout_tests/webkitpy/layout_tests:$THISDIR/../python "$THISDIR/chrome_tests.py" "$@" diff --git a/tools/valgrind/locate_valgrind.sh b/tools/valgrind/locate_valgrind.sh new file mode 100755 index 0000000..1f9a86f --- /dev/null +++ b/tools/valgrind/locate_valgrind.sh @@ -0,0 +1,77 @@ +#!/bin/bash + +# Copyright (c) 2009 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Prints a path to Valgrind binaries to be used for Chromium. +# Select the valgrind from third_party/valgrind by default, +# but allow users to override this default without editing scripts and +# without specifying a commandline option + +export THISDIR=`dirname $0` + +# User may use his own valgrind by giving its path with CHROME_VALGRIND env. +if [ "$CHROME_VALGRIND" = "" ] +then + # Guess which binaries we should use by uname + case "$(uname -a)" in + *Linux*x86_64*) + PLATFORM="linux_x64" + ;; + *Linux*86*) + PLATFORM="linux_x86" + ;; + *Darwin*9.[678].[01]*i386*) + # Didn't test other kernels. + PLATFORM="mac" + ;; + *) + echo "Unknown platform:" >&2 + uname -a >&2 + echo "We'll try to search for valgrind binaries installed in /usr/local" >&2 + PLATFORM= + esac + + if [ "$PLATFORM" != "" ] + then + # The binaries should be in third_party/valgrind + # (checked out from deps/third_party/valgrind/binaries). + CHROME_VALGRIND="$THISDIR/../../third_party/valgrind/$PLATFORM" + + # TODO(timurrrr): readlink -f is not present on Mac... + if [ "$PLATFORM" != "mac" ] + then + # Get rid of all "../" dirs + CHROME_VALGRIND=`readlink -f $CHROME_VALGRIND` + fi + + if ! test -x $CHROME_VALGRIND/bin/valgrind + then + # We couldn't find the binaries in third_party/valgrind + CHROME_VALGRIND="" + fi + fi + + if [ "$CHROME_VALGRIND" = "" ] + then + # Couldn't find the binaries checked out from SVN. + # Let's try to find out valgrind in /usr/local. Use the most recent one. + # See build-valgrind-for-chromium.sh and its history for these constants. + for SVNREV in '10880-redzone' '10880' + do + CHROME_VALGRIND=/usr/local/valgrind-$SVNREV + test -x $CHROME_VALGRIND/bin/valgrind && break + done + fi +fi + +if ! test -x $CHROME_VALGRIND/bin/valgrind +then + echo "Could not find valgrind binaries anywhere. Please see" >&2 + echo "http://dev.chromium.org/developers/how-tos/using-valgrind/building-valgrind" >&2 + echo "for the instructions on how to get them." >&2 + exit 1 +fi + +echo $CHROME_VALGRIND diff --git a/tools/valgrind/valgrind.sh b/tools/valgrind/valgrind.sh index ea17afd..a064035 100755 --- a/tools/valgrind/valgrind.sh +++ b/tools/valgrind/valgrind.sh @@ -13,6 +13,8 @@ # To run unit tests, you probably want to run chrome_tests.sh instead. # That's the script used by the valgrind buildbot. +export THISDIR=`dirname $0` + setup_memcheck() { # Prefer a 32-bit gdb if it's available. GDB="/usr/bin/gdb32"; @@ -28,7 +30,7 @@ setup_memcheck() { } setup_tsan() { - IGNORE_FILE="$(cd `dirname "$0"` && pwd)/tsan/ignores.txt" + IGNORE_FILE="$THISDIR/tsan/ignores.txt" DEFAULT_TOOL_FLAGS=("--announce-threads" "--pure-happens-before=yes" \ "--ignore=$IGNORE_FILE") } @@ -66,30 +68,23 @@ case $TOOL_NAME in *) setup_unknown;; esac -SUPPRESSIONS="$(cd `dirname "$0"` && pwd)/$TOOL_NAME/suppressions.txt" -if test x"$CHROME_VALGRIND_BIN" = x -then - # Figure out which valgrind is installed. Use most recent one. - # See build-valgrind-for-chromium.sh and its history for these constants. - for SVNREV in 10880-redzone 10880 10771 20090715 - do - CHROME_VALGRIND_BIN=/usr/local/valgrind-$SVNREV/bin - test -x $CHROME_VALGRIND_BIN/valgrind && break - done -fi +SUPPRESSIONS="$THISDIR/$TOOL_NAME/suppressions.txt" -if ! test -x $CHROME_VALGRIND_BIN/valgrind +CHROME_VALGRIND=`sh $THISDIR/locate_valgrind.sh` +if [ "$CHROME_VALGRIND" = "" ] then - echo "Could not find chromium's version of valgrind." - echo "Please run build-valgrind-for-chromium.sh or set CHROME_VALGRIND_BIN." - echo "Defaulting to system valgrind." -else - echo "Using ${CHROME_VALGRIND_BIN}/valgrind." - PATH="${CHROME_VALGRIND_BIN}:$PATH" + # locate_valgrind.sh failed + exit 1 fi +echo "Using valgrind binaries from ${CHROME_VALGRIND}" set -x +PATH="${CHROME_VALGRIND}/bin:$PATH" +# We need to set these variables to override default lib paths hard-coded into +# Valgrind binary. +export VALGRIND_LIB="$CHROME_VALGRIND/lib/valgrind" +export VALGRIND_LIB_INNER="$CHROME_VALGRIND/lib/valgrind" # G_SLICE=always-malloc: make glib use system malloc # NSS_DISABLE_ARENA_FREE_LIST=1: make nss use system malloc |