Title: [129079] trunk/Tools
Revision
129079
Author
[email protected]
Date
2012-09-19 17:59:24 -0700 (Wed, 19 Sep 2012)

Log Message

update flakiness dashboard after cutover to new test expectations syntax
https://bugs.webkit.org/show_bug.cgi?id=97152

Reviewed by Ryosuke Niwa.

This change clones the TestExpectation parsing state machine
from python into _javascript_.

* TestResultServer/static-dashboards/flakiness_dashboard.js:
(parsedExpectations.lines.forEach):
(parsedExpectations):
* TestResultServer/static-dashboards/flakiness_dashboard_unittests.js:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (129078 => 129079)


--- trunk/Tools/ChangeLog	2012-09-20 00:58:58 UTC (rev 129078)
+++ trunk/Tools/ChangeLog	2012-09-20 00:59:24 UTC (rev 129079)
@@ -1,3 +1,18 @@
+2012-09-19  Dirk Pranke  <[email protected]>
+
+        update flakiness dashboard after cutover to new test expectations syntax
+        https://bugs.webkit.org/show_bug.cgi?id=97152
+
+        Reviewed by Ryosuke Niwa.
+
+        This change clones the TestExpectation parsing state machine
+        from python into _javascript_.
+
+        * TestResultServer/static-dashboards/flakiness_dashboard.js:
+        (parsedExpectations.lines.forEach):
+        (parsedExpectations):
+        * TestResultServer/static-dashboards/flakiness_dashboard_unittests.js:
+
 2012-09-19  Dana Jansens  <[email protected]>
 
         Add [email protected] as contributor

Modified: trunk/Tools/TestResultServer/static-dashboards/flakiness_dashboard.js (129078 => 129079)


--- trunk/Tools/TestResultServer/static-dashboards/flakiness_dashboard.js	2012-09-20 00:58:58 UTC (rev 129078)
+++ trunk/Tools/TestResultServer/static-dashboards/flakiness_dashboard.js	2012-09-20 00:59:24 UTC (rev 129079)
@@ -588,22 +588,99 @@
     var lines = g_expectations.split('\n');
     lines.forEach(function(line) {
         line = trimString(line);
-        if (!line || startsWith(line, '//'))
+        if (!line || startsWith(line, '#'))
             return;
 
-        // FIXME: Make this robust against not having modifiers and/or expectations.
-        // Right now, run-webkit-tests doesn't allow such lines, but it may in the future.
-        var match = line.match(/([^:]+)*:([^=]+)=(.*)/);
-        if (!match) {
-            console.error('Line could not be parsed: ' + line);
-            return;
+        // This code mimics _tokenize_line_using_new_format() in
+        // Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py
+        //
+        // FIXME: consider doing more error checking here.
+        //
+        // FIXME: Clean this all up once we've fully cut over to the new syntax.
+        var tokens = line.split(/\s+/)
+        var parsed_bugs = [];
+        var parsed_modifiers = [];
+        var parsed_path;
+        var parsed_expectations = [];
+        var state = 'start';
+
+        // This clones _configuration_tokens_list in test_expectations.py.
+        // FIXME: unify with the platforms constants at the top of the file.
+        var configuration_tokens = {
+            'Release': 'RELEASE',
+            'Debug': 'DEBUG',
+            'Mac': 'MAC',
+            'Win': 'Win',
+            'Linux': 'LINUX',
+            'SnowLeopard': 'SNOWLEOPARD',
+            'Lion': 'LION',
+            'MountainLion': 'MOUNTAINLION',
+            'Win7': 'WIN7',
+            'XP': 'XP',
+            'Vista': 'VISTA',
+            'Android': 'ANDROID',
+        };
+
+        var expectation_tokens = {
+            'Crash': 'CRASH',
+            'Failure': 'FAIL',
+            'ImageOnlyFailure': 'IMAGE',
+            'Missing': 'MISSING',
+            'Pass': 'PASS',
+            'Rebaseline': 'REBASELINE',
+            'Skip': 'SKIP',
+            'Slow': 'SLOW',
+            'Timeout': 'TIMEOUT',
+            'WontFix': 'WONTFIX',
+        };
+
+            
+        tokens.forEach(function(token) {
+          if (token.indexOf('Bug') != -1 ||
+              token.indexOf('webkit.org') != -1 ||
+              token.indexOf('crbug.com') != -1 ||
+              token.indexOf('code.google.com') != -1) {
+              parsed_bugs.push(token);
+          } else if (token == '[') {
+              if (state == 'start') {
+                  state = 'configuration';
+              } else if (state == 'name_found') {
+                  state = 'expectations';
+              }
+          } else if (token == ']') {
+              if (state == 'configuration') {
+                  state = 'name';
+              } else if (state == 'expectations') {
+                  state = 'done';
+              }
+          } else if (state == 'configuration') {
+              parsed_modifiers.push(configuration_tokens[token]);
+          } else if (state == 'expectations') {
+              if (token == 'Rebaseline' || token == 'Skip' || token == 'Slow' || token == 'WontFix') {
+                  parsed_modifiers.push(token.toUpperCase());
+              } else {
+                  parsed_expectations.push(expectation_tokens[token]);
+              }
+          } else if (token == '#') {
+              state = 'done';
+          } else if (state == 'name' || state == 'start') {
+              parsed_path = token;
+              state = 'name_found';
+          }
+        });
+
+        if (!parsed_expectations.length) {
+            if (parsed_modifiers.indexOf('Slow') == -1) {
+                parsed_modifiers.push('Skip');
+                parsed_expectations = ['Pass'];
+            }
         }
 
         // FIXME: Should we include line number and comment lines here?
         expectations.push({
-            modifiers: trimString(match[1]),
-            path: trimString(match[2]),
-            expectations: trimString(match[3])
+            modifiers: parsed_bugs.concat(parsed_modifiers).join(' '),
+            path: parsed_path,
+            expectations: parsed_expectations.join(' '),
         });
     });
     return expectations;

Modified: trunk/Tools/TestResultServer/static-dashboards/flakiness_dashboard_unittests.js (129078 => 129079)


--- trunk/Tools/TestResultServer/static-dashboards/flakiness_dashboard_unittests.js	2012-09-20 00:58:58 UTC (rev 129078)
+++ trunk/Tools/TestResultServer/static-dashboards/flakiness_dashboard_unittests.js	2012-09-20 00:59:24 UTC (rev 129079)
@@ -84,7 +84,7 @@
     var expectationsArray = [
         {'modifiers': 'RELEASE', 'expectations': 'FAIL'}
     ];
-    g_expectations = 'RELEASE : ' + test + ' = FAIL';
+    g_expectations = '[ Release ] ' + test + ' [ Failure ]';
     runExpectationsTest(builder, test, 'FAIL', 'RELEASE');
 });
 
