| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 # This script can be used by waterfall sheriffs to fetch the status | 7 # This script can be used by waterfall sheriffs to fetch the status |
| 8 # of Valgrind bots on the memory waterfall and test if their local | 8 # of Valgrind bots on the memory waterfall and test if their local |
| 9 # suppressions match the reports on the waterfall. | 9 # suppressions match the reports on the waterfall. |
| 10 | 10 |
| 11 set -e | 11 set -e |
| 12 | 12 |
| 13 THISDIR=$(dirname "${0}") | 13 THISDIR=$(dirname "${0}") |
| 14 LOGS_DIR=$THISDIR/waterfall.tmp | 14 LOGS_DIR=$THISDIR/waterfall.tmp |
| 15 | 15 |
| 16 fetch_logs() { | 16 fetch_logs() { |
| 17 # Fetch Valgrind logs from the waterfall {{{1 | 17 # Fetch Valgrind logs from the waterfall {{{1 |
| 18 | 18 |
| 19 WATERFALL_PAGE="http://build.chromium.org/buildbot/memory/builders" | 19 WATERFALL_PAGE="http://build.chromium.org/buildbot/memory/builders" |
| 20 | 20 |
| 21 rm -rf $LOGS_DIR # Delete old logs | 21 rm -rf "$LOGS_DIR" # Delete old logs |
| 22 mkdir $LOGS_DIR | 22 mkdir "$LOGS_DIR" |
| 23 | 23 |
| 24 echo "Fetching the list of builders..." | 24 echo "Fetching the list of builders..." |
| 25 wget $WATERFALL_PAGE -O $LOGS_DIR/builders -q | 25 wget $WATERFALL_PAGE -O "$LOGS_DIR/builders" -q |
| 26 SLAVES=$(grep "<a href=\"builders\/" $LOGS_DIR/builders | \ | 26 SLAVES=$(grep "<a href=\"builders\/" "$LOGS_DIR/builders" | \ |
| 27 sed "s/.*<a href=\"builders\///" | sed "s/\".*//" | \ | 27 sed "s/.*<a href=\"builders\///" | sed "s/\".*//" | \ |
| 28 sort | uniq) | 28 sort | uniq) |
| 29 | 29 |
| 30 for S in $SLAVES | 30 for S in $SLAVES |
| 31 do | 31 do |
| 32 SLAVE_URL=$WATERFALL_PAGE/$S | 32 SLAVE_URL=$WATERFALL_PAGE/$S |
| 33 SLAVE_NAME=$(echo $S | sed "s/%20/ /g" | sed "s/%28/(/g" | sed "s/%29/)/g") | 33 SLAVE_NAME=$(echo $S | sed "s/%20/ /g" | sed "s/%28/(/g" | sed "s/%29/)/g") |
| 34 echo -n "Fetching builds by slave '${SLAVE_NAME}'" | 34 echo -n "Fetching builds by slave '${SLAVE_NAME}'" |
| 35 wget $SLAVE_URL -O $LOGS_DIR/slave_${S} -q | 35 wget $SLAVE_URL -O "$LOGS_DIR/slave_${S}" -q |
| 36 | 36 |
| 37 # We speed up the 'fetch' step by skipping the builds/tests which succeeded. | 37 # We speed up the 'fetch' step by skipping the builds/tests which succeeded. |
| 38 # TODO(timurrrr): OTOH, we won't be able to check | 38 # TODO(timurrrr): OTOH, we won't be able to check |
| 39 # if some suppression is not used anymore. | 39 # if some suppression is not used anymore. |
| 40 LIST_OF_BUILDS=$(grep "<a href=\"\.\./builders/.*/builds/[0-9]\+.*failed" \ | 40 LIST_OF_BUILDS=$(grep "<a href=\"\.\./builders/.*/builds/[0-9]\+.*failed" \ |
| 41 $LOGS_DIR/slave_$S | grep -v "failed compile" | \ | 41 "$LOGS_DIR/slave_$S" | grep -v "failed compile" | \ |
| 42 sed "s/.*\/builds\///" | sed "s/\".*//" | head -n 2) | 42 sed "s/.*\/builds\///" | sed "s/\".*//" | head -n 2) |
| 43 | 43 |
| 44 for BUILD in $LIST_OF_BUILDS | 44 for BUILD in $LIST_OF_BUILDS |
| 45 do | 45 do |
| 46 BUILD_RESULTS="$LOGS_DIR/slave_${S}_build_${BUILD}" | 46 BUILD_RESULTS="$LOGS_DIR/slave_${S}_build_${BUILD}" |
| 47 wget $SLAVE_URL/builds/$BUILD -O $BUILD_RESULTS -q | 47 wget $SLAVE_URL/builds/$BUILD -O "$BUILD_RESULTS" -q |
| 48 LIST_OF_TESTS=$(grep "<a href=\"[0-9]\+/steps/memory.*/logs/stdio\"" \ | 48 LIST_OF_TESTS=$(grep "<a href=\"[0-9]\+/steps/memory.*/logs/stdio\"" \ |
| 49 $BUILD_RESULTS | \ | 49 "$BUILD_RESULTS" | \ |
| 50 sed "s/.*a href=\"//" | sed "s/\".*//") | 50 sed "s/.*a href=\"//" | sed "s/\".*//") |
| 51 for TEST in $LIST_OF_TESTS | 51 for TEST in $LIST_OF_TESTS |
| 52 do | 52 do |
| 53 REPORT_FILE=$(echo "report_${S}_$TEST" | sed "s/\/logs\/stdio//" | \ | 53 REPORT_FILE=$(echo "report_${S}_$TEST" | sed "s/\/logs\/stdio//" | \ |
| 54 sed "s/\/steps//" | sed "s/\//_/g") | 54 sed "s/\/steps//" | sed "s/\//_/g") |
| 55 echo -n "." | 55 echo -n "." |
| 56 wget $SLAVE_URL/builds/$TEST -O $LOGS_DIR/$REPORT_FILE -q | 56 wget $SLAVE_URL/builds/$TEST -O "$LOGS_DIR/$REPORT_FILE" -q |
| 57 echo $SLAVE_URL/builds/$TEST >> $LOGS_DIR/$REPORT_FILE | 57 echo $SLAVE_URL/builds/$TEST >> "$LOGS_DIR/$REPORT_FILE" |
| 58 done | 58 done |
| 59 done | 59 done |
| 60 echo " DONE" | 60 echo " DONE" |
| 61 done | 61 done |
| 62 # }}} | 62 # }}} |
| 63 } | 63 } |
| 64 | 64 |
| 65 match_suppressions() { | 65 match_suppressions() { |
| 66 PYTHONPATH=$THISDIR/../python/google \ | 66 PYTHONPATH=$THISDIR/../python/google \ |
| 67 python $THISDIR/test_suppressions.py $LOGS_DIR/report_* | 67 python "$THISDIR/test_suppressions.py" "$LOGS_DIR/report_"* |
| 68 } | 68 } |
| 69 | 69 |
| 70 if [ "$1" == "fetch" ] | 70 if [ "$1" == "fetch" ] |
| 71 then | 71 then |
| 72 fetch_logs | 72 fetch_logs |
| 73 elif [ "$1" == "match" ] | 73 elif [ "$1" == "match" ] |
| 74 then | 74 then |
| 75 match_suppressions | 75 match_suppressions |
| 76 else | 76 else |
| 77 THISNAME=$(basename "${0}") | 77 THISNAME=$(basename "${0}") |
| 78 echo "Usage: $THISNAME fetch|match" | 78 echo "Usage: $THISNAME fetch|match" |
| 79 echo " fetch - Fetch Valgrind logs from the memory waterfall" | 79 echo " fetch - Fetch Valgrind logs from the memory waterfall" |
| 80 echo " match - Test the local suppression files against the downloaded logs" | 80 echo " match - Test the local suppression files against the downloaded logs" |
| 81 fi | 81 fi |
| OLD | NEW |