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 |
(...skipping 27 matching lines...) Expand all Loading... |
38 else | 38 else |
39 echo "Need either curl or wget to download stuff... aborting" | 39 echo "Need either curl or wget to download stuff... aborting" |
40 exit 1 | 40 exit 1 |
41 fi | 41 fi |
42 # }}} | 42 # }}} |
43 } | 43 } |
44 | 44 |
45 fetch_logs() { | 45 fetch_logs() { |
46 # Fetch Valgrind logs from the waterfall {{{1 | 46 # Fetch Valgrind logs from the waterfall {{{1 |
47 | 47 |
| 48 # TODO(timurrrr,maruel): use JSON, see |
| 49 # http://build.chromium.org/p/chromium.memory/json/help |
| 50 |
48 rm -rf "$LOGS_DIR" # Delete old logs | 51 rm -rf "$LOGS_DIR" # Delete old logs |
49 mkdir "$LOGS_DIR" | 52 mkdir "$LOGS_DIR" |
50 | 53 |
51 echo "Fetching the list of builders..." | 54 echo "Fetching the list of builders..." |
52 download $WATERFALL_PAGE "$LOGS_DIR/builders" | 55 download $WATERFALL_PAGE "$LOGS_DIR/builders" |
53 SLAVES=$(grep "<a href=\"builders\/" "$LOGS_DIR/builders" | \ | 56 SLAVES=$(grep "<a href=\"builders\/" "$LOGS_DIR/builders" | \ |
54 sed "s/.*<a href=\"builders\///" | sed "s/\".*//" | \ | 57 sed "s/.*<a href=\"builders\///" | sed "s/\".*//" | \ |
55 sort | uniq) | 58 sort | uniq) |
56 | 59 |
57 for S in $SLAVES | 60 for S in $SLAVES |
58 do | 61 do |
59 SLAVE_URL=$WATERFALL_PAGE/$S | 62 SLAVE_URL=$WATERFALL_PAGE/$S |
60 SLAVE_NAME=$(echo $S | sed -e "s/%20/ /g" -e "s/%28/(/g" -e "s/%29/)/g") | 63 SLAVE_NAME=$(echo $S | sed -e "s/%20/ /g" -e "s/%28/(/g" -e "s/%29/)/g") |
61 echo -n "Fetching builds by slave '${SLAVE_NAME}'" | 64 echo -n "Fetching builds by slave '${SLAVE_NAME}'" |
62 download $SLAVE_URL "$LOGS_DIR/slave_${S}" | 65 download $SLAVE_URL "$LOGS_DIR/slave_${S}" |
63 | 66 |
64 # We speed up the 'fetch' step by skipping the builds/tests which succeeded. | 67 # We speed up the 'fetch' step by skipping the builds/tests which succeeded. |
65 # TODO(timurrrr): OTOH, we won't be able to check | 68 # TODO(timurrrr): OTOH, we won't be able to check |
66 # if some suppression is not used anymore. | 69 # if some suppression is not used anymore. |
67 LIST_OF_BUILDS=$(grep "<a href=\"\.\./builders/.*/builds/[0-9]\+.*failed" \ | 70 LIST_OF_BUILDS=$(grep "rev.*<a href=\"\.\./builders/.*/builds/[0-9]\+" \ |
68 "$LOGS_DIR/slave_$S" | grep -v "failed compile" | \ | 71 "$LOGS_DIR/slave_$S" | head -n 2 | \ |
69 sed "s/.*\/builds\///" | sed "s/\".*//" | head -n 2) | 72 grep "failed" | grep -v "failed compile" | \ |
| 73 sed "s/.*\/builds\///" | sed "s/\".*//") |
70 | 74 |
71 for BUILD in $LIST_OF_BUILDS | 75 for BUILD in $LIST_OF_BUILDS |
72 do | 76 do |
73 BUILD_RESULTS="$LOGS_DIR/slave_${S}_build_${BUILD}" | 77 # We'll fetch a few tiny URLs now, let's use a temp file. |
74 download $SLAVE_URL/builds/$BUILD "$BUILD_RESULTS" | 78 TMPFILE=$(mktemp) |
75 LIST_OF_TESTS=$(grep "<a href=\"[0-9]\+/steps/memory.*/logs/stdio\"" \ | 79 download $SLAVE_URL/builds/$BUILD "$TMPFILE" |
76 "$BUILD_RESULTS" | \ | 80 |
77 sed "s/.*a href=\"//" | sed "s/\".*//") | 81 REPORT_FILE="$LOGS_DIR/report_${S}_${BUILD}" |
78 for TEST in $LIST_OF_TESTS | 82 rm -f $REPORT_FILE 2>/dev/null || true # make sure it doesn't exist |
| 83 |
| 84 REPORT_URLS=$(grep -o "[0-9]\+/steps/memory.*/logs/[0-9A-F]\{16\}" \ |
| 85 "$TMPFILE" || true) # `true` is to succeed on empty output |
| 86 FAILED_TESTS=$(grep -o "[0-9]\+/steps/memory.*/logs/[A-Za-z0-9.]\+" \ |
| 87 "$TMPFILE" | grep -v "[0-9A-F]\{16\}" | grep -v "stdio" \ |
| 88 || true) |
| 89 |
| 90 for REPORT in $REPORT_URLS |
79 do | 91 do |
80 REPORT_FILE=$(echo "report_${S}_$TEST" | sed "s/\/logs\/stdio//" | \ | 92 download "$SLAVE_URL/builds/$REPORT/text" "$TMPFILE" |
81 sed "s/\/steps//" | sed "s/\//_/g") | 93 echo "" >> "$TMPFILE" # Add a newline at the end |
82 echo -n "." | 94 cat "$TMPFILE" | tr -d '\r' >> "$REPORT_FILE" |
83 download $SLAVE_URL/builds/$TEST "$LOGS_DIR/$REPORT_FILE" | |
84 echo $SLAVE_URL/builds/$TEST >> "$LOGS_DIR/$REPORT_FILE" | |
85 done | 95 done |
| 96 |
| 97 for FAILURE in $FAILED_TESTS |
| 98 do |
| 99 echo -n "FAILED:" >> "$REPORT_FILE" |
| 100 echo "$FAILURE" | sed -e "s/.*\/logs\///" -e "s/\/.*//" \ |
| 101 >> "$REPORT_FILE" |
| 102 done |
| 103 |
| 104 rm "$TMPFILE" |
| 105 echo $SLAVE_URL/builds/$BUILD >> "$REPORT_FILE" |
86 done | 106 done |
87 echo " DONE" | 107 echo " DONE" |
88 done | 108 done |
89 # }}} | 109 # }}} |
90 } | 110 } |
91 | 111 |
92 match_suppressions() { | 112 match_suppressions() { |
93 PYTHONPATH=$THISDIR/../python/google \ | 113 PYTHONPATH=$THISDIR/../python/google \ |
94 python "$THISDIR/test_suppressions.py" "$LOGS_DIR/report_"* | 114 python "$THISDIR/test_suppressions.py" "$LOGS_DIR/report_"* |
95 } | 115 } |
96 | 116 |
97 match_gtest_excludes() { | 117 match_gtest_excludes() { |
98 for PLATFORM in "Linux" "Chromium%20Mac" "Chromium%20OS" | 118 for PLATFORM in "Linux" "Chromium%20Mac" "Chromium%20OS" |
99 do | 119 do |
100 echo | 120 echo |
101 echo "Test failures on ${PLATFORM}:" | sed "s/%20/ /" | 121 echo "Test failures on ${PLATFORM}:" | sed "s/%20/ /" |
102 grep "\[ FAILED \] .* ([0-9]\+ ms)" -R "$LOGS_DIR"/*${PLATFORM}* | \ | 122 grep -h -o "^FAILED:.*" -R "$LOGS_DIR"/*${PLATFORM}* | \ |
103 grep -v "FAILS\|FLAKY" | \ | 123 grep -v "FAILS\|FLAKY" | sort | uniq | \ |
104 sed -e "s/.*%20//" -e "s/_[1-9]\+:/:/" \ | 124 sed -e "s/^FAILED://" -e "s/^/ /" |
105 -e "s/\[ FAILED \] //" -e "s/ ([0-9]\+ ms)//" -e "s/^/ /" | |
106 # Don't put any operators between "grep | sed" and "RESULT=$PIPESTATUS" | 125 # Don't put any operators between "grep | sed" and "RESULT=$PIPESTATUS" |
107 RESULT=$PIPESTATUS | 126 RESULT=$PIPESTATUS |
108 | 127 |
109 if [ "$RESULT" == 1 ] | 128 if [ "$RESULT" == 1 ] |
110 then | 129 then |
111 echo " None!" | 130 echo " None!" |
112 else | 131 else |
113 echo | 132 echo |
114 echo " Note: we don't check for failures already excluded locally yet" | 133 echo " Note: we don't check for failures already excluded locally yet" |
115 echo " TODO(timurrrr): don't list tests we've already excluded locally" | 134 echo " TODO(timurrrr): don't list tests we've already excluded locally" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 find_blame "$2" "$3" "$4" | 254 find_blame "$2" "$3" "$4" |
236 else | 255 else |
237 THISNAME=$(basename "${0}") | 256 THISNAME=$(basename "${0}") |
238 echo "Usage: $THISNAME fetch|match|blame <builder> <test> <hash>" | 257 echo "Usage: $THISNAME fetch|match|blame <builder> <test> <hash>" |
239 echo " fetch - Fetch Valgrind logs from the memory waterfall" | 258 echo " fetch - Fetch Valgrind logs from the memory waterfall" |
240 echo " match - Test the local suppression files against the downloaded logs" | 259 echo " match - Test the local suppression files against the downloaded logs" |
241 echo " blame - Return the blame list for the revision where the suppression" | 260 echo " blame - Return the blame list for the revision where the suppression" |
242 echo " <hash> occured for the first time in the log for <test> on" | 261 echo " <hash> occured for the first time in the log for <test> on" |
243 echo " <builder>" | 262 echo " <builder>" |
244 fi | 263 fi |
OLD | NEW |