From e54a543c459b0483c268a8b2f3d156346690dfa0 Mon Sep 17 00:00:00 2001 From: "abarth@webkit.org" Date: Tue, 27 Sep 2011 21:02:34 +0000 Subject: [PATCH] garden-o-matic examine buttons shows both expected and unexpected failures https://bugs.webkit.org/show_bug.cgi?id=68918 Reviewed by Dimitri Glazkov. This was a copy/paste error when I refactored this classes to share more code. * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers.js: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96153 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- .../public_html/TestFailures/run-unittests.html | 1 + .../TestFailures/scripts/controllers.js | 15 ++--- .../TestFailures/scripts/controllers_unittests.js | 69 ++++++++++++++++++++++ .../TestFailures/scripts/garden-o-matic.js | 14 ++++- .../TestFailures/scripts/results_unittests.js | 20 ++++--- Tools/ChangeLog | 12 ++++ 6 files changed, 111 insertions(+), 20 deletions(-) create mode 100644 Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers_unittests.js diff --git a/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html index 638de7c..673cfe8 100644 --- a/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html +++ b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html @@ -65,6 +65,7 @@ THE POSSIBILITY OF SUCH DAMAGE. + diff --git a/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers.js b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers.js index 7af63ee..cb2fc0f 100644 --- a/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers.js +++ b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers.js @@ -100,9 +100,11 @@ var FailureStreamController = base.extends(Object, { _keyFor: function(failureAnalysis) { throw "Not implemented!"; }, _createFailureView: function(failureAnalysis) { throw "Not implemented!"; }, - init: function(view) + init: function(model, view, delegate) { + this._model = model; this._view = view; + this._delegate = delegate; this._testFailures = new base.UpdateTracker(); }, update: function(failureAnalysis) @@ -139,18 +141,13 @@ var FailureStreamController = base.extends(Object, { var testNameList = failures.testNameList(); var failuresByTest = base.filterDictionary( - this._resultsFilter(model.state.resultsByBuilder), + this._resultsFilter(this._model.resultsByBuilder), function(key) { return testNameList.indexOf(key) != -1; }); var controller = new controllers.ResultsDetails(resultsView, failuresByTest); - - // FIXME: This doesn't belong here. - var onebar = $('#onebar')[0]; - var resultsContainer = onebar.results(); - $(resultsContainer).empty().append(resultsView); - onebar.select('results'); + this._delegate.showResults(resultsView); }, _toFailureInfoList: function(failures) { @@ -167,7 +164,7 @@ var FailureStreamController = base.extends(Object, { }); controllers.UnexpectedFailures = base.extends(FailureStreamController, { - _resultsFilter: results.expectedOrUnexpectedFailuresByTest, + _resultsFilter: results.unexpectedFailuresByTest, _impliedFirstFailingRevision: function(failureAnalysis) { diff --git a/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers_unittests.js b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers_unittests.js new file mode 100644 index 0000000..bea57ce --- /dev/null +++ b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers_unittests.js @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2011 Google 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 () { + +var kExampleResultsByBuilder = { + "Mock Builder": unittest.kExampleResultsJSON, +}; + +module("controllers"); + +test("UnexpectedFailures", 2, function() { + var mockView = {}; + var mockState = { + resultsByBuilder: kExampleResultsByBuilder + }; + var expectedResultsByTest = null; + var mockDelegate = { + showResults: function(resultsView) + { + deepEqual(resultsView._resultsByTest, expectedResultsByTest); + } + } + var controller = controllers.UnexpectedFailures(mockState, mockView, mockDelegate); + + var testNameList = null; + var mockFailures = { + testNameList: function() { return testNameList; } + }; + + testNameList = ["scrollbars/custom-scrollbar-with-incomplete-style.html"]; + expectedResultsByTest = {}; + controller.onExamine(mockFailures); + + testNameList = ["userscripts/another-test.html"]; + expectedResultsByTest = { + "userscripts/another-test.html": { + "Mock Builder": { + "expected": "PASS", + "actual": "TEXT" + } + } + }; + controller.onExamine(mockFailures); +}); + +})(); diff --git a/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/garden-o-matic.js b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/garden-o-matic.js index edad518..06c6178 100644 --- a/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/garden-o-matic.js +++ b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/garden-o-matic.js @@ -60,11 +60,21 @@ $(document).ready(function() { onebar = new ui.onebar(); onebar.attach(); + // FIXME: This doesn't belong here. + var onebarController = { + showResults: function(resultsView) + { + var resultsContainer = onebar.results(); + $(resultsContainer).empty().append(resultsView); + onebar.select('results'); + } + }; + var unexpectedFailuresView = new ui.notifications.Stream(); - g_unexpectedFailuresController = new controllers.UnexpectedFailures(unexpectedFailuresView); + g_unexpectedFailuresController = new controllers.UnexpectedFailures(model.state, unexpectedFailuresView, onebarController); var failuresView = new ui.notifications.Stream(); - g_failuresController = new controllers.Failures(failuresView); + g_failuresController = new controllers.Failures(model.state, failuresView, onebarController); g_info = new ui.notifications.Stream(); g_failingBuilders = new controllers.FailingBuilders(g_info); diff --git a/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/results_unittests.js b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/results_unittests.js index 49445ae..09492b1 100644 --- a/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/results_unittests.js +++ b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/results_unittests.js @@ -23,11 +23,13 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +var unittest = unittest || {}; + (function () { module("results"); -var kExampleResultsJSON = { +unittest.kExampleResultsJSON = { "tests": { "scrollbars": { "custom-scrollbar-with-incomplete-style.html": { @@ -69,7 +71,7 @@ var kExampleResultsJSON = { }; test("unexpectedFailures", 1, function() { - var unexpectedFailures = results.unexpectedFailures(kExampleResultsJSON); + var unexpectedFailures = results.unexpectedFailures(unittest.kExampleResultsJSON); deepEqual(unexpectedFailures, { "userscripts/another-test.html": { "expected": "PASS", @@ -80,7 +82,7 @@ test("unexpectedFailures", 1, function() { test("unexpectedFailuresByTest", 1, function() { var unexpectedFailuresByTest = results.unexpectedFailuresByTest({ - "Mock Builder": kExampleResultsJSON + "Mock Builder": unittest.kExampleResultsJSON }); deepEqual(unexpectedFailuresByTest, { "userscripts/another-test.html": { @@ -94,7 +96,7 @@ test("unexpectedFailuresByTest", 1, function() { test("unexpectedSuccessesByTest", 1, function() { var unexpectedFailuresByTest = results.unexpectedSuccessesByTest({ - "Mock Builder": kExampleResultsJSON + "Mock Builder": unittest.kExampleResultsJSON }); deepEqual(unexpectedFailuresByTest, { "scrollbars/unexpected-pass.html": { @@ -108,7 +110,7 @@ test("unexpectedSuccessesByTest", 1, function() { test("failureInfoForTestAndBuilder", 1, function() { var unexpectedFailuresByTest = results.unexpectedFailuresByTest({ - "Mock Builder": kExampleResultsJSON + "Mock Builder": unittest.kExampleResultsJSON }); var failureInfo = results.failureInfoForTestAndBuilder(unexpectedFailuresByTest, "userscripts/another-test.html", "Mock Builder"); deepEqual(failureInfo, { @@ -149,13 +151,13 @@ test("resultType", 12, function() { }); test("resultNodeForTest", 4, function() { - deepEqual(results.resultNodeForTest(kExampleResultsJSON, "userscripts/another-test.html"), { + deepEqual(results.resultNodeForTest(unittest.kExampleResultsJSON, "userscripts/another-test.html"), { "expected": "PASS", "actual": "TEXT" }); - equals(results.resultNodeForTest(kExampleResultsJSON, "foo.html"), null); - equals(results.resultNodeForTest(kExampleResultsJSON, "userscripts/foo.html"), null); - equals(results.resultNodeForTest(kExampleResultsJSON, "userscripts/foo/bar.html"), null); + equals(results.resultNodeForTest(unittest.kExampleResultsJSON, "foo.html"), null); + equals(results.resultNodeForTest(unittest.kExampleResultsJSON, "userscripts/foo.html"), null); + equals(results.resultNodeForTest(unittest.kExampleResultsJSON, "userscripts/foo/bar.html"), null); }); test("walkHistory", 6, function() { diff --git a/Tools/ChangeLog b/Tools/ChangeLog index 5ab688c..a374806 100644 --- a/Tools/ChangeLog +++ b/Tools/ChangeLog @@ -1,3 +1,15 @@ +2011-09-27 Adam Barth + + garden-o-matic examine buttons shows both expected and unexpected failures + https://bugs.webkit.org/show_bug.cgi?id=68918 + + Reviewed by Dimitri Glazkov. + + This was a copy/paste error when I refactored this classes to share + more code. + + * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers.js: + 2011-09-27 Ryosuke Niwa Add Kaustubh Atrawalkar to the list of contributors. -- 2.7.4