Title: [109810] trunk/Tools
Revision
109810
Author
dpra...@chromium.org
Date
2012-03-05 16:11:30 -0800 (Mon, 05 Mar 2012)

Log Message

flakiness dashboard doesn't display baselines for virtual tests correctly
https://bugs.webkit.org/show_bug.cgi?id=80341

Reviewed by Ojan Vafai.

If the test is part of a virtual test suite, we need to look for
baselines in the underlying fallback path for the actual test
being run, as well as baselines for the virtual version.

This patch adds code to handle both branches and also pulls the
mapping of the test suites up into a constant.

* TestResultServer/static-dashboards/flakiness_dashboard.html:
* TestResultServer/static-dashboards/flakiness_dashboard_tests.js:
(testLookupVirtualTestSuite):
(testBaseTest):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (109809 => 109810)


--- trunk/Tools/ChangeLog	2012-03-05 23:50:13 UTC (rev 109809)
+++ trunk/Tools/ChangeLog	2012-03-06 00:11:30 UTC (rev 109810)
@@ -1,3 +1,22 @@
+2012-03-05  Dirk Pranke  <dpra...@chromium.org>
+
+        flakiness dashboard doesn't display baselines for virtual tests correctly
+        https://bugs.webkit.org/show_bug.cgi?id=80341
+
+        Reviewed by Ojan Vafai.
+
+        If the test is part of a virtual test suite, we need to look for
+        baselines in the underlying fallback path for the actual test
+        being run, as well as baselines for the virtual version.
+
+        This patch adds code to handle both branches and also pulls the
+        mapping of the test suites up into a constant.
+
+        * TestResultServer/static-dashboards/flakiness_dashboard.html:
+        * TestResultServer/static-dashboards/flakiness_dashboard_tests.js:
+        (testLookupVirtualTestSuite):
+        (testBaseTest):
+
 2012-03-05  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r109760.

Modified: trunk/Tools/TestResultServer/static-dashboards/flakiness_dashboard.html (109809 => 109810)


--- trunk/Tools/TestResultServer/static-dashboards/flakiness_dashboard.html	2012-03-05 23:50:13 UTC (rev 109809)
+++ trunk/Tools/TestResultServer/static-dashboards/flakiness_dashboard.html	2012-03-06 00:11:30 UTC (rev 109810)
@@ -338,6 +338,12 @@
 var CHUNK_SIZE = 25;
 var MAX_RESULTS = 1500;
 
+// FIXME: Figure out how to make this not be hard-coded.
+var VIRTUAL_SUITES = {
+    'platform/chromium/virtual/gpu/fast/canvas': 'fast/canvas',
+    'platform/chromium/virtual/gpu/canvas/philip': 'canvas/philip'
+};
+
 //////////////////////////////////////////////////////////////////////////////
 // Methods and objects from dashboard_base.js to override.
 //////////////////////////////////////////////////////////////////////////////
@@ -1174,9 +1180,6 @@
 
 function linkHTMLToOpenWindow(url, text)
 {
-    // FIXME: We probably need a more general way to map virtual tests
-    // to their underlying actual tests.
-    url = "" '')
     return '<a href="" + url + '" target="_blank">' + text + '</a>';
 }
 
@@ -1801,7 +1804,9 @@
     var master;
     var html = '';
     if (isLayoutTestResults()) {
-        var tracURL = TEST_URL_BASE_PATH_TRAC + test
+        var suite = lookupVirtualTestSuite(test);
+        var base = suite ? baseTest(test, suite) : test;
+        var tracURL = TEST_URL_BASE_PATH_TRAC + base;
         html += '<h2>' + linkHTMLToOpenWindow(tracURL, test) + '</h2>';
     } else
         html += '<h2>' + test + '</h2>';
@@ -1905,7 +1910,8 @@
 // @param {string} base Base path for the expectation URL.
 // @param {string} opt_builder Builder whose actual results this expectation
 //     points to.
-function addExpectationItem(expectationsContainers, parentContainer, platform, path, base, opt_builder)
+// @param {string} opt_suite "virtual suite" that the test belongs to, if any.
+function addExpectationItem(expectationsContainers, parentContainer, platform, path, base, opt_builder, opt_suite)
 {
     var parts = path.split('.')
     var fileExtension = parts[parts.length - 1];
@@ -1917,12 +1923,13 @@
 
     // FIXME: Stop using script tags once all the places we pull from support CORS.
     var platformPart = platform ? ensureTrailingSlash(platform) : '';
+    var suitePart = opt_suite ? ensureTrailingSlash(opt_suite) : '';
 
     var childContainer = document.createElement('span');
     childContainer.className = 'unloaded';
 
     var appendExpectationsItem = function(item) {
-        childContainer.appendChild(expectationsTitle(platform, path, opt_builder || ''));
+        childContainer.appendChild(expectationsTitle(platformPart + suitePart, path, opt_builder));
         childContainer.className = 'expectations-item';
         item.className = 'expectation ' + fileExtension;
         if (g_currentState.showLargeExpectations)
@@ -2065,12 +2072,13 @@
 }
 
 function addExpectations(expectationsContainers, container, base,
-    platform, text, png, reftest_html_file, reftest_mismatch_html_file)
+    platform, text, png, reftest_html_file, reftest_mismatch_html_file, suite)
 {
-    addExpectationItem(expectationsContainers, container, platform, text, base);
-    addExpectationItem(expectationsContainers, container, platform, png, base);
-    addExpectationItem(expectationsContainers, container, platform, reftest_html_file, base);
-    addExpectationItem(expectationsContainers, container, platform, reftest_mismatch_html_file, base);
+    var builder = '';
+    addExpectationItem(expectationsContainers, container, platform, text, base, builder, suite);
+    addExpectationItem(expectationsContainers, container, platform, png, base, builder, suite);
+    addExpectationItem(expectationsContainers, container, platform, reftest_html_file, base, builder, suite);
+    addExpectationItem(expectationsContainers, container, platform, reftest_mismatch_html_file, base, builder, suite);
 }
 
 function expectationsTitle(platform, path, builder)