@@ -96,8 +96,8 @@
         {'modifiers': 'RELEASE', 'expectations': 'FAIL'},
         {'modifiers': 'DEBUG', 'expectations': 'CRASH'}
     ];
-    g_expectations = 'RELEASE : ' + test + ' = FAIL\n' +
-        'DEBUG : ' + test + ' = CRASH';
+    g_expectations = '[ Release ] ' + test + ' [ Failure ]\n' +
+        '[ Debug ] ' + test + ' [ Crash ]';
     runExpectationsTest(builder, test, 'FAIL', 'RELEASE');
 });
 
@@ -109,24 +109,24 @@
         {'modifiers': 'RELEASE', 'expectations': 'FAIL'},
         {'modifiers': 'DEBUG', 'expectations': 'CRASH'}
     ];
-    g_expectations = 'RELEASE : ' + test + ' = FAIL\n' +
-        'DEBUG : ' + test + ' = CRASH';
+    g_expectations = '[ Release ] ' + test + ' [ Failure ]\n' +
+        '[ Debug ] ' + test + ' [ Crash ]';
     runExpectationsTest(builder, test, 'CRASH', 'DEBUG');
 });
 
 test('overrideJustBuildType', 12, function() {
     resetGlobals();
     var test = 'bar/1.html';
-    g_expectations = 'WONTFIX : bar = FAIL PASS TIMEOUT\n' +
-        'WONTFIX MAC : ' + test + ' = FAIL\n' +
-        'LINUX DEBUG : ' + test + ' = CRASH';
+    g_expectations = 'bar [ WontFix Failure Pass Timeout ]\n' +
+        '[ Mac ] ' + test + ' [ WontFix Failure ]\n' +
+        '[ Linux Debug ] ' + test + ' [ Crash ]';
     
     runExpectationsTest('Webkit Win', test, 'FAIL PASS TIMEOUT', 'WONTFIX');
     runExpectationsTest('Webkit Win (dbg)(3)', test, 'FAIL PASS TIMEOUT', 'WONTFIX');
     runExpectationsTest('Webkit Linux', test, 'FAIL PASS TIMEOUT', 'WONTFIX');
     runExpectationsTest('Webkit Linux (dbg)(3)', test, 'CRASH', 'LINUX DEBUG');
-    runExpectationsTest('Webkit Mac10.7', test, 'FAIL', 'WONTFIX MAC');
-    runExpectationsTest('Webkit Mac10.7 (dbg)(3)', test, 'FAIL', 'WONTFIX MAC');
+    runExpectationsTest('Webkit Mac10.7', test, 'FAIL', 'MAC WONTFIX');
+    runExpectationsTest('Webkit Mac10.7 (dbg)(3)', test, 'FAIL', 'MAC WONTFIX');
 });
 
 test('platformAndBuildType', 76, function() {
@@ -185,9 +185,9 @@
 });
 
 test('realModifiers', 3, function() {
-    equal(realModifiers('BUGFOO LINUX LION WIN DEBUG SLOW'), 'SLOW');
-    equal(realModifiers('BUGFOO LUCID MAC XP RELEASE SKIP'), 'SKIP');
-    equal(realModifiers('BUGFOO'), '');
+    equal(realModifiers('BUG(Foo) LINUX LION WIN DEBUG SLOW'), 'SLOW');
+    equal(realModifiers('BUG(Foo) LUCID MAC XP RELEASE SKIP'), 'SKIP');
+    equal(realModifiers('BUG(Foo)'), '');
 });
 
 test('allTestsWithSamePlatformAndBuildType', 14, function() {
@@ -219,15 +219,15 @@
         }
     }
 
