OLD | NEW |
1 <!-- | 1 <!-- |
2 Copyright 2014 The Chromium Authors. All rights reserved. | 2 Copyright 2014 The Chromium Authors. All rights reserved. |
3 Use of this source code is governed by a BSD-style license that can be | 3 Use of this source code is governed by a BSD-style license that can be |
4 found in the LICENSE file. | 4 found in the LICENSE file. |
5 --> | 5 --> |
6 | 6 |
7 <link rel="import" href="../model/ct-failure.html"> | 7 <link rel="import" href="../model/ct-failure.html"> |
8 | 8 |
9 <polymer-element name="ct-failure-analyzer" attributes="failures builderLatestRe
visions"> | 9 <polymer-element name="ct-failure-analyzer" attributes="failures builderLatestRe
visions"> |
10 <script> | 10 <script> |
11 // FIXME: Don't use a polymer component for this. Instead use a Failures mod
el | 11 // FIXME: Don't use a polymer component for this. Instead use a Failures mod
el |
12 // object that knows how to do the XHR and process the data appropriately. | 12 // object that knows how to do the XHR and process the data appropriately. |
13 Polymer({ | 13 Polymer({ |
14 builderLatestRevisions: {}, | 14 builderLatestRevisions: null, |
15 failures: {}, | 15 failures: null, |
| 16 |
| 17 // FIXME: Get this from https://chromium.googlesource.com/chromium/tools/b
uild/+/master/scripts/slave/gatekeeper_trees.json?format=text. |
| 18 _trees: { |
| 19 blink: [ |
| 20 "https://build.chromium.org/p/chromium.webkit", |
| 21 ], |
| 22 chromium: [ |
| 23 "https://build.chromium.org/p/chromium", |
| 24 "https://build.chromium.org/p/chromium.chrome", |
| 25 "https://build.chromium.org/p/chromium.chromiumos", |
| 26 "https://build.chromium.org/p/chromium.gpu", |
| 27 "https://build.chromium.org/p/chromium.linux", |
| 28 "https://build.chromium.org/p/chromium.mac", |
| 29 "https://build.chromium.org/p/chromium.memory", |
| 30 "https://build.chromium.org/p/chromium.win" |
| 31 ], |
| 32 }, |
16 | 33 |
17 update: function() { | 34 update: function() { |
18 net.json('http://auto-sheriff.appspot.com/data').then(function(data) { | 35 net.json('http://auto-sheriff.appspot.com/data').then(function(data) { |
19 // FIXME: Don't special-case the blink master. | 36 // FIXME: Don't special-case the blink master. |
20 this.builderLatestRevisions = data.latest_revisions['chromium.webkit']
; | 37 this.builderLatestRevisions = data.latest_revisions['chromium.webkit']
; |
21 this.failures = []; | 38 // FIXME: Make this a model class intead of a dumb object. |
| 39 this.failures = {}; |
22 data.range_groups.forEach(function(group) { | 40 data.range_groups.forEach(function(group) { |
23 this._processFailuresForGroup(group, data.alerts); | 41 this._processFailuresForGroup(group, data.alerts); |
24 }.bind(this)); | 42 }.bind(this)); |
25 // FIXME: Sort this.failures by severity of regression, then by oldest
FailingRevision. | 43 // FIXME: Sort this.failures by severity of regression, then by oldest
FailingRevision. |
26 }.bind(this)); | 44 }.bind(this)); |
27 }, | 45 }, |
28 | 46 |
29 _failureComparator: function(a, b) { | 47 _failureComparator: function(a, b) { |
30 if (a.step > b.step) | 48 if (a.step > b.step) |
31 return 1; | 49 return 1; |
32 if (a.step < b.step) | 50 if (a.step < b.step) |
33 return -1 | 51 return -1 |
34 if (a.testName > b.testName) | 52 if (a.testName > b.testName) |
35 return 1; | 53 return 1; |
36 if (a.testName < b.testName) | 54 if (a.testName < b.testName) |
37 return -1 | 55 return -1 |
38 return 0; | 56 return 0; |
39 }, | 57 }, |
40 | 58 |
41 _processFailuresForGroup: function(group, failures) { | 59 _processFailuresForGroup: function(group, failures) { |
42 var failuresByReason = {}; | 60 var failuresByReason = {}; |
43 | 61 |
| 62 var masterToTree = {}; |
| 63 Object.keys(this._trees, function(tree, masters) { |
| 64 masters.forEach(function(master) { |
| 65 masterToTree[master] = tree; |
| 66 }); |
| 67 }); |
| 68 |
44 group.failure_keys.forEach(function(failure_key) { | 69 group.failure_keys.forEach(function(failure_key) { |
45 var failure = failures.find(function(item) { return item.key == failur
e_key; }); | 70 var failure = failures.find(function(item) { return item.key == failur
e_key; }); |
46 if (failure.ignored_by.length) | 71 if (failure.ignored_by.length) |
47 return; | 72 return; |
48 | 73 |
49 // FIXME: Make sheriff-o-matic work for all waterfalls. | |
50 if (!failure.master_url.endsWith('chromium.webkit')) | |
51 return; | |
52 | |
53 var reason, failureType; | 74 var reason, failureType; |
54 if (failure.reason) { | 75 if (failure.reason) { |
55 // FIXME: Store the actual failure type in a different field instead
of smashing it into the reason. | 76 // FIXME: Store the actual failure type in a different field instead
of smashing it into the reason. |
56 var parts = failure.reason.split(':'); | 77 var parts = failure.reason.split(':'); |
57 reason = parts[0]; | 78 reason = parts[0]; |
58 failureType = parts[1] || 'FAIL'; | 79 failureType = parts[1] || 'FAIL'; |
59 } else { | 80 } else { |
60 reason = null; | 81 reason = null; |
61 failureType = 'UNKNOWN'; | 82 failureType = 'UNKNOWN'; |
62 } | 83 } |
63 | 84 |
64 var failureKey = JSON.stringify({ | 85 var failureKey = JSON.stringify({ |
65 step: failure.step_name, | 86 step: failure.step_name, |
66 reason: reason, | 87 reason: reason, |
67 }); | 88 }); |
68 | 89 |
| 90 var tree = masterToTree[failure.master_url]; |
| 91 |
69 // FIXME: Use a model class instead of a dumb object. | 92 // FIXME: Use a model class instead of a dumb object. |
70 if (!failuresByReason[failureKey]) | 93 if (!failuresByReason[failureKey]) |
71 failuresByReason[failureKey] = {}; | 94 failuresByReason[failureKey] = {}; |
72 // FIXME: If we have multiple builders with the same name across maste
rs in | 95 if (!failuresByReason[failureKey][tree]) |
73 // a failure group, then this will incorrectly overwrite one of the va
lues. | 96 failuresByReason[failureKey][tree] = {}; |
74 failuresByReason[failureKey][failure.builder_name] = { | 97 failuresByReason[failureKey][tree][failure.builder_name] = { |
75 // FIXME: Rename to failureType. | 98 // FIXME: Rename to failureType. |
76 actual: failureType, | 99 actual: failureType, |
77 lastFailingBuild: failure.last_failing_build, | 100 lastFailingBuild: failure.last_failing_build, |
78 masterUrl: failure.master_url, | 101 masterUrl: failure.master_url, |
79 }; | 102 }; |
80 }.bind(this)); | 103 }.bind(this)); |
81 | 104 |
82 var groupedFailures = []; | 105 var groupedFailures = {}; |
83 | 106 Object.keys(failuresByReason, function(failureKey, resultsByTree) { |
84 var oldestFailingRevision, newestPassingRevision; | |
85 // FIXME: This is a workaround for the backend's bogus data when the bli
nk | |
86 // regression ranges have no overlap. | |
87 if (group.merged_last_passing && group.merged_first_failing.blink > grou
p.merged_last_passing.blink) { | |
88 oldestFailingRevision = Number(group.merged_first_failing.blink); | |
89 newestPassingRevision = Number(group.merged_last_passing.blink); | |
90 } | |
91 | |
92 Object.keys(failuresByReason, function(failureKey, resultByBuilder) { | |
93 var failure = JSON.parse(failureKey); | 107 var failure = JSON.parse(failureKey); |
94 groupedFailures.push(new CTFailure(failure.step, failure.reason, resul
tByBuilder, oldestFailingRevision, newestPassingRevision)); | 108 Object.keys(resultsByTree, function(tree, resultsByBuilder) { |
| 109 if (!groupedFailures[tree]) |
| 110 groupedFailures[tree] = []; |
| 111 groupedFailures[tree].push(new CTFailure(failure.step, failure.reaso
n, resultsByBuilder, group.merged_first_failing, group.merged_last_passing)); |
| 112 }) |
95 }); | 113 }); |
96 | 114 |
97 // FIXME: Make this a model class intead of a dumb object. | 115 Object.keys(groupedFailures, function(tree, failures) { |
98 groupedFailures.sort(this._failureComparator); | 116 failures.sort(this._failureComparator); |
99 | 117 |
100 if (groupedFailures.length) | 118 if (!this.failures[tree]) |
101 this.failures.push(groupedFailures); | 119 this.failures[tree] = []; |
| 120 this.failures[tree].push(failures); |
| 121 }.bind(this)); |
102 }, | 122 }, |
103 }); | 123 }); |
104 </script> | 124 </script> |
105 </polymer-element> | 125 </polymer-element> |
OLD | NEW |