| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 raise err | 162 raise err |
| 163 | 163 |
| 164 def _PrepareListsAndPrintOutput(self): | 164 def _PrepareListsAndPrintOutput(self): |
| 165 """Create appropriate subsets of test lists and print test counts. | 165 """Create appropriate subsets of test lists and print test counts. |
| 166 | 166 |
| 167 Create appropriate subsets of self._tests_files in | 167 Create appropriate subsets of self._tests_files in |
| 168 self._ignored_failures, self._fixable_failures, and self._fixable_crashes. | 168 self._ignored_failures, self._fixable_failures, and self._fixable_crashes. |
| 169 Also remove skipped files from self._test_files, extract a subset of tests | 169 Also remove skipped files from self._test_files, extract a subset of tests |
| 170 if desired, and create the sorted self._test_files_list. | 170 if desired, and create the sorted self._test_files_list. |
| 171 """ | 171 """ |
| 172 # Filter and sort out files from the skipped, ignored, and fixable file | |
| 173 # lists. | |
| 174 saved_test_files = set() | |
| 175 if len(self._test_files) == 1: | |
| 176 # If there's only one test file, we don't want to skip it, but we do want | |
| 177 # to sort it. So we save it to add back to the list later. | |
| 178 saved_test_files = self._test_files | |
| 179 | |
| 180 # Remove skipped - both fixable and ignored - files from the | 172 # Remove skipped - both fixable and ignored - files from the |
| 181 # top-level list of files to test. | 173 # top-level list of files to test. |
| 182 skipped = (self._expectations.GetSkipped() | | 174 skipped = set() |
| 183 self._expectations.GetWontFixSkipped()) | 175 # If there was only one test file, we'll run it even if it was skipped. |
| 176 if len(self._test_files) > 1 and not self._options.force: |
| 177 skipped = (self._expectations.GetSkipped() | |
| 178 self._expectations.GetWontFixSkipped()) |
| 179 self._test_files -= skipped |
| 184 | 180 |
| 185 self._test_files -= skipped | 181 if self._options.force: |
| 186 | 182 logging.info('Skipped: 0 tests (--force)') |
| 187 # If there was only one test file, run the test even if it was skipped. | 183 else: |
| 188 if len(saved_test_files): | 184 logging.info('Skipped: %d tests' % len(skipped)) |
| 189 self._test_files = saved_test_files | |
| 190 | |
| 191 logging.info('Skipped: %d tests' % len(skipped)) | |
| 192 logging.info('Skipped tests do not appear in any of the below numbers\n') | 185 logging.info('Skipped tests do not appear in any of the below numbers\n') |
| 193 | 186 |
| 194 # Create a sorted list of test files so the subset chunk, if used, contains | 187 # Create a sorted list of test files so the subset chunk, if used, contains |
| 195 # alphabetically consecutive tests. | 188 # alphabetically consecutive tests. |
| 196 self._test_files_list = list(self._test_files) | 189 self._test_files_list = list(self._test_files) |
| 197 if self._options.randomize_order: | 190 if self._options.randomize_order: |
| 198 random.shuffle(self._test_files_list) | 191 random.shuffle(self._test_files_list) |
| 199 else: | 192 else: |
| 200 self._test_files_list.sort(self.TestFilesSort) | 193 self._test_files_list.sort(self.TestFilesSort) |
| 201 | 194 |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 logging.info("Exit status: %d" % has_new_failures) | 753 logging.info("Exit status: %d" % has_new_failures) |
| 761 sys.exit(has_new_failures) | 754 sys.exit(has_new_failures) |
| 762 | 755 |
| 763 if '__main__' == __name__: | 756 if '__main__' == __name__: |
| 764 option_parser = optparse.OptionParser() | 757 option_parser = optparse.OptionParser() |
| 765 option_parser.add_option("", "--no-pixel-tests", action="store_true", | 758 option_parser.add_option("", "--no-pixel-tests", action="store_true", |
| 766 default=False, | 759 default=False, |
| 767 help="disable pixel-to-pixel PNG comparisons") | 760 help="disable pixel-to-pixel PNG comparisons") |
| 768 option_parser.add_option("", "--fuzzy-pixel-tests", action="store_true", | 761 option_parser.add_option("", "--fuzzy-pixel-tests", action="store_true", |
| 769 default=False, | 762 default=False, |
| 770 help="Also use fuzzy matching to compare pixel test " | 763 help="Also use fuzzy matching to compare pixel test" |
| 771 "outputs.") | 764 " outputs.") |
| 772 option_parser.add_option("", "--results-directory", | 765 option_parser.add_option("", "--results-directory", |
| 773 default="layout-test-results", | 766 default="layout-test-results", |
| 774 help="Output results directory source dir," | 767 help="Output results directory source dir," |
| 775 " relative to Debug or Release") | 768 " relative to Debug or Release") |
| 776 option_parser.add_option("", "--new-baseline", action="store_true", | 769 option_parser.add_option("", "--new-baseline", action="store_true", |
| 777 default=False, | 770 default=False, |
| 778 help="save all generated results as new baselines " | 771 help="save all generated results as new baselines " |
| 779 "into the platform directory, overwriting " | 772 "into the platform directory, overwriting " |
| 780 "whatever's already there.") | 773 "whatever's already there.") |
| 781 option_parser.add_option("", "--noshow-results", action="store_true", | 774 option_parser.add_option("", "--noshow-results", action="store_true", |
| 782 default=False, help="don't launch the test_shell" | 775 default=False, help="don't launch the test_shell" |
| 783 " with results after the tests are done") | 776 " with results after the tests are done") |
| 784 option_parser.add_option("", "--full-results-html", action="store_true", | 777 option_parser.add_option("", "--full-results-html", action="store_true", |
| 785 default=False, help="show all failures in" | 778 default=False, help="show all failures in " |
| 786 "results.html, rather than only regressions") | 779 "results.html, rather than only regressions") |
| 787 option_parser.add_option("", "--lint-test-files", action="store_true", | 780 option_parser.add_option("", "--lint-test-files", action="store_true", |
| 788 default=False, help="Makes sure the test files" | 781 default=False, help="Makes sure the test files " |
| 789 "parse for all configurations. Does not run any" | 782 "parse for all configurations. Does not run any " |
| 790 "tests.") | 783 "tests.") |
| 784 option_parser.add_option("", "--force", action="store_true", |
| 785 default=False, |
| 786 help="Run all tests, even those marked SKIP in the " |
| 787 "test list") |
| 791 option_parser.add_option("", "--nocompare-failures", action="store_true", | 788 option_parser.add_option("", "--nocompare-failures", action="store_true", |
| 792 default=False, | 789 default=False, |
| 793 help="Disable comparison to the last test run. " | 790 help="Disable comparison to the last test run. " |
| 794 "When enabled, show stats on how many tests " | 791 "When enabled, show stats on how many tests " |
| 795 "newly pass or fail.") | 792 "newly pass or fail.") |
| 796 option_parser.add_option("", "--num-test-shells", | 793 option_parser.add_option("", "--num-test-shells", |
| 797 default=1, | 794 default=1, |
| 798 help="Number of testshells to run in parallel.") | 795 help="Number of testshells to run in parallel.") |
| 799 option_parser.add_option("", "--time-out-ms", | 796 option_parser.add_option("", "--time-out-ms", |
| 800 default=None, | 797 default=None, |
| 801 help="Set the timeout for each test") | 798 help="Set the timeout for each test") |
| 802 option_parser.add_option("", "--run-singly", action="store_true", | 799 option_parser.add_option("", "--run-singly", action="store_true", |
| 803 default=False, | 800 default=False, |
| 804 help="run a separate test_shell for each test") | 801 help="run a separate test_shell for each test") |
| 805 option_parser.add_option("", "--debug", action="store_true", default=False, | 802 option_parser.add_option("", "--debug", action="store_true", default=False, |
| 806 help="use the debug binary instead of the release " | 803 help="use the debug binary instead of the release " |
| 807 "binary") | 804 "binary") |
| 808 option_parser.add_option("", "--platform", | 805 option_parser.add_option("", "--platform", |
| 809 help="Override the platform for expected results") | 806 help="Override the platform for expected results") |
| 810 option_parser.add_option("", "--target", default="", | 807 option_parser.add_option("", "--target", default="", |
| 811 help="Set the build target configuration (overrides" | 808 help="Set the build target configuration (overrides" |
| 812 "--debug)") | 809 " --debug)") |
| 813 # TODO(pamg): Support multiple levels of verbosity, and remove --sources. | 810 # TODO(pamg): Support multiple levels of verbosity, and remove --sources. |
| 814 option_parser.add_option("-v", "--verbose", action="store_true", | 811 option_parser.add_option("-v", "--verbose", action="store_true", |
| 815 default=False, help="include debug-level logging") | 812 default=False, help="include debug-level logging") |
| 816 option_parser.add_option("", "--sources", action="store_true", | 813 option_parser.add_option("", "--sources", action="store_true", |
| 817 help="show expected result file path for each test " | 814 help="show expected result file path for each test " |
| 818 "(implies --verbose)") | 815 "(implies --verbose)") |
| 819 option_parser.add_option("", "--startup-dialog", action="store_true", | 816 option_parser.add_option("", "--startup-dialog", action="store_true", |
| 820 default=False, | 817 default=False, |
| 821 help="create a dialog on test_shell.exe startup") | 818 help="create a dialog on test_shell.exe startup") |
| 822 option_parser.add_option("", "--gp-fault-error-box", action="store_true", | 819 option_parser.add_option("", "--gp-fault-error-box", action="store_true", |
| 823 default=False, | 820 default=False, |
| 824 help="enable Windows GP fault error box") | 821 help="enable Windows GP fault error box") |
| 825 option_parser.add_option("", "--wrapper", | 822 option_parser.add_option("", "--wrapper", |
| 826 help="wrapper command to insert before invocations " | 823 help="wrapper command to insert before invocations " |
| 827 "of test_shell; option is split on whitespace " | 824 "of test_shell; option is split on whitespace " |
| 828 "before running. (example: " | 825 "before running. (example: " |
| 829 "--wrapper='valgrind --smc-check=all')") | 826 "--wrapper='valgrind --smc-check=all')") |
| 830 option_parser.add_option("", "--test-list", action="append", | 827 option_parser.add_option("", "--test-list", action="append", |
| 831 help="read list of tests to run from file", | 828 help="read list of tests to run from file", |
| 832 metavar="FILE") | 829 metavar="FILE") |
| 833 option_parser.add_option("", "--nocheck-sys-deps", action="store_true", | 830 option_parser.add_option("", "--nocheck-sys-deps", action="store_true", |
| 834 default=False, | 831 default=False, |
| 835 help="Don't check the system dependencies (themes)") | 832 help="Don't check the system dependencies (themes)") |
| 836 option_parser.add_option("", "--randomize-order", action="store_true", | 833 option_parser.add_option("", "--randomize-order", action="store_true", |
| 837 default=False, | 834 default=False, |
| 838 help=("Run tests in random order (useful for " | 835 help=("Run tests in random order (useful for " |
| 839 "tracking down corruption)")) | 836 "tracking down corruption)")) |
| 840 option_parser.add_option("", "--run-chunk", | 837 option_parser.add_option("", "--run-chunk", |
| 841 default=None, | 838 default=None, |
| 842 help=("Run a specified chunk (n:l), the nth of len l" | 839 help=("Run a specified chunk (n:l), the nth of len " |
| 843 ", of the layout tests")) | 840 "l, of the layout tests")) |
| 844 option_parser.add_option("", "--run-part", | 841 option_parser.add_option("", "--run-part", |
| 845 default=None, | 842 default=None, |
| 846 help=("Run a specified part (n:l), the nth of lth" | 843 help=("Run a specified part (n:m), the nth of m" |
| 847 ", of the layout tests")) | 844 " parts, of the layout tests")) |
| 848 option_parser.add_option("", "--batch-size", | 845 option_parser.add_option("", "--batch-size", |
| 849 default=None, | 846 default=None, |
| 850 help=("Run a the tests in batches (n), after every " | 847 help=("Run a the tests in batches (n), after every " |
| 851 "n tests, the test shell is relaunched.")) | 848 "n tests, the test shell is relaunched.")) |
| 852 options, args = option_parser.parse_args() | 849 options, args = option_parser.parse_args() |
| 853 main(options, args) | 850 main(options, args) |
| OLD | NEW |