@@ -2172,6 +2180,44 @@
     return {revisionStart: revisionStart, revisionEnd: revisionEnd, buildNumber: buildNumber};
 }
 
+function lookupVirtualTestSuite(test) {
+    for (var suite in VIRTUAL_SUITES) {
+        if (test.indexOf(suite) != -1)
+            return suite;
+    }
+    return '';
+}
+
+function baseTest(test, suite) {
+    base = VIRTUAL_SUITES[suite];
+    return base ? test.replace(suite, base) : test;
+}
+
+function loadBaselinesForTest(expectationsContainers, expectationsContainer, test) {
+    var testWithoutSuffix = test.substring(0, test.lastIndexOf('.'));
+    var text = testWithoutSuffix + "-expected.txt";
+    var png = testWithoutSuffix + "-expected.png";
+    var reftest_html_file = testWithoutSuffix + "-expected.html";
+    var reftest_mismatch_html_file = testWithoutSuffix + "-expected-mismatch.html";
+    var suite = lookupVirtualTestSuite(test);
+
+    if (!suite)
+        addExpectationItem(expectationsContainers, expectationsContainer, null, test, TEST_URL_BASE_PATH);
+
+    addExpectations(expectationsContainers, expectationsContainer,
+        TEST_URL_BASE_PATH, '', text, png, reftest_html_file, reftest_mismatch_html_file, suite);
+
+    var fallbacks = allFallbacks();
+    for (var i = 0; i < fallbacks.length; i++) {
+      var fallback = 'platform/' + fallbacks[i];
+      addExpectations(expectationsContainers, expectationsContainer, TEST_URL_BASE_PATH, fallback, text, png,
+          reftest_html_file, reftest_mismatch_html_file, suite);
+    }
+
+    if (suite)
+        loadBaselinesForTest(expectationsContainers, expectationsContainer, baseTest(test, suite));
+}
+
 function loadExpectationsLayoutTests(expectationsContainer)
 {
     // Map from file extension to container div for expectations of that type.
@@ -2193,24 +2239,9 @@
         }
     }
 
-    addExpectationItem(expectationsContainers, expectationsContainer, null, test, TEST_URL_BASE_PATH);
-
+    loadBaselinesForTest(expectationsContainers, expectationsContainer, test);
+        
     var testWithoutSuffix = test.substring(0, test.lastIndexOf('.'));
-    var text = testWithoutSuffix + "-expected.txt";
-    var png = testWithoutSuffix + "-expected.png";
-    var reftest_html_file = testWithoutSuffix + "-expected.html";
-    var reftest_mismatch_html_file = testWithoutSuffix + "-expected-mismatch.html";
-
-    addExpectations(expectationsContainers, expectationsContainer,
-        TEST_URL_BASE_PATH, '', text, png, reftest_html_file, reftest_mismatch_html_file);
-
-    var fallbacks = allFallbacks();
-    for (var i = 0; i < fallbacks.length; i++) {
-      var fallback = 'platform/' + fallbacks[i];
-      addExpectations(expectationsContainers, expectationsContainer, TEST_URL_BASE_PATH, fallback, text, png,
-          reftest_html_file, reftest_mismatch_html_file);
-    }
-
     var actualResultSuffixes = ['-actual.txt', '-actual.png', '-crash-log.txt', '-diff.txt', '-wdiff.html', '-diff.png'];
 
     for (var builder in g_builders) {

Modified: trunk/Tools/TestResultServer/static-dashboards/flakiness_dashboard_tests.js (109809 => 109810)


--- trunk/Tools/TestResultServer/static-dashboards/flakiness_dashboard_tests.js	2012-03-05 23:50:13 UTC (rev 109809)
+++ trunk/Tools/TestResultServer/static-dashboards/flakiness_dashboard_tests.js	2012-03-06 00:11:30 UTC (rev 109810)
@@ -404,16 +404,19 @@
     assertEquals(group.children.length, 4);
 }
 
-function testLinkHTMLToOpenWindow()
+function testLookupVirtualTestSuite()
 {
-    var text = 'text';
-    // Test that we map regular tests and virtual tests properly.
-    self.assertEquals(linkHTMLToOpenWindow('http://localhost/fast/canvas/foo.html', text),
-                      '<a href="" target="_blank">text</a>');
-    self.assertEquals(linkHTMLToOpenWindow('http://localhost/platform/chromium/virtual/gpu/fast/canvas/foo.html', text),
-                      '<a href="" target="_blank">text</a>');
+    self.assertEquals(lookupVirtualTestSuite('fast/canvas/foo.html'), '');
+    self.assertEquals(lookupVirtualTestSuite('platform/chromium/virtual/gpu/fast/canvas/foo.html'),
+                      'platform/chromium/virtual/gpu/fast/canvas');
 }
 
+function testBaseTest()
+{
+    self.assertEquals(baseTest('fast/canvas/foo.html', ''), 'fast/canvas/foo.html');
+    self.assertEquals(baseTest('platform/chromium/virtual/gpu/fast/canvas/foo.html', 'platform/chromium/virtual/gpu/fast/canvas'), 'fast/canvas/foo.html');
+}
+
 function runTests()
 {
     document.body.innerHTML = '<pre id=unittest-results></pre>';
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to