| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 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 | 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 logging.info('Skipped tests do not appear in any of the below numbers\n') | 252 logging.info('Skipped tests do not appear in any of the below numbers\n') |
| 253 | 253 |
| 254 # Create a sorted list of test files so the subset chunk, if used, contains | 254 # Create a sorted list of test files so the subset chunk, if used, contains |
| 255 # alphabetically consecutive tests. | 255 # alphabetically consecutive tests. |
| 256 self._test_files_list = list(self._test_files) | 256 self._test_files_list = list(self._test_files) |
| 257 if self._options.randomize_order: | 257 if self._options.randomize_order: |
| 258 random.shuffle(self._test_files_list) | 258 random.shuffle(self._test_files_list) |
| 259 else: | 259 else: |
| 260 self._test_files_list.sort(self.TestFilesSort) | 260 self._test_files_list.sort(self.TestFilesSort) |
| 261 | 261 |
| 262 # Chunking replaces self._expectations, which loses all the skipped test |
| 263 # information. Keep the prechunk expectations for tracking number of |
| 264 # skipped tests. |
| 265 self.prechunk_expectations = self._expectations; |
| 266 |
| 262 # If the user specifies they just want to run a subset of the tests, | 267 # If the user specifies they just want to run a subset of the tests, |
| 263 # just grab a subset of the non-skipped tests. | 268 # just grab a subset of the non-skipped tests. |
| 264 if self._options.run_chunk or self._options.run_part: | 269 if self._options.run_chunk or self._options.run_part: |
| 265 chunk_value = self._options.run_chunk or self._options.run_part | 270 chunk_value = self._options.run_chunk or self._options.run_part |
| 266 test_files = self._test_files_list | 271 test_files = self._test_files_list |
| 267 try: | 272 try: |
| 268 (chunk_num, chunk_len) = chunk_value.split(":") | 273 (chunk_num, chunk_len) = chunk_value.split(":") |
| 269 chunk_num = int(chunk_num) | 274 chunk_num = int(chunk_num) |
| 270 assert(chunk_num >= 0) | 275 assert(chunk_num >= 0) |
| 271 test_size = int(chunk_len) | 276 test_size = int(chunk_len) |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 elif self._expectations.IsIgnored(test): | 821 elif self._expectations.IsIgnored(test): |
| 817 count_group = wontfix_counts | 822 count_group = wontfix_counts |
| 818 failure_group = wontfix_failures | 823 failure_group = wontfix_failures |
| 819 else: | 824 else: |
| 820 count_group = fixable_counts | 825 count_group = fixable_counts |
| 821 failure_group = fixable_failures | 826 failure_group = fixable_failures |
| 822 | 827 |
| 823 AddFailure(count_group, failure.__class__) | 828 AddFailure(count_group, failure.__class__) |
| 824 failure_group.add(test) | 829 failure_group.add(test) |
| 825 | 830 |
| 831 # Here and below, use the prechuncked expectations object for numbers of |
| 832 # skipped tests. Chunking removes the skipped tests before creating the |
| 833 # expectations file. |
| 834 # |
| 835 # This is a bit inaccurate, since the number of skipped tests will be |
| 836 # duplicated across all shard, but it's the best we can reasonably do. |
| 837 |
| 826 deduped_fixable_count = len(fixable_failures | | 838 deduped_fixable_count = len(fixable_failures | |
| 827 self._expectations.GetFixableSkipped()) | 839 self.prechunk_expectations.GetFixableSkipped()) |
| 828 all_fixable_count = len(self._test_files - | 840 all_fixable_count = len(self._test_files - |
| 829 self._expectations.GetWontFix() - self._expectations.GetDeferred()) | 841 self._expectations.GetWontFix() - self._expectations.GetDeferred()) |
| 830 | 842 |
| 831 # Breakdown of tests we need to fix and want to pass. | 843 # Breakdown of tests we need to fix and want to pass. |
| 832 # Include skipped fixable tests in the statistics. | 844 # Include skipped fixable tests in the statistics. |
| 833 fixable_result_summary = ResultSummaryEntry( | 845 fixable_result_summary = ResultSummaryEntry( |
| 834 self._expectations.GetFixable() | fixable_failures, | 846 self._expectations.GetFixable() | fixable_failures, |
| 835 fixable_failures, | 847 fixable_failures, |
| 836 fixable_counts, | 848 fixable_counts, |
| 837 self._expectations.GetFixableSkipped()) | 849 self.prechunk_expectations.GetFixableSkipped()) |
| 838 | 850 |
| 839 deferred_result_summary = ResultSummaryEntry( | 851 deferred_result_summary = ResultSummaryEntry( |
| 840 self._expectations.GetDeferred(), | 852 self._expectations.GetDeferred(), |
| 841 deferred_failures, | 853 deferred_failures, |
| 842 deferred_counts, | 854 deferred_counts, |
| 843 self._expectations.GetDeferredSkipped()) | 855 self.prechunk_expectations.GetDeferredSkipped()) |
| 844 | 856 |
| 845 wontfix_result_summary = ResultSummaryEntry( | 857 wontfix_result_summary = ResultSummaryEntry( |
| 846 self._expectations.GetWontFix(), | 858 self._expectations.GetWontFix(), |
| 847 wontfix_failures, | 859 wontfix_failures, |
| 848 wontfix_counts, | 860 wontfix_counts, |
| 849 self._expectations.GetWontFixSkipped()) | 861 self.prechunk_expectations.GetWontFixSkipped()) |
| 850 | 862 |
| 851 return ResultSummary(deferred_result_summary, wontfix_result_summary, | 863 return ResultSummary(deferred_result_summary, wontfix_result_summary, |
| 852 fixable_result_summary, deduped_fixable_count, all_fixable_count) | 864 fixable_result_summary, deduped_fixable_count, all_fixable_count) |
| 853 | 865 |
| 854 def _PrintResultSummary(self, result_summary, output): | 866 def _PrintResultSummary(self, result_summary, output): |
| 855 """Print a short summary to stdout about how many tests passed. | 867 """Print a short summary to stdout about how many tests passed. |
| 856 | 868 |
| 857 Args: | 869 Args: |
| 858 result_summary: ResultSummary object with failure counts. | 870 result_summary: ResultSummary object with failure counts. |
| 859 output: file descriptor to write the results to. For example, sys.stdout. | 871 output: file descriptor to write the results to. For example, sys.stdout. |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 option_parser.add_option("", "--build-number", | 1253 option_parser.add_option("", "--build-number", |
| 1242 default="DUMMY_BUILD_NUMBER", | 1254 default="DUMMY_BUILD_NUMBER", |
| 1243 help=("The build number of the builder running" | 1255 help=("The build number of the builder running" |
| 1244 "this script.")) | 1256 "this script.")) |
| 1245 option_parser.add_option("", "--find-baselines", action="store_true", | 1257 option_parser.add_option("", "--find-baselines", action="store_true", |
| 1246 default=False, | 1258 default=False, |
| 1247 help="Prints a table mapping tests to their " | 1259 help="Prints a table mapping tests to their " |
| 1248 "expected results") | 1260 "expected results") |
| 1249 options, args = option_parser.parse_args() | 1261 options, args = option_parser.parse_args() |
| 1250 main(options, args) | 1262 main(options, args) |
| OLD | NEW |