-    g_expectations = 'BUG123 : foo = FAIL PASS CRASH\n' +
-        'RELEASE BUGFOO : foo/test1.html = FAIL\n' +
-        'DEBUG : foo/test1.html = CRASH\n' +
-        'BUG456 : foo/test2.html = FAIL\n' +
-        'LINUX DEBUG : foo/test2.html = CRASH\n' +
-        'RELEASE : test1.html = FAIL\n' +
-        'DEBUG : test1.html = CRASH\n' +
-        'WIN7 : http/tests/appcache/interrupted-update.html = TIMEOUT\n' +
-        'MAC LINUX XP : http/tests/appcache/interrupted-update.html = FAIL\n';
+    g_expectations = 'Bug(123) foo [ Failure Pass Crash ]\n' +
+        'Bug(Foo) [ Release ] foo/test1.html [ Failure ]\n' +
+        '[ Debug ] foo/test1.html [ Crash ]\n' +
+        'Bug(456) foo/test2.html [ Failure ]\n' +
+        '[ Linux Debug ] foo/test2.html [ Crash ]\n' +
+        '[ Release ] test1.html [ Failure ]\n' +
+        '[ Debug ] test1.html [ Crash ]\n' +
+        '[ Win7 ] http/tests/appcache/interrupted-update.html [ Timeout ]\n' +
+        '[ Mac Linux XP ] http/tests/appcache/interrupted-update.html [ Failure ]\n';
 
     processExpectations();
     
@@ -235,19 +235,19 @@
     equal(JSON.stringify(expectations), '{"modifiers":"DEBUG","expectations":"CRASH"}');
 
     var expectations = getExpectations('foo/test1.html', 'LUCID', 'RELEASE');
-    equal(JSON.stringify(expectations), '{"modifiers":"RELEASE BUGFOO","expectations":"FAIL"}');
+    equal(JSON.stringify(expectations), '{"modifiers":"Bug(Foo) RELEASE","expectations":"FAIL"}');
 
     var expectations = getExpectations('foo/test2.html', 'LUCID', 'RELEASE');
-    equal(JSON.stringify(expectations), '{"modifiers":"BUG456","expectations":"FAIL"}');
+    equal(JSON.stringify(expectations), '{"modifiers":"Bug(456)","expectations":"FAIL"}');
 
     var expectations = getExpectations('foo/test2.html', 'LION', 'DEBUG');
-    equal(JSON.stringify(expectations), '{"modifiers":"BUG456","expectations":"FAIL"}');
+    equal(JSON.stringify(expectations), '{"modifiers":"Bug(456)","expectations":"FAIL"}');
 
     var expectations = getExpectations('foo/test2.html', 'LUCID', 'DEBUG');
     equal(JSON.stringify(expectations), '{"modifiers":"LINUX DEBUG","expectations":"CRASH"}');
 
     var expectations = getExpectations('foo/test3.html', 'LUCID', 'DEBUG');
-    equal(JSON.stringify(expectations), '{"modifiers":"BUG123","expectations":"FAIL PASS CRASH"}');
+    equal(JSON.stringify(expectations), '{"modifiers":"Bug(123)","expectations":"FAIL PASS CRASH"}');
 
     var expectations = getExpectations('test1.html', 'XP', 'DEBUG');
     equal(JSON.stringify(expectations), '{"modifiers":"DEBUG","expectations":"CRASH"}');
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to