2
0

locate_valgrind.sh 2.1 KB

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