Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Tools / Scripts / webkitpy / layout_tests / models / test_run_results.py
index 8918cae..1e729f8 100644 (file)
@@ -28,6 +28,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import logging
+import re
 import signal
 import time
 
@@ -163,6 +164,14 @@ def _interpret_test_failures(failures):
     return test_dict
 
 
+def _chromium_commit_position(scm, path):
+    log = scm.most_recent_log_matching('Cr-Commit-Position:', path)
+    match = re.search('^\s*Cr-Commit-Position:.*@\{#(?P<commit_position>\d+)\}', log, re.MULTILINE)
+    if not match:
+        return ""
+    return str(match.group('commit_position'))
+
+
 def summarize_results(port_obj, expectations, initial_results, retry_results, enabled_pixel_tests_in_retry, only_include_failing=False):
     """Returns a dictionary containing a summary of the test runs, with the following fields:
         'version': a version indicator
@@ -254,7 +263,9 @@ def summarize_results(port_obj, expectations, initial_results, retry_results, en
         test_dict['actual'] = " ".join(actual)
 
         def is_expected(actual_result):
-            return expectations.matches_an_expected_result(test_name, result_type, port_obj.get_option('pixel_tests') or result.reftest_type)
+            return expectations.matches_an_expected_result(test_name, result_type,
+                port_obj.get_option('pixel_tests') or result.reftest_type,
+                port_obj.get_option('enable_sanitizer'))
 
         # To avoid bloating the output results json too much, only add an entry for whether the failure is unexpected.
         if not all(is_expected(actual_result) for actual_result in actual):
@@ -267,6 +278,9 @@ def summarize_results(port_obj, expectations, initial_results, retry_results, en
             if retry_result:
                 test_dict.update(_interpret_test_failures(retry_result.failures))
 
+        if (result.has_repaint_overlay):
+            test_dict['has_repaint_overlay'] = True
+
         # Store test hierarchically by directory. e.g.
         # foo/bar/baz.html: test_dict
         # foo/bar/baz1.html: test_dict
@@ -303,20 +317,23 @@ def summarize_results(port_obj, expectations, initial_results, retry_results, en
     results['build_number'] = port_obj.get_option('build_number')
     results['builder_name'] = port_obj.get_option('builder_name')
 
-    try:
-        # Don't do this by default since it takes >100ms.
-        # It's only used for uploading data to the flakiness dashboard.
-        if port_obj.get_option("builder_name"):
-            port_obj.host.initialize_scm()
-            for (name, path) in port_obj.repository_paths():
-                results[name.lower() + '_revision'] = port_obj.host.scm().svn_revision(path)
-    except Exception, e:
-        _log.warn("Failed to determine svn revision for checkout (cwd: %s, webkit_base: %s), leaving 'revision' key blank in full_results.json.\n%s" % (port_obj._filesystem.getcwd(), port_obj.path_from_webkit_base(), e))
-        # Handle cases where we're running outside of version control.
-        import traceback
-        _log.debug('Failed to learn head svn revision:')
-        _log.debug(traceback.format_exc())
-        results['chromium_revision'] = ""
-        results['blink_revision'] = ""
+    # Don't do this by default since it takes >100ms.
+    # It's only used for uploading data to the flakiness dashboard.
+    results['chromium_revision'] = ''
+    results['blink_revision'] = ''
+    if port_obj.get_option('builder_name'):
+        for (name, path) in port_obj.repository_paths():
+            scm = port_obj.host.scm_for_path(path)
+            if scm:
+                if name.lower() == 'chromium':
+                    rev = _chromium_commit_position(scm, path)
+                else:
+                    rev = scm.svn_revision(path)
+            if rev:
+                results[name.lower() + '_revision'] = rev
+            else:
+                _log.warn('Failed to determine svn revision for %s, '
+                          'leaving "%s_revision" key blank in full_results.json.'
+                          % (path, name))
 
     return results