Title: [91278] trunk/Tools
Revision
91278
Author
[email protected]
Date
2011-07-19 11:51:27 -0700 (Tue, 19 Jul 2011)

Log Message

Make TestFailures show existing bugs and a new bug link for flaky tests

Fixes <http://webkit.org/b/63728> TestFailures page should make it easy to file bugs about
flaky tests
and
<http://webkit.org/b/63830> TestFailures page doesn't show related bugs for possibly-flaky
tests, but should

Reviewed by Sam Weinig.

* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FlakyTestBugForm.js:
Added. This is what's used to file new bugs about flaky tests.
(FlakyTestBugForm): Calls up to the base class, stores the arguments, and sets our
title, description, and URL.

(FlakyTestBugForm.prototype._createBugDescription):
(FlakyTestBugForm.prototype._createBugTitle):
These do what they say.

* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FlakyTestBugForm_unittests.js:
Added. Tests of the above.

* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/TestFailures.css:
(#failure-history > li):
(#possibly-flaky-tests > li):
(#failure-history > li, #possibly-flaky-tests > li):
(#possibly-flaky-tests > li > :first-child):
(.flakiness-examples-list):
Styling to account for the new elements.

(.expandable):
(.expanded > .expandable):
Generalized the .flakiness-example-list code to a generic .expandable class. Removed the
transition properties because we can't transition to/from 'auto' (but really would like
to!).

* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js:
(ViewController.prototype._displayBuilder): Moved code to create the FailingTestsBugForm
here from _domForNewAndExistingBugs. Updated for changes to _domForPossiblyFlakyTests.
(ViewController.prototype._domForNewAndExistingBugs): Changed to take a NewBugForm as an
argument instead of creating one ourselves.
(ViewController.prototype._domForPossiblyFlakyTests): Changed to take all analyzed builds as
an argument instead of just the number of analyzed builds. Put the examples list inside a
container <div>, which is also used to hold the new/existing bugs UI. Removed code to deal
with animating the height of the examples list; we don't do this anymore because it's hard
to make it work correctly with the asynchronous loading of existing bugs. When we populate
the examples list, also set up the new/existing bug UI.

* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/index.html: Pull in
FlakyTestBugForm.

* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html:
Pull in FlakyTestBugForm and its tests.

Modified Paths

Added Paths

Diff

Added: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FlakyTestBugForm.js (0 => 91278)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FlakyTestBugForm.js	                        (rev 0)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FlakyTestBugForm.js	2011-07-19 18:51:27 UTC (rev 91278)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+function FlakyTestBugForm(bugzilla, tester, failingBuildNames, failingTest, oldestAnalyzedBuild, newestAnalyzedBuild, analyzedBuildCount) {
+    TestRelatedBugForm.call(this, bugzilla, tester);
+
+    this._failingBuildNames = failingBuildNames;
+    this._failingTest = failingTest;
+    this._oldestAnalyzedBuild = oldestAnalyzedBuild;
+    this._newestAnalyzedBuild = newestAnalyzedBuild;
+    this._analyzedBuildCount = analyzedBuildCount;
+
+    this.description = this._createBugDescription();
+    this.title = this._createBugTitle();
+    this.url = ""
+}
+
+FlakyTestBugForm.prototype = {
+    _createBugDescription: function() {
+        var self = this;
+
+        var result = self._failingTest
+            + ' failed ' + self._failingBuildNames.length + ' out of ' + self._analyzedBuildCount + ' times'
+            + ' on ' + self._tester.name
+            + ' between r' + self._tester.buildbot.parseBuildName(self._oldestAnalyzedBuild).revision
+            + ' and r' + self._tester.buildbot.parseBuildName(self._newestAnalyzedBuild).revision
+            + ' (inclusive).\n\n';
+
+        result += 'Failures:\n\n';
+        result += self._failingBuildNames.map(function(buildName) {
+            return self._tester.resultsPageURL(buildName) + '\n';
+        }).join('');
+
+        return result;
+    },
+
+    _createBugTitle: function() {
+        return this._failingTest + ' sometimes fails on ' + this._tester.name;
+    },
+};
+
+FlakyTestBugForm.prototype.__proto__ = TestRelatedBugForm.prototype;

Added: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FlakyTestBugForm_unittests.js (0 => 91278)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FlakyTestBugForm_unittests.js	                        (rev 0)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FlakyTestBugForm_unittests.js	2011-07-19 18:51:27 UTC (rev 91278)
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+(function() {
+
+module('FlakyTestBugForm');
+
+function createTestForm(failingBuildNames, failingTest, oldestAnalyzedBuild, newestAnalyzedBuild, analyzedBuildCount) {
+    var mockBugzilla = {};
+    mockBugzilla.baseURL = '[BUGZILLA BASE URL]';
+
+    var mockBuildbot = {};
+    mockBuildbot.parseBuildName = function(buildName) {
+        var match = /(\d+)/.exec(buildName);
+        return {
+            revision: parseInt(match[1], 10),
+            buildNumber: parseInt(match[2], 10),
+        };
+    };
+
+    var mockBuilder = {};
+    mockBuilder.name = '[BUILDER NAME]';
+    mockBuilder.buildbot = mockBuildbot;
+    mockBuilder.resultsPageURL = function(buildName) {
+        return '[RESULTS PAGE URL ' + this.name + ', ' + buildName + ']';
+    }
+
+    return new FlakyTestBugForm(mockBugzilla, mockBuilder, failingBuildNames, failingTest, oldestAnalyzedBuild, newestAnalyzedBuild, analyzedBuildCount);
+}
+
+const testCases = [
+    {
+        oldestAnalyzedBuild: 'r1 (1)',
+        newestAnalyzedBuild: 'r15 (8)',
+        analyzedBuildCount: 8,
+        failingBuildNames: [
+            'r10 (5)',
+            'r8 (2)',
+        ],
+        failingTest: 'css1/basic/class_as_selector.html',
+        expectedDescription: 'css1/basic/class_as_selector.html failed 2 out of 8 times on [BUILDER NAME] between r1 and r15 (inclusive).\n\nFailures:\n\n[RESULTS PAGE URL [BUILDER NAME], r10 (5)]\n[RESULTS PAGE URL [BUILDER NAME], r8 (2)]\n',
+        expectedTitle: 'css1/basic/class_as_selector.html sometimes fails on [BUILDER NAME]',
+        expectedURL: '[RESULTS PAGE URL [BUILDER NAME], r10 (5)]',
+    },
+];
+
+test('titles', 1, function() {
+    testCases.forEach(function(testCase) {
+        var form = createTestForm(testCase.failingBuildNames, testCase.failingTest, testCase.oldestAnalyzedBuild, testCase.newestAnalyzedBuild, testCase.analyzedBuildCount);
+        equal(form.title, testCase.expectedTitle);
+    });
+});
+
+test('descriptions', 1, function() {
+    testCases.forEach(function(testCase) {
+        var form = createTestForm(testCase.failingBuildNames, testCase.failingTest, testCase.oldestAnalyzedBuild, testCase.newestAnalyzedBuild, testCase.analyzedBuildCount);
+        equal(form.description, testCase.expectedDescription);
+    });
+});
+
+test('URLs', 1, function() {
+    testCases.forEach(function(testCase) {
+        var form = createTestForm(testCase.failingBuildNames, testCase.failingTest, testCase.oldestAnalyzedBuild, testCase.newestAnalyzedBuild, testCase.analyzedBuildCount);
+        equal(form.url, testCase.expectedURL);
+    });
+});
+
+})();

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/TestFailures.css (91277 => 91278)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/TestFailures.css	2011-07-19 18:40:25 UTC (rev 91277)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/TestFailures.css	2011-07-19 18:51:27 UTC (rev 91278)
@@ -31,17 +31,26 @@
 
 #failure-history > li {
     margin-bottom: 10px;
-    padding: 10px 10px 10px 50px;
+    padding: 10px;
 }
 
 #possibly-flaky-tests > li {
-    padding: 1px;
+    padding: 1px 0px;
 }
 
 #failure-history > li, #possibly-flaky-tests > li {
     background-color: #f0f0f0;
+    padding-left: 50px;
 }
 
