diff options
author | gwilson@google.com <gwilson@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-20 17:35:38 +0000 |
---|---|---|
committer | gwilson@google.com <gwilson@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-20 17:35:38 +0000 |
commit | 628e3c57a3ca2649d9018982c526142013b60a52 (patch) | |
tree | c14911624b066d913e033b8b6b31e8e4fd370831 /webkit | |
parent | 9a5e772bf100050f9d132d1e7a7425633043bac2 (diff) | |
download | chromium_src-628e3c57a3ca2649d9018982c526142013b60a52.zip chromium_src-628e3c57a3ca2649d9018982c526142013b60a52.tar.gz chromium_src-628e3c57a3ca2649d9018982c526142013b60a52.tar.bz2 |
Fixes refactoring breakage in the layout test comparison tool. Also implements maximum failure counts.
R=eroman
TEST=run test_output_formatter.bat
BUG=none
Review URL: http://codereview.chromium.org/159033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21078 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
3 files changed, 22 insertions, 3 deletions
diff --git a/webkit/tools/layout_tests/layout_package/failure_finder.py b/webkit/tools/layout_tests/layout_package/failure_finder.py index b35b4f4..342c7ba 100644 --- a/webkit/tools/layout_tests/layout_package/failure_finder.py +++ b/webkit/tools/layout_tests/layout_package/failure_finder.py @@ -9,6 +9,7 @@ import google.path_utils import difflib import errno import os +import platform_utils import re import subprocess import sys @@ -176,12 +177,15 @@ class FailureFinder(object): exclude_known_failures, test_regex, output_dir, + max_failures, verbose): self.build = build - self.platform = builder_name + # TODO(gwilson): add full url-encoding for the platform. + self.platform = builder_name.replace(" ", "%20") self.exclude_known_failures = exclude_known_failures self.test_regex = test_regex self.output_dir = output_dir + self.max_failures = max_failures self.verbose = verbose self.fyi_builder = False self._flaky_test_cache = {} @@ -221,7 +225,7 @@ class FailureFinder(object): The list returned contains Failure class objects. """ if self.verbose: - print 'Fetching failures from buildbot...' + print "Fetching failures from buildbot..." content = self._ScrapeBuilderOutput() matches = self._FindMatchesInBuilderOutput(content) @@ -232,11 +236,13 @@ class FailureFinder(object): failures = [] for match in matches: - if not self.test_regex or match[0].find(self.test_regex) > -1: + if (len(failures) < self.max_failures and + (not self.test_regex or match[0].find(self.test_regex) > -1)): failure = self._CreateFailureFromMatch(match) if self.verbose: print failure.test_path failures.append(failure) + return failures def _ScrapeBuilderOutput(self): diff --git a/webkit/tools/layout_tests/layout_package/html_generator.py b/webkit/tools/layout_tests/layout_package/html_generator.py index a280f63..9136018 100644 --- a/webkit/tools/layout_tests/layout_package/html_generator.py +++ b/webkit/tools/layout_tests/layout_package/html_generator.py @@ -2,10 +2,18 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import re + from failure import Failure CHROMIUM_BUG_URL = "http://crbug.com/" +def ExtractFirstValue(string, regex): + m = re.search(regex, string) + if m and m.group(1): + return m.group(1) + return None + # TODO(gwilson): Refactor HTML generation into a HTML templating system like # Django templates. class HTMLGenerator(object): diff --git a/webkit/tools/layout_tests/test_output_formatter.py b/webkit/tools/layout_tests/test_output_formatter.py index fafac6c..217708f 100644 --- a/webkit/tools/layout_tests/test_output_formatter.py +++ b/webkit/tools/layout_tests/test_output_formatter.py @@ -19,11 +19,13 @@ DEFAULT_BUILDER = "Webkit" def main(options, args): # TODO(gwilson): Add a check that verifies the given platform exists. + finder = failure_finder.FailureFinder(options.build_number, options.platform_builder, (not options.include_expected), options.test_regex, options.output_dir, + int(options.max_failures), options.verbose) failure_list = finder.GetFailures() @@ -61,6 +63,9 @@ if __name__ == "__main__": option_parser.add_option("-o", "--output-dir", default = ".", help = "Output files to given directory") + option_parser.add_option("-m", "--max-failures", + default = 100, + help = "Limit the maximum number of failures") options, args = option_parser.parse_args() main(options, args) |