| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 3 # Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. |
| 4 # | 4 # |
| 5 # Use of this source code is governed by a BSD-style license | 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 | 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 | 7 # tree. An additional intellectual property rights grant can be found |
| 8 # in the file PATENTS. All contributing project authors may | 8 # in the file PATENTS. All contributing project authors may |
| 9 # be found in the AUTHORS file in the root of the source tree. | 9 # be found in the AUTHORS file in the root of the source tree. |
| 10 | 10 |
| 11 # Set up some paths and re-direct the arguments to webrtc_tests.py | 11 # Set up some paths and re-direct the arguments to webrtc_tests.py |
| 12 | 12 |
| 13 # This script is a copy of the chrome_tests.sh wrapper script with the following | 13 # This script is a copy of the chrome_tests.sh wrapper script with the following |
| 14 # changes: | 14 # changes: |
| 15 # - The locate_valgrind.sh of Chromium's Valgrind scripts dir is used to locate | 15 # - The locate_valgrind.sh of Chromium's Valgrind scripts dir is used to locate |
| 16 # the Valgrind framework install. | 16 # the Valgrind framework install. |
| 17 # - webrtc_tests.py is invoked instead of chrome_tests.py. | 17 # - webrtc_tests.py is invoked instead of chrome_tests.py. |
| 18 # - Chromium's Valgrind scripts directory is added to the PYTHONPATH to make it | 18 # - Chromium's Valgrind scripts directory is added to the PYTHONPATH to make it |
| 19 # possible to execute the Python scripts properly. | 19 # possible to execute the Python scripts properly. |
| 20 | 20 |
| 21 export THISDIR=`dirname $0` | 21 export THISDIR=`dirname $0` |
| 22 ARGV_COPY="$@" | 22 ARGV_COPY="$@" |
| 23 | 23 |
| 24 # We need to set CHROME_VALGRIND iff using Memcheck: | 24 # We need to set CHROME_VALGRIND iff using Memcheck: |
| 25 # tools/valgrind-webrtc/webrtc_tests.sh --tool memcheck | 25 # tools/valgrind-webrtc/webrtc_tests.sh --tool memcheck |
| 26 # or | 26 # or |
| 27 # tools/valgrind-webrtc/webrtc_tests.sh --tool=memcheck | 27 # tools/valgrind-webrtc/webrtc_tests.sh --tool=memcheck |
| 28 tool="memcheck" # Default to memcheck. | 28 tool="memcheck" # Default to memcheck. |
| 29 while (( "$#" )) | 29 while (( "$#" )) |
| 30 do | 30 do |
| 31 if [[ "$1" == "--tool" ]] | 31 if [[ "$1" == "--tool" ]] |
| 32 then | 32 then |
| 33 tool="$2" | 33 tool="$2" |
| 34 shift | 34 shift |
| 35 elif [[ "$1" =~ --tool=(.*) ]] | 35 elif [[ "$1" =~ --tool=(.*) ]] |
| 36 then | 36 then |
| 37 tool="${BASH_REMATCH[1]}" | 37 tool="${BASH_REMATCH[1]}" |
| 38 fi | 38 fi |
| 39 shift | 39 shift |
| 40 done | 40 done |
| 41 | 41 |
| 42 NEEDS_VALGRIND=0 | 42 NEEDS_VALGRIND=0 |
| 43 NEEDS_DRMEMORY=0 | |
| 44 | 43 |
| 45 case "$tool" in | 44 case "$tool" in |
| 46 "memcheck") | 45 "memcheck") |
| 47 NEEDS_VALGRIND=1 | 46 NEEDS_VALGRIND=1 |
| 48 ;; | 47 ;; |
| 49 "drmemory" | "drmemory_light" | "drmemory_full" | "drmemory_pattern") | |
| 50 NEEDS_DRMEMORY=1 | |
| 51 ;; | |
| 52 esac | 48 esac |
| 53 | 49 |
| 54 # For WebRTC, we'll use the locate_valgrind.sh script in Chromium's Valgrind | 50 # For WebRTC, we'll use the locate_valgrind.sh script in Chromium's Valgrind |
| 55 # scripts dir to locate the Valgrind framework install | 51 # scripts dir to locate the Valgrind framework install |
| 56 CHROME_VALGRIND_SCRIPTS=$THISDIR/../valgrind | 52 CHROME_VALGRIND_SCRIPTS=$THISDIR/../valgrind |
| 57 | 53 |
| 58 if [ "$NEEDS_VALGRIND" == "1" ] | 54 if [ "$NEEDS_VALGRIND" == "1" ] |
| 59 then | 55 then |
| 60 CHROME_VALGRIND=`sh $CHROME_VALGRIND_SCRIPTS/locate_valgrind.sh` | 56 CHROME_VALGRIND=`sh $CHROME_VALGRIND_SCRIPTS/locate_valgrind.sh` |
| 61 if [ "$CHROME_VALGRIND" = "" ] | 57 if [ "$CHROME_VALGRIND" = "" ] |
| 62 then | 58 then |
| 63 # locate_valgrind.sh failed | 59 # locate_valgrind.sh failed |
| 64 exit 1 | 60 exit 1 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 75 # chrome_tests.py execution. | 71 # chrome_tests.py execution. |
| 76 # FYI: | 72 # FYI: |
| 77 # -mtime +1 <- only print files modified more than 24h ago, | 73 # -mtime +1 <- only print files modified more than 24h ago, |
| 78 # -print0/-0 are needed to handle possible newlines in the filenames. | 74 # -print0/-0 are needed to handle possible newlines in the filenames. |
| 79 echo "Cleanup /tmp from Valgrind stuff" | 75 echo "Cleanup /tmp from Valgrind stuff" |
| 80 find /tmp -maxdepth 1 \(\ | 76 find /tmp -maxdepth 1 \(\ |
| 81 -name "vgdb-pipe-*" -or -name "vg_logs_*" -or -name "valgrind.*" \ | 77 -name "vgdb-pipe-*" -or -name "vg_logs_*" -or -name "valgrind.*" \ |
| 82 \) -mtime +1 -print0 | xargs -0 rm -rf | 78 \) -mtime +1 -print0 | xargs -0 rm -rf |
| 83 fi | 79 fi |
| 84 | 80 |
| 85 if [ "$NEEDS_DRMEMORY" == "1" ] | 81 # Add Chrome's Valgrind scripts dir to the PYTHON_PATH since it contains |
| 86 then | |
| 87 if [ -z "$DRMEMORY_COMMAND" ] | |
| 88 then | |
| 89 DRMEMORY_PATH="$THISDIR/../../third_party/drmemory" | |
| 90 DRMEMORY_SFX="$DRMEMORY_PATH/drmemory-windows-sfx.exe" | |
| 91 if [ ! -f "$DRMEMORY_SFX" ] | |
| 92 then | |
| 93 echo "Can't find Dr. Memory executables." | |
| 94 echo "See http://www.chromium.org/developers/how-tos/using-valgrind/dr-mem
ory" | |
| 95 echo "for the instructions on how to get them." | |
| 96 exit 1 | |
| 97 fi | |
| 98 | |
| 99 chmod +x "$DRMEMORY_SFX" # Cygwin won't run it without +x. | |
| 100 "$DRMEMORY_SFX" -o"$DRMEMORY_PATH/unpacked" -y | |
| 101 export DRMEMORY_COMMAND="$DRMEMORY_PATH/unpacked/bin/drmemory.exe" | |
| 102 fi | |
| 103 fi | |
| 104 | |
| 105 # Add Chrome's Valgrind scripts dir to the PYTHON_PATH since it contains | |
| 106 # the scripts that are needed for this script to run | 82 # the scripts that are needed for this script to run |
| 107 PYTHONPATH=$THISDIR/../python/google:$CHROME_VALGRIND_SCRIPTS python \ | 83 PYTHONPATH=$THISDIR/../python/google:$CHROME_VALGRIND_SCRIPTS python \ |
| 108 "$THISDIR/webrtc_tests.py" $ARGV_COPY | 84 "$THISDIR/webrtc_tests.py" $ARGV_COPY |
| OLD | NEW |