OLD | NEW |
1 #!/bin/env python | 1 #!/bin/env python |
2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Run layout tests using the test_shell. | 6 """Run layout tests using the test_shell. |
7 | 7 |
8 This is a port of the existing webkit test script run-webkit-tests. | 8 This is a port of the existing webkit test script run-webkit-tests. |
9 | 9 |
10 The TestRunner class runs a series of tests (TestType interface) against a set | 10 The TestRunner class runs a series of tests (TestType interface) against a set |
(...skipping 21 matching lines...) Expand all Loading... |
32 import time | 32 import time |
33 | 33 |
34 import google.path_utils | 34 import google.path_utils |
35 | 35 |
36 from layout_package import compare_failures | 36 from layout_package import compare_failures |
37 from layout_package import test_expectations | 37 from layout_package import test_expectations |
38 from layout_package import http_server | 38 from layout_package import http_server |
39 from layout_package import path_utils | 39 from layout_package import path_utils |
40 from layout_package import test_failures | 40 from layout_package import test_failures |
41 from layout_package import test_shell_thread | 41 from layout_package import test_shell_thread |
| 42 from test_types import fuzzy_image_diff |
42 from test_types import image_diff | 43 from test_types import image_diff |
43 from test_types import test_type_base | 44 from test_types import test_type_base |
44 from test_types import text_diff | 45 from test_types import text_diff |
45 from test_types import simplified_text_diff | 46 from test_types import simplified_text_diff |
46 | 47 |
47 | 48 |
48 # The test list files are found in this subdirectory, which must be a sibling | 49 # The test list files are found in this subdirectory, which must be a sibling |
49 # to this script itself. | 50 # to this script itself. |
50 TEST_FILE_DIR = 'test_lists' | 51 TEST_FILE_DIR = 'test_lists' |
51 | 52 |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 paths += args | 592 paths += args |
592 if options.test_list: | 593 if options.test_list: |
593 paths += ReadTestFiles(options.test_list) | 594 paths += ReadTestFiles(options.test_list) |
594 if not paths: | 595 if not paths: |
595 paths = ['.'] | 596 paths = ['.'] |
596 test_runner = TestRunner(options, paths) | 597 test_runner = TestRunner(options, paths) |
597 test_runner.AddTestType(text_diff.TestTextDiff) | 598 test_runner.AddTestType(text_diff.TestTextDiff) |
598 test_runner.AddTestType(simplified_text_diff.SimplifiedTextDiff) | 599 test_runner.AddTestType(simplified_text_diff.SimplifiedTextDiff) |
599 if not options.no_pixel_tests: | 600 if not options.no_pixel_tests: |
600 test_runner.AddTestType(image_diff.ImageDiff) | 601 test_runner.AddTestType(image_diff.ImageDiff) |
| 602 if options.fuzzy_pixel_tests: |
| 603 test_runner.AddTestType(fuzzy_image_diff.FuzzyImageDiff) |
601 has_new_failures = test_runner.Run() | 604 has_new_failures = test_runner.Run() |
602 logging.info("Exit status: %d" % has_new_failures) | 605 logging.info("Exit status: %d" % has_new_failures) |
603 sys.exit(has_new_failures) | 606 sys.exit(has_new_failures) |
604 | 607 |
605 if '__main__' == __name__: | 608 if '__main__' == __name__: |
606 option_parser = optparse.OptionParser() | 609 option_parser = optparse.OptionParser() |
607 option_parser.add_option("", "--no-pixel-tests", action="store_true", | 610 option_parser.add_option("", "--no-pixel-tests", action="store_true", |
608 default=False, | 611 default=False, |
609 help="disable pixel-to-pixel PNG comparisons") | 612 help="disable pixel-to-pixel PNG comparisons") |
| 613 option_parser.add_option("", "--fuzzy-pixel-tests", action="store_true", |
| 614 default=False, |
| 615 help="Also use fuzzy matching to compare pixel test " |
| 616 "outputs.") |
610 option_parser.add_option("", "--wdiff", action="store_true", | 617 option_parser.add_option("", "--wdiff", action="store_true", |
611 default=False, | 618 default=False, |
612 help="enable word-by-word diffing") | 619 help="enable word-by-word diffing") |
613 option_parser.add_option("", "--results-directory", | 620 option_parser.add_option("", "--results-directory", |
614 default="layout-test-results", | 621 default="layout-test-results", |
615 help="Output results directory source dir," | 622 help="Output results directory source dir," |
616 " relative to Debug or Release") | 623 " relative to Debug or Release") |
617 option_parser.add_option("", "--new-baseline", action="store_true", | 624 option_parser.add_option("", "--new-baseline", action="store_true", |
618 default=False, | 625 default=False, |
619 help="save all generated results as new baselines " | 626 help="save all generated results as new baselines " |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 metavar="FILE") | 671 metavar="FILE") |
665 option_parser.add_option("", "--nocheck-sys-deps", action="store_true", | 672 option_parser.add_option("", "--nocheck-sys-deps", action="store_true", |
666 default=False, | 673 default=False, |
667 help="Don't check the system dependencies (themes)") | 674 help="Don't check the system dependencies (themes)") |
668 option_parser.add_option("", "--randomize-order", action="store_true", | 675 option_parser.add_option("", "--randomize-order", action="store_true", |
669 default=False, | 676 default=False, |
670 help=("Run tests in random order (useful for " | 677 help=("Run tests in random order (useful for " |
671 "tracking down corruption)")) | 678 "tracking down corruption)")) |
672 options, args = option_parser.parse_args() | 679 options, args = option_parser.parse_args() |
673 main(options, args) | 680 main(options, args) |
OLD | NEW |