Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Unified Diff: scripts/common/gtest_utils.py

Issue 373223003: Implemented parsing of the ignored failing tests spec and ignoring respective failures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Improved test coverage Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: scripts/common/gtest_utils.py
diff --git a/scripts/common/gtest_utils.py b/scripts/common/gtest_utils.py
index 0e1c17059687f8a903036f6d14227de7e0973144..30f3e676f8c254f24f3ca9a447851a525b3a3164 100755
--- a/scripts/common/gtest_utils.py
+++ b/scripts/common/gtest_utils.py
@@ -3,6 +3,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+from common import chromium_utils
import json
import os
import re
@@ -419,6 +420,7 @@ class GTestJSONParser(object):
self.failed_tests = set()
self.flaky_tests = set()
self.test_logs = {}
+ self.ignored_failed_tests = set()
self.parsing_errors = []
@@ -433,11 +435,14 @@ class GTestJSONParser(object):
return sorted(self.passed_tests)
def FailedTests(self, include_fails=False, include_flaky=False):
- return sorted(self.failed_tests)
+ return sorted(self.failed_tests - self.ignored_failed_tests)
def FailureDescription(self, test):
return self.test_logs.get(test, [])
+ def IgnoredFailedTests(self):
+ return sorted(self.ignored_failed_tests)
+
@staticmethod
def SuppressionHashes():
return []
@@ -470,7 +475,7 @@ class GTestJSONParser(object):
self.delete_json_file = True
return self.json_file_path
- def ProcessJSONFile(self):
+ def ProcessJSONFile(self, build_dir):
if not self.json_file_path:
return
@@ -484,14 +489,64 @@ class GTestJSONParser(object):
if json_output:
self.parsing_errors = json_output.split('\n')
else:
- self.ProcessJSONData(json_data)
+ self.ProcessJSONData(json_data, build_dir)
if self.delete_json_file:
os.remove(self.json_file_path)
- def ProcessJSONData(self, json_data):
+ def _ParseIngoredFailedTestsSpec(self, build_dir, platform_flags):
+ if not build_dir:
+ return
+
+ try:
+ ignored_failed_tests_path = chromium_utils.FindUpward(
+ os.path.abspath(build_dir), 'tools', 'ignorer_bot',
+ 'ignored_failed_tests.txt')
+ except chromium_utils.PathNotFound:
+ return
+
+ with open(ignored_failed_tests_path) as ignored_failed_tests_file:
+ ignored_failed_tests_spec = ignored_failed_tests_file.readlines()
+
+ for spec_line in ignored_failed_tests_spec:
+ spec_line = spec_line.strip()
+ if spec_line.startswith('#') or not spec_line:
+ continue
+
+ # Any number of flags separated by whitespace with optional trailing
+ # and/or leading whitespace.
+ platform_spec_regexp = r'\s*\w+(?:\s+\w+)*\s*'
+
+ match = re.match(
+ r'^http://crbug.com/\d+' # Issue URL.
+ r'\s+' # Some whitespace.
+ r'\[(' + # Opening square bracket '['.
+ platform_spec_regexp + # At least one platform, and...
+ r'(?:,' + # ...separated by commas...
+ platform_spec_regexp + # ...any number of additional...
+ r')*' # ...platforms.
+ r')\]' # Closing square bracket ']'.
+ r'\s+' # Some whitespace.
+ r'(\S+)$', spec_line) # Test name.
+
+ if not match:
+ continue
+
+ platform_specs = match.group(1).strip()
+ test_name = match.group(2).strip()
+
+ platform_flags = set(platform_flags)
+ for platform_spec in platform_specs.split(','):
+ required_platform_flags = set(platform_spec.split())
+ if required_platform_flags.issubset(platform_flags):
+ self.ignored_failed_tests.add(test_name)
+ break
+
+ def ProcessJSONData(self, json_data, build_dir=None):
# TODO(phajdan.jr): Require disabled_tests to be present (May 2014).
self.disabled_tests.update(json_data.get('disabled_tests', []))
+ self._ParseIngoredFailedTestsSpec(build_dir,
+ json_data.get('global_tags', []))
for iteration_data in json_data['per_iteration_data']:
for test_name, test_runs in iteration_data.iteritems():
« no previous file with comments | « no previous file | scripts/common/unittests/gtest_utils_test.py » ('j') | scripts/common/unittests/gtest_utils_test.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698