Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: tools/valgrind-webrtc/webrtc_tests.sh

Issue 2531573003: Make Valgrind memcheck work in swarming. (Closed)
Patch Set: Show warning message. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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. If it fails a fallback path is used instead
17 # (../../chromium/src/third_party/valgrind/linux_x64) and a warning message
18 # is showed by |show_locate_valgrind_failed_warning|.
17 # - webrtc_tests.py is invoked instead of chrome_tests.py. 19 # - webrtc_tests.py is invoked instead of chrome_tests.py.
18 # - Chromium's Valgrind scripts directory is added to the PYTHONPATH to make it 20 # - Chromium's Valgrind scripts directory is added to the PYTHONPATH to make it
19 # possible to execute the Python scripts properly. 21 # possible to execute the Python scripts properly.
20 22
23 show_locate_valgrind_failed_warning() {
24 echo
25 echo "-------------------- WARNING ------------------------"
26 echo "locate_valgrind.sh failed."
27 echo "Using $CHROME_VALGRIND as a fallback location."
28 echo "Please make sure you have followed the instructions at"
29 echo "http://www.chromium.org/developers/how-tos/using-valgrind/get-valgrind"
30 echo "Notice: In the .gclient file, you need to add this for the 'src'"
31 echo "solution since our directory structure is different from Chromium's:"
32 echo "\"custom_deps\": {"
33 echo " \"src/chromium/src/third_party/valgrind\":"
34 echo " \"https://chromium.googlesource.com/chromium/deps/valgrind/binarie s\","
35 echo "},"
36 echo "-----------------------------------------------------"
37 echo
38 }
39
21 export THISDIR=`dirname $0` 40 export THISDIR=`dirname $0`
22 ARGV_COPY="$@" 41 ARGV_COPY="$@"
23 42
24 # We need to set CHROME_VALGRIND iff using Memcheck: 43 # We need to set CHROME_VALGRIND iff using Memcheck:
25 # tools/valgrind-webrtc/webrtc_tests.sh --tool memcheck 44 # tools/valgrind-webrtc/webrtc_tests.sh --tool memcheck
26 # or 45 # or
27 # tools/valgrind-webrtc/webrtc_tests.sh --tool=memcheck 46 # tools/valgrind-webrtc/webrtc_tests.sh --tool=memcheck
28 tool="memcheck" # Default to memcheck. 47 tool="memcheck" # Default to memcheck.
29 while (( "$#" )) 48 while (( "$#" ))
30 do 49 do
(...skipping 13 matching lines...) Expand all
44 case "$tool" in 63 case "$tool" in
45 "memcheck") 64 "memcheck")
46 NEEDS_VALGRIND=1 65 NEEDS_VALGRIND=1
47 ;; 66 ;;
48 esac 67 esac
49 68
50 # For WebRTC, we'll use the locate_valgrind.sh script in Chromium's Valgrind 69 # For WebRTC, we'll use the locate_valgrind.sh script in Chromium's Valgrind
51 # scripts dir to locate the Valgrind framework install 70 # scripts dir to locate the Valgrind framework install
52 CHROME_VALGRIND_SCRIPTS=$THISDIR/../valgrind 71 CHROME_VALGRIND_SCRIPTS=$THISDIR/../valgrind
53 72
73 SHOW_WARNING=0
54 if [ "$NEEDS_VALGRIND" == "1" ] 74 if [ "$NEEDS_VALGRIND" == "1" ]
55 then 75 then
56 CHROME_VALGRIND=`sh $CHROME_VALGRIND_SCRIPTS/locate_valgrind.sh` 76 CHROME_VALGRIND=`sh $CHROME_VALGRIND_SCRIPTS/locate_valgrind.sh`
57 if [ "$CHROME_VALGRIND" = "" ] 77 if [ "$CHROME_VALGRIND" = "" ]
58 then 78 then
59 # locate_valgrind.sh failed 79 CHROME_VALGRIND=../../chromium/src/third_party/valgrind/linux_x64
60 exit 1 80 SHOW_WARNING=1
81 show_locate_valgrind_failed_warning
kjellander_webrtc 2016/11/24 18:58:19 What's the point with showing the warning twice?
ehmaldonado_webrtc 2016/11/24 19:52:31 Just thought it would be almost impossible to miss
61 fi 82 fi
62 echo "Using valgrind binaries from ${CHROME_VALGRIND}" 83 echo "Using valgrind binaries from ${CHROME_VALGRIND}"
63 84
64 PATH="${CHROME_VALGRIND}/bin:$PATH" 85 PATH="${CHROME_VALGRIND}/bin:$PATH"
65 # We need to set these variables to override default lib paths hard-coded into 86 # We need to set these variables to override default lib paths hard-coded into
66 # Valgrind binary. 87 # Valgrind binary.
67 export VALGRIND_LIB="$CHROME_VALGRIND/lib/valgrind" 88 export VALGRIND_LIB="$CHROME_VALGRIND/lib/valgrind"
68 export VALGRIND_LIB_INNER="$CHROME_VALGRIND/lib/valgrind" 89 export VALGRIND_LIB_INNER="$CHROME_VALGRIND/lib/valgrind"
69 90
70 # Clean up some /tmp directories that might be stale due to interrupted 91 # Clean up some /tmp directories that might be stale due to interrupted
71 # chrome_tests.py execution. 92 # chrome_tests.py execution.
72 # FYI: 93 # FYI:
73 # -mtime +1 <- only print files modified more than 24h ago, 94 # -mtime +1 <- only print files modified more than 24h ago,
74 # -print0/-0 are needed to handle possible newlines in the filenames. 95 # -print0/-0 are needed to handle possible newlines in the filenames.
75 echo "Cleanup /tmp from Valgrind stuff" 96 echo "Cleanup /tmp from Valgrind stuff"
76 find /tmp -maxdepth 1 \(\ 97 find /tmp -maxdepth 1 \(\
77 -name "vgdb-pipe-*" -or -name "vg_logs_*" -or -name "valgrind.*" \ 98 -name "vgdb-pipe-*" -or -name "vg_logs_*" -or -name "valgrind.*" \
78 \) -mtime +1 -print0 | xargs -0 rm -rf 99 \) -mtime +1 -print0 | xargs -0 rm -rf
79 fi 100 fi
80 101
81 # Add Chrome's Valgrind scripts dir to the PYTHON_PATH since it contains 102 # Add Chrome's Valgrind scripts dir to the PYTHON_PATH since it contains
82 # the scripts that are needed for this script to run 103 # the scripts that are needed for this script to run
83 PYTHONPATH=$THISDIR/../python/google:$CHROME_VALGRIND_SCRIPTS python \ 104 PYTHONPATH=$THISDIR/../python/google:$CHROME_VALGRIND_SCRIPTS python \
84 "$THISDIR/webrtc_tests.py" $ARGV_COPY 105 "$THISDIR/webrtc_tests.py" $ARGV_COPY
106 if [ $SHOW_WARNING ]
107 then
108 show_locate_valgrind_failed_warning
109 fi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698