OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2011 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 function FailingTestsBugForm(tester, failingBuildName, passingBuildName, failing
Tests) { | |
27 TestRelatedBugForm.call(this, tester); | |
28 | |
29 this._failingBuildName = failingBuildName; | |
30 this._passingBuildName = passingBuildName; | |
31 this._failingTests = failingTests; | |
32 | |
33 this.description = this._createBugDescription(); | |
34 // FIXME: When a newly-added test has been failing since its introduction, i
t isn't really a | |
35 // "regression". We should use different keywords in that case. <http://webk
it.org/b/61645> | |
36 this.keywords += ', ' + WebKitBugzilla.Keyword.Regression; | |
37 this.title = this._createBugTitle(); | |
38 this.url = this._failingResultsHTMLURL(); | |
39 } | |
40 | |
41 FailingTestsBugForm.prototype = { | |
42 _createBugDescription: function() { | |
43 var firstSuspectRevision = this._passingRevision() ? this._passingRevisi
on() + 1 : this._failingRevision(); | |
44 var lastSuspectRevision = this._failingRevision(); | |
45 | |
46 var endOfFirstSentence; | |
47 if (this._passingBuildName) { | |
48 endOfFirstSentence = 'started failing on ' + this._tester.name; | |
49 if (firstSuspectRevision === lastSuspectRevision) | |
50 endOfFirstSentence += ' in r' + firstSuspectRevision + ' <' + tr
ac.changesetURL(firstSuspectRevision) + '>'; | |
51 else | |
52 endOfFirstSentence += ' between r' + firstSuspectRevision + ' an
d r' + lastSuspectRevision + ' (inclusive)'; | |
53 } else | |
54 endOfFirstSentence = (this._failingTests.length === 1 ? 'has' : 'hav
e') + ' been failing on ' + this._tester.name + ' since at least r' + firstSuspe
ctRevision + ' <' + trac.changesetURL(firstSuspectRevision) + '>'; | |
55 var description; | |
56 if (this._failingTests.length === 1) | |
57 description = this._failingTests[0] + ' ' + endOfFirstSentence + '.\
n\n'; | |
58 else if (this._failingTests.length === 2) | |
59 description = this._failingTests.join(' and ') + ' ' + endOfFirstSen
tence + '.\n\n'; | |
60 else { | |
61 description = 'The following tests ' + endOfFirstSentence + ':\n\n' | |
62 + this._failingTests.map(function(test) { return ' ' + test }
).join('\n') | |
63 + '\n\n'; | |
64 } | |
65 if (firstSuspectRevision !== lastSuspectRevision) | |
66 description += trac.logURL('trunk', firstSuspectRevision, lastSuspec
tRevision) + '\n\n'; | |
67 if (this._passingBuildName) | |
68 description += this._tester.resultsPageURL(this._passingBuildName) +
' passed\n'; | |
69 description += this._failingResultsHTMLURL() + ' failed\n'; | |
70 | |
71 return description; | |
72 }, | |
73 | |
74 _createBugTitle: function() { | |
75 // FIXME: When a newly-added test has been failing since its introductio
n, it isn't really a | |
76 // "regression". We should use a different title in that case. <http://w
ebkit.org/b/61645> | |
77 | |
78 var titlePrefix = 'REGRESSION (' + this._regressionRangeString() + '): '
; | |
79 var titleSuffix = ' failing on ' + this._tester.name; | |
80 var title = titlePrefix + this._failingTests.join(', ') + titleSuffix; | |
81 | |
82 if (title.length <= bugzilla.kMaximumBugTitleLength) | |
83 return title; | |
84 | |
85 var pathPrefix = longestCommonPathPrefix(this._failingTests); | |
86 if (pathPrefix) { | |
87 title = titlePrefix + this._failingTests.length + ' ' + pathPrefix +
' tests' + titleSuffix; | |
88 if (title.length <= bugzilla.kMaximumBugTitleLength) | |
89 return title; | |
90 } | |
91 | |
92 title = titlePrefix + this._failingTests.length + ' tests' + titleSuffix
; | |
93 | |
94 console.assert(title.length <= bugzilla.kMaximumBugTitleLength); | |
95 return title; | |
96 }, | |
97 | |
98 _failingResultsHTMLURL: function() { | |
99 return this._tester.resultsPageURL(this._failingBuildName); | |
100 }, | |
101 | |
102 _failingRevision: function() { | |
103 return this._tester.buildbot.parseBuildName(this._failingBuildName).revi
sion; | |
104 }, | |
105 | |
106 _passingRevision: function() { | |
107 if (!this._passingBuildName) | |
108 return null; | |
109 return this._tester.buildbot.parseBuildName(this._passingBuildName).revi
sion; | |
110 }, | |
111 | |
112 _regressionRangeString: function() { | |
113 var failingRevision = this._failingRevision(); | |
114 var passingRevision = this._passingRevision(); | |
115 if (!passingRevision || failingRevision - passingRevision <= 1) | |
116 return 'r' + failingRevision; | |
117 return 'r' + passingRevision + '-r' + failingRevision; | |
118 }, | |
119 }; | |
120 | |
121 FailingTestsBugForm.prototype.__proto__ = TestRelatedBugForm.prototype; | |
OLD | NEW |