| OLD | NEW |
| (Empty) |
| 1 #!/usr/bin/env python | |
| 2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | |
| 3 # Use of this source code is governed by a BSD-style license that can be | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 """ | |
| 7 This is a script for generating easily-viewable comparisons of text and pixel | |
| 8 diffs. | |
| 9 """ | |
| 10 import optparse | |
| 11 | |
| 12 from layout_package import test_expectations | |
| 13 from layout_package import failure | |
| 14 from layout_package import failure_finder | |
| 15 from layout_package import failure_finder_test | |
| 16 from layout_package import html_generator | |
| 17 | |
| 18 DEFAULT_BUILDER = "Webkit" | |
| 19 | |
| 20 | |
| 21 def main(options, args): | |
| 22 | |
| 23 if options.run_tests: | |
| 24 fft = failure_finder_test.FailureFinderTest() | |
| 25 return fft.runTests() | |
| 26 | |
| 27 # TODO(gwilson): Add a check that verifies the given platform exists. | |
| 28 | |
| 29 finder = failure_finder.FailureFinder(options.build_number, | |
| 30 options.platform_builder, | |
| 31 (not options.include_expected), | |
| 32 options.test_regex, | |
| 33 options.output_dir, | |
| 34 int(options.max_failures), | |
| 35 options.verbose, | |
| 36 options.builder_log, | |
| 37 options.archive_log, | |
| 38 options.zip_file, | |
| 39 options.expectations_file) | |
| 40 finder.use_local_baselines = options.local | |
| 41 failure_list = finder.GetFailures() | |
| 42 | |
| 43 if not failure_list: | |
| 44 print "Did not find any failures." | |
| 45 return | |
| 46 | |
| 47 generator = html_generator.HTMLGenerator(failure_list, | |
| 48 options.output_dir, | |
| 49 finder.build, | |
| 50 options.platform_builder, | |
| 51 (not options.include_expected)) | |
| 52 filename = generator.GenerateHTML() | |
| 53 | |
| 54 if filename and options.verbose: | |
| 55 print "File created at %s" % filename | |
| 56 | |
| 57 if __name__ == "__main__": | |
| 58 option_parser = optparse.OptionParser() | |
| 59 option_parser.add_option("-v", "--verbose", action="store_true", | |
| 60 default=False, | |
| 61 help="Display lots of output.") | |
| 62 option_parser.add_option("-i", "--include-expected", action="store_true", | |
| 63 default=False, | |
| 64 help="Include expected failures in output") | |
| 65 option_parser.add_option("-p", "--platform-builder", | |
| 66 default=DEFAULT_BUILDER, | |
| 67 help="Use the given builder") | |
| 68 option_parser.add_option("-b", "--build-number", | |
| 69 default=None, | |
| 70 help="Use the given build number") | |
| 71 option_parser.add_option("-t", "--test-regex", | |
| 72 default=None, | |
| 73 help="Use the given regex to filter tests") | |
| 74 option_parser.add_option("-o", "--output-dir", | |
| 75 default=".", | |
| 76 help="Output files to given directory") | |
| 77 option_parser.add_option("-m", "--max-failures", | |
| 78 default=100, | |
| 79 help="Limit the maximum number of failures") | |
| 80 option_parser.add_option("-r", "--run-tests", action="store_true", | |
| 81 default=False, | |
| 82 help="Runs unit tests") | |
| 83 option_parser.add_option("-u", "--builder-log", | |
| 84 default=None, | |
| 85 help=("Use the local builder log file " | |
| 86 "instead of scraping the buildbots")) | |
| 87 option_parser.add_option("-a", "--archive-log", | |
| 88 default=None, | |
| 89 help=("Use the local archive log file " | |
| 90 "instead of scraping the buildbots")) | |
| 91 option_parser.add_option("-e", "--expectations-file", | |
| 92 default=None, | |
| 93 help=("Use the local test expectations file " | |
| 94 "instead of scraping the buildbots")) | |
| 95 option_parser.add_option("-z", "--zip-file", | |
| 96 default=None, | |
| 97 help=("Use the local test output zip file " | |
| 98 "instead of scraping the buildbots")) | |
| 99 option_parser.add_option("-l", "--local", action="store_true", | |
| 100 default=False, | |
| 101 help=("Use local baselines instead of scraping " | |
| 102 "baselines from source websites")) | |
| 103 | |
| 104 options, args = option_parser.parse_args() | |
| 105 main(options, args) | |
| OLD | NEW |