+#possibly-flaky-tests > li > :first-child {
+    margin-left: -50px;
+}
+
+.flakiness-examples-list {
+    padding: 0;
+}
+
 .test-list {
     margin: 0 0 0 -40px;
     padding: 0;
@@ -75,8 +84,11 @@
     -webkit-transform: rotateZ(90deg);
 }
 
-.flakiness-examples-list {
-    -webkit-transition: height 0.25s;
+.expandable {
     height: 0px;
     overflow: hidden;
 }
+
+.expanded > .expandable {
+    height: auto;
+}

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js (91277 => 91278)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js	2011-07-19 18:40:25 UTC (rev 91277)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js	2011-07-19 18:51:27 UTC (rev 91278)
@@ -103,13 +103,15 @@
 
                 item.appendChild(self._domForRegressionRange(builder, buildName, passingBuildName, failingTestNames));
 
-                if (passingBuildName || !stillFetchingData)
-                    item.appendChild(self._domForNewAndExistingBugs(builder, buildName, passingBuildName, failingTestNames));
+                if (passingBuildName || !stillFetchingData) {
+                    var bugForm = new FailingTestsBugForm(self._bugzilla, self._trac, builder, buildName, passingBuildName, failingTestNames);
+                    item.appendChild(self._domForNewAndExistingBugs(builder, failingTestNames, bugForm))
+                }
             });
 
             self._mainContentElement.removeAllChildren();
             self._mainContentElement.appendChild(list);
-            self._mainContentElement.appendChild(self._domForPossiblyFlakyTests(builder, data.possiblyFlaky, buildNames.length));
+            self._mainContentElement.appendChild(self._domForPossiblyFlakyTests(builder, data.possiblyFlaky, buildNames));
 
             if (!stillFetchingData)
                 PersistentCache.prune();
@@ -323,7 +325,7 @@
         return link;
     },
 
-    _domForNewAndExistingBugs: function(tester, failingBuildName, passingBuildName, failingTests) {
+    _domForNewAndExistingBugs: function(tester, failingTests, bugForm) {
         var result = document.createDocumentFragment();
 
         if (!this._bugzilla)
@@ -385,8 +387,6 @@
             closedList.appendChildren(closedBugs.map(bugToListItem));
         });
 
-        var bugForm = new FailingTestsBugForm(this._bugzilla, this._trac, tester, failingBuildName, passingBuildName, failingTests);
-
         var form = bugForm.domElement();
         result.appendChild(form);
 
@@ -400,7 +400,7 @@
         return result;
     },
 
-    _domForPossiblyFlakyTests: function(builder, possiblyFlakyTestData, buildCount) {
+    _domForPossiblyFlakyTests: function(builder, possiblyFlakyTestData, allBuilds) {
         var result = document.createDocumentFragment();
         var flakyTests = Object.keys(possiblyFlakyTestData);
         if (!flakyTests.length)
@@ -428,21 +428,24 @@
 
             var failures = possiblyFlakyTestData[testName];
 
-            item.appendChild(document.createTextNode(testName + ' (failed ' + failures.length + ' out of ' + buildCount + ' times)'));
+            item.appendChild(document.createTextNode(testName + ' (failed ' + failures.length + ' out of ' + allBuilds.length + ' times)'));
 
-            var failureList = document.createElement('ol');
-            item.appendChild(failureList);
+            var container = document.createElement('div');
+            item.appendChild(container);
 
-            failureList.className = 'flakiness-examples-list';
+            container.className = 'expandable';
 
             disclosureTriangle.addEventListener('click', function() {
                 item.toggleStyleClass('expanded');
-                if (!item.hasStyleClass('expanded')) {
-                    failureList.style.height = '';
+                if (!item.hasStyleClass('expanded'))
                     return;
-                }
 
-                if (!failureList.firstChild) {
+                if (!container.firstChild) {
+                    var failureList = document.createElement('ol');
+                    container.appendChild(failureList);
+
+                    failureList.className = 'flakiness-examples-list';
+
                     failureList.appendChildren(failures.map(function(historyItem) {
                         var item = document.createElement('li');
                         item.appendChild(self._domForBuildName(builder, historyItem.build));
@@ -450,12 +453,11 @@
                         item.appendChild(self._domForFailureDiagnosis(builder, historyItem.build, testName, historyItem.result));
                         return item;
                     }));
+
+                    var failingBuildNames = failures.map(function(historyItem) { return historyItem.build });
+                    var bugForm = new FlakyTestBugForm(self._bugzilla, builder, failingBuildNames, testName, allBuilds.last(), allBuilds[0], allBuilds.length);
+                    container.appendChild(self._domForNewAndExistingBugs(builder, [testName], bugForm));
                 }
-
-                // CSS transitions can't transition to a value of 'auto', so we find out the actual
-                // value using getComputedStyle and transition to that.
-                failureList.style.height = 'auto';
-                failureList.style.height = getComputedStyle(failureList).height;
             });
 
             return item;

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/index.html (91277 => 91278)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/index.html	2011-07-19 18:40:25 UTC (rev 91277)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/index.html	2011-07-19 18:51:27 UTC (rev 91278)
@@ -31,6 +31,7 @@
     <script src=""
     <script src=""
     <script src=""
+    <script src=""
 
     <script src=""
     <script src=""

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html (91277 => 91278)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html	2011-07-19 18:40:25 UTC (rev 91277)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html	2011-07-19 18:51:27 UTC (rev 91278)
@@ -27,6 +27,9 @@
 <script src=""
 <script src=""
 
+<script src=""
+<script src=""
+
 <script src=""
 <script src=""
 

Modified: trunk/Tools/ChangeLog (91277 => 91278)


--- trunk/Tools/ChangeLog	2011-07-19 18:40:25 UTC (rev 91277)
+++ trunk/Tools/ChangeLog	2011-07-19 18:51:27 UTC (rev 91278)
@@ -1,3 +1,59 @@
+2011-07-19  Adam Roben  <[email protected]>
+
+        Make TestFailures show existing bugs and a new bug link for flaky tests
+
+        Fixes <http://webkit.org/b/63728> TestFailures page should make it easy to file bugs about
+        flaky tests
+        and
+        <http://webkit.org/b/63830> TestFailures page doesn't show related bugs for possibly-flaky
+        tests, but should
+
+        Reviewed by Sam Weinig.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FlakyTestBugForm.js:
+        Added. This is what's used to file new bugs about flaky tests.
+        (FlakyTestBugForm): Calls up to the base class, stores the arguments, and sets our
+        title, description, and URL.
+
+        (FlakyTestBugForm.prototype._createBugDescription):
+        (FlakyTestBugForm.prototype._createBugTitle):
+        These do what they say.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FlakyTestBugForm_unittests.js:
+        Added. Tests of the above.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/TestFailures.css:
+        (#failure-history > li):
+        (#possibly-flaky-tests > li):
+        (#failure-history > li, #possibly-flaky-tests > li):
+        (#possibly-flaky-tests > li > :first-child):
+        (.flakiness-examples-list):
+        Styling to account for the new elements.
+
+        (.expandable):
+        (.expanded > .expandable):
+        Generalized the .flakiness-example-list code to a generic .expandable class. Removed the
+        transition properties because we can't transition to/from 'auto' (but really would like
+        to!).
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js:
+        (ViewController.prototype._displayBuilder): Moved code to create the FailingTestsBugForm
+        here from _domForNewAndExistingBugs. Updated for changes to _domForPossiblyFlakyTests.
+        (ViewController.prototype._domForNewAndExistingBugs): Changed to take a NewBugForm as an
+        argument instead of creating one ourselves.
+        (ViewController.prototype._domForPossiblyFlakyTests): Changed to take all analyzed builds as
+        an argument instead of just the number of analyzed builds. Put the examples list inside a
+        container <div>, which is also used to hold the new/existing bugs UI. Removed code to deal
+        with animating the height of the examples list; we don't do this anymore because it's hard
+        to make it work correctly with the asynchronous loading of existing bugs. When we populate
+        the examples list, also set up the new/existing bug UI.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/index.html: Pull in
+        FlakyTestBugForm.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html:
+        Pull in FlakyTestBugForm and its tests.
+
 2011-07-19  Ryosuke Niwa  <[email protected]>
 
         Buildbot marks a nrwt bot red when tests are missing results
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to