Please clarify "pending" reporting at build.webkit.org/dashboard
[WebKit-https.git] / Tools / BuildSlaveSupport / build.webkit.org-config / public_html / dashboard / Scripts / BuildbotTesterQueueView.js
1 /*
2  * Copyright (C) 2013 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 BuildbotTesterQueueView = function(debugQueues, releaseQueues)
27 {
28     BuildbotQueueView.call(this, debugQueues, releaseQueues);
29
30     this.update();
31 };
32
33 BaseObject.addConstructorFunctions(BuildbotTesterQueueView);
34
35 BuildbotTesterQueueView.prototype = {
36     constructor: BuildbotTesterQueueView,
37     __proto__: BuildbotQueueView.prototype,
38
39     update: function()
40     {
41         BuildbotQueueView.prototype.update.call(this);
42
43         this.element.removeChildren();
44
45         function appendBuilderQueueStatus(queue)
46         {
47             this._appendPendingRevisionCount(queue);
48
49             var appendedStatus = false;
50
51             var limit = 2;
52             for (var i = 0; i < queue.iterations.length && limit > 0; ++i) {
53                 var iteration = queue.iterations[i];
54                 if (!iteration.loaded || !iteration.finished)
55                     continue;
56
57                 --limit;
58
59                 var messageLinkElement = this.revisionLinksForIteration(iteration);
60
61                 var layoutTestResults = iteration.layoutTestResults || {failureCount: 0};
62                 var javascriptTestResults = iteration.javascriptTestResults || {failureCount: 0};
63                 var apiTestResults = iteration.apiTestResults || {failureCount: 0};
64                 var pythonTestResults = iteration.pythonTestResults || {failureCount: 0};
65                 var perlTestResults = iteration.perlTestResults || {failureCount: 0};
66                 var bindingTestResults = iteration.bindingTestResults || {errorOccurred: false};
67
68                 if (!iteration.failed) {
69                     var status = new StatusLineView(messageLinkElement, StatusLineView.Status.Good, "all tests passed");
70                     limit = 0;
71                 } else if (!layoutTestResults.failureCount && !javascriptTestResults.failureCount && !apiTestResults.failureCount && !pythonTestResults.failureCount && !perlTestResults.failureCount && !bindingTestResults.errorOccurred) {
72                     // Something wrong happened, but it was not a test failure.
73                     var url = iteration.queue.buildbot.buildPageURLForIteration(iteration);
74                     var status = new StatusLineView(messageLinkElement, StatusLineView.Status.Danger, iteration.text, undefined, url);
75                 } else if (layoutTestResults.failureCount && !javascriptTestResults.failureCount && !apiTestResults.failureCount && !pythonTestResults.failureCount && !perlTestResults.failureCount && !bindingTestResults.errorOccurred) {
76                     var url = iteration.queue.buildbot.layoutTestResultsURLForIteration(iteration);
77                     var status = new StatusLineView(messageLinkElement, StatusLineView.Status.Bad, layoutTestResults.failureCount === 1 ? "layout test failure" : "layout test failures", layoutTestResults.tooManyFailures ? layoutTestResults.failureCount + "\uff0b" : layoutTestResults.failureCount, url);
78                 } else if (!layoutTestResults.failureCount && javascriptTestResults.failureCount && !apiTestResults.failureCount && !pythonTestResults.failureCount && !perlTestResults.failureCount && !bindingTestResults.errorOccurred) {
79                     var url = iteration.queue.buildbot.javascriptTestResultsURLForIteration(iteration);
80                     var status = new StatusLineView(messageLinkElement, StatusLineView.Status.Bad, javascriptTestResults.failureCount === 1 ? "javascript test failure" : "javascript test failures", javascriptTestResults.failureCount, url);
81                 } else if (!layoutTestResults.failureCount && !javascriptTestResults.failureCount && apiTestResults.failureCount && !pythonTestResults.failureCount && !perlTestResults.failureCount && !bindingTestResults.errorOccurred) {
82                     var url = iteration.queue.buildbot.apiTestResultsURLForIteration(iteration);
83                     var status = new StatusLineView(messageLinkElement, StatusLineView.Status.Bad, apiTestResults.failureCount === 1 ? "api test failure" : "api test failures", apiTestResults.failureCount, url);
84                 } else if (!layoutTestResults.failureCount && !javascriptTestResults.failureCount && !apiTestResults.failureCount && pythonTestResults.failureCount && !perlTestResults.failureCount && !bindingTestResults.errorOccurred) {
85                     var url = iteration.queue.buildbot.webkitpyTestResultsURLForIteration(iteration);
86                     var status = new StatusLineView(messageLinkElement, StatusLineView.Status.Bad, pythonTestResults.failureCount === 1 ? "webkitpy test failure" : "webkitpy test failures", pythonTestResults.failureCount, url);
87                 } else if (!layoutTestResults.failureCount && !javascriptTestResults.failureCount && !apiTestResults.failureCount && !pythonTestResults.failureCount && perlTestResults.failureCount && !bindingTestResults.errorOccurred) {
88                     var url = iteration.queue.buildbot.webkitperlTestResultsURLForIteration(iteration);
89                     var status = new StatusLineView(messageLinkElement, StatusLineView.Status.Bad, perlTestResults.failureCount === 1 ? "webkitperl test failure" : "webkitperl test failures", perlTestResults.failureCount, url);
90                 } else if (!layoutTestResults.failureCount && !javascriptTestResults.failureCount && !apiTestResults.failureCount && !pythonTestResults.failureCount && !perlTestResults.failureCount && bindingTestResults.errorOccurred) {
91                     var url = iteration.queue.buildbot.bindingsTestResultsURLForIteration(iteration);
92                     var status = new StatusLineView(messageLinkElement, StatusLineView.Status.Bad, "bindings tests failed", undefined, url);
93                 } else {
94                     var url = iteration.queue.buildbot.buildPageURLForIteration(iteration);
95                     var totalFailures = layoutTestResults.failureCount + javascriptTestResults.failureCount + apiTestResults.failureCount + pythonTestResults.failureCount + perlTestResults.failureCount + bindingTestResults.errorOccurred;
96                     var status = new StatusLineView(messageLinkElement, StatusLineView.Status.Bad, totalFailures === 1 ? "test failure" : "test failures", totalFailures, url);
97                 }
98
99                 this.element.appendChild(status.element);
100                 appendedStatus = true;
101             }
102
103             if (!appendedStatus) {
104                 var status = new StatusLineView("unknown", StatusLineView.Status.Neutral, "last passing build");
105                 this.element.appendChild(status.element);
106             }
107         }
108
109         function appendBuild(queues, label)
110         {
111             queues.forEach(function(queue) {
112                 var releaseLabel = document.createElement("a");
113                 releaseLabel.classList.add("queueLabel");
114                 releaseLabel.textContent = label;
115                 releaseLabel.href = queue.overviewURL;
116                 releaseLabel.target = "_blank";
117                 this.element.appendChild(releaseLabel);
118
119                 appendBuilderQueueStatus.call(this, queue);
120             }.bind(this));
121         }
122
123         appendBuild.call(this, this.releaseQueues, "Release");
124         appendBuild.call(this, this.debugQueues, "Debug");
125     },
126 };