2
0

libyuv_tests.sh 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #!/bin/bash
  2. # Copyright (c) 2012 The LibYuv 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. # Set up some paths and re-direct the arguments to libyuv_tests.py
  10. # This script is a copy of the chrome_tests.sh wrapper script with the following
  11. # changes:
  12. # - The locate_valgrind.sh of Chromium's Valgrind scripts dir is used to locate
  13. # the Valgrind framework install. If it fails a fallback path is used instead
  14. # (../../chromium/src/third_party/valgrind/linux_x64) and a warning message
  15. # is showed by |show_locate_valgrind_failed_warning|.
  16. # - libyuv_tests.py is invoked instead of chrome_tests.py.
  17. # - Chromium's Valgrind scripts directory is added to the PYTHONPATH to make it
  18. # possible to execute the Python scripts properly.
  19. export THISDIR=`dirname $0`
  20. ARGV_COPY="$@"
  21. # We need to set CHROME_VALGRIND iff using Memcheck:
  22. # tools_libyuv/valgrind/libyuv_tests.sh --tool memcheck
  23. # or
  24. # tools_libyuv/valgrind/libyuv_tests.sh --tool=memcheck
  25. tool="memcheck" # Default to memcheck.
  26. while (( "$#" ))
  27. do
  28. if [[ "$1" == "--tool" ]]
  29. then
  30. tool="$2"
  31. shift
  32. elif [[ "$1" =~ --tool=(.*) ]]
  33. then
  34. tool="${BASH_REMATCH[1]}"
  35. fi
  36. shift
  37. done
  38. NEEDS_VALGRIND=0
  39. case "$tool" in
  40. "memcheck")
  41. NEEDS_VALGRIND=1
  42. ;;
  43. esac
  44. # For libyuv, we'll use the locate_valgrind.sh script in Chromium's Valgrind
  45. # scripts dir to locate the Valgrind framework install
  46. CHROME_VALGRIND_SCRIPTS=$THISDIR/../../tools/valgrind
  47. if [ "$NEEDS_VALGRIND" == "1" ]
  48. then
  49. CHROME_VALGRIND=`sh $THISDIR/locate_valgrind.sh`
  50. if [ "$CHROME_VALGRIND" = "" ]
  51. then
  52. CHROME_VALGRIND=../../src/third_party/valgrind/linux_x64
  53. echo
  54. echo "-------------------- WARNING ------------------------"
  55. echo "locate_valgrind.sh failed."
  56. echo "Using $CHROME_VALGRIND as a fallback location."
  57. echo "This might be because:"
  58. echo "1) This is a swarming bot"
  59. echo "2) You haven't set up the valgrind binaries correctly."
  60. echo "In this case, please make sure you have followed the instructions at"
  61. echo "http://www.chromium.org/developers/how-tos/using-valgrind/get-valgrind"
  62. echo "Notice: In the .gclient file, you need to add this for the 'libyuv'"
  63. echo "solution since our directory structure is different from Chromium's:"
  64. echo "\"custom_deps\": {"
  65. echo " \"libyuv/third_party/valgrind\":"
  66. echo " \"https://chromium.googlesource.com/chromium/deps/valgrind/binaries\","
  67. echo "},"
  68. echo "-----------------------------------------------------"
  69. echo
  70. fi
  71. echo "Using valgrind binaries from ${CHROME_VALGRIND}"
  72. PATH="${CHROME_VALGRIND}/bin:$PATH"
  73. # We need to set these variables to override default lib paths hard-coded into
  74. # Valgrind binary.
  75. export VALGRIND_LIB="$CHROME_VALGRIND/lib/valgrind"
  76. export VALGRIND_LIB_INNER="$CHROME_VALGRIND/lib/valgrind"
  77. # Clean up some /tmp directories that might be stale due to interrupted
  78. # chrome_tests.py execution.
  79. # FYI:
  80. # -mtime +1 <- only print files modified more than 24h ago,
  81. # -print0/-0 are needed to handle possible newlines in the filenames.
  82. echo "Cleanup /tmp from Valgrind stuff"
  83. find /tmp -maxdepth 1 \(\
  84. -name "vgdb-pipe-*" -or -name "vg_logs_*" -or -name "valgrind.*" \
  85. \) -mtime +1 -print0 | xargs -0 rm -rf
  86. fi
  87. # Add Chrome's Valgrind scripts dir to the PYTHON_PATH since it contains
  88. # the scripts that are needed for this script to run
  89. PYTHONPATH=$THISDIR/../../tools/python/google:$CHROME_VALGRIND_SCRIPTS python \
  90. "$THISDIR/libyuv_tests.py" $ARGV_COPY