| OLD | NEW |
| 1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
| 2 # Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Sze
ged | 2 # Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Sze
ged |
| 3 # | 3 # |
| 4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
| 5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
| 6 # met: | 6 # met: |
| 7 # | 7 # |
| 8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
| 9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
| 10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 tests_to_run, tests_in_other_chunks = self._finder.split_into_chunks(tes
ts_to_run) | 262 tests_to_run, tests_in_other_chunks = self._finder.split_into_chunks(tes
ts_to_run) |
| 263 self._expectations.add_extra_skipped_tests(tests_in_other_chunks) | 263 self._expectations.add_extra_skipped_tests(tests_in_other_chunks) |
| 264 tests_to_skip.update(tests_in_other_chunks) | 264 tests_to_skip.update(tests_in_other_chunks) |
| 265 | 265 |
| 266 return tests_to_run, tests_to_skip | 266 return tests_to_run, tests_to_skip |
| 267 | 267 |
| 268 def _test_input_for_file(self, test_file): | 268 def _test_input_for_file(self, test_file): |
| 269 return TestInput(test_file, | 269 return TestInput(test_file, |
| 270 self._options.slow_time_out_ms if self._test_is_slow(te
st_file) else self._options.time_out_ms, | 270 self._options.slow_time_out_ms if self._test_is_slow(te
st_file) else self._options.time_out_ms, |
| 271 self._test_requires_lock(test_file), | 271 self._test_requires_lock(test_file), |
| 272 should_add_missing_baselines=(self._options.new_test_re
sults and not self._test_is_expected_missing(test_file))) | 272 should_add_missing_baselines=(self._options.new_test_re
sults and |
| 273 not self._test_is_expecte
d_missing(test_file))) |
| 273 | 274 |
| 274 def _test_requires_lock(self, test_file): | 275 def _test_requires_lock(self, test_file): |
| 275 """Return True if the test needs to be locked when running multiple | 276 """Return True if the test needs to be locked when running multiple |
| 276 instances of this test runner. | 277 instances of this test runner. |
| 277 | 278 |
| 278 Perf tests are locked because heavy load caused by running other | 279 Perf tests are locked because heavy load caused by running other |
| 279 tests in parallel might cause some of them to time out. | 280 tests in parallel might cause some of them to time out. |
| 280 """ | 281 """ |
| 281 return self._is_http_test(test_file) or self._is_perf_test(test_file) | 282 return self._is_http_test(test_file) or self._is_perf_test(test_file) |
| 282 | 283 |
| 283 def _test_is_expected_missing(self, test_file): | 284 def _test_is_expected_missing(self, test_file): |
| 284 expectations = self._expectations.model().get_expectations(test_file) | 285 expectations = self._expectations.model().get_expectations(test_file) |
| 285 return test_expectations.MISSING in expectations or test_expectations.NE
EDS_REBASELINE in expectations or test_expectations.NEEDS_MANUAL_REBASELINE in e
xpectations | 286 return (test_expectations.MISSING in expectations or |
| 287 test_expectations.NEEDS_REBASELINE in expectations or |
| 288 test_expectations.NEEDS_MANUAL_REBASELINE in expectations) |
| 286 | 289 |
| 287 def _test_is_slow(self, test_file): | 290 def _test_is_slow(self, test_file): |
| 288 return test_expectations.SLOW in self._expectations.model().get_expectat
ions(test_file) | 291 return test_expectations.SLOW in self._expectations.model().get_expectat
ions(test_file) |
| 289 | 292 |
| 290 def _needs_servers(self, test_names): | 293 def _needs_servers(self, test_names): |
| 291 return any(self._test_requires_lock(test_name) for test_name in test_nam
es) | 294 return any(self._test_requires_lock(test_name) for test_name in test_nam
es) |
| 292 | 295 |
| 293 def _rename_results_folder(self): | 296 def _rename_results_folder(self): |
| 294 try: | 297 try: |
| 295 timestamp = time.strftime( | 298 timestamp = time.strftime( |
| 296 "%Y-%m-%d-%H-%M-%S", time.localtime(self._filesystem.mtime(self.
_filesystem.join(self._results_directory, "results.html")))) | 299 "%Y-%m-%d-%H-%M-%S", time.localtime( |
| 300 self._filesystem.mtime(self._filesystem.join(self._results_d
irectory, "results.html")))) |
| 297 except (IOError, OSError) as e: | 301 except (IOError, OSError) as e: |
| 298 # It might be possible that results.html was not generated in previo
us run, because the test | 302 # It might be possible that results.html was not generated in previo
us run, because the test |
| 299 # run was interrupted even before testing started. In those cases, d
on't archive the folder. | 303 # run was interrupted even before testing started. In those cases, d
on't archive the folder. |
| 300 # Simply override the current folder contents with new results. | 304 # Simply override the current folder contents with new results. |
| 301 import errno | 305 import errno |
| 302 if e.errno == errno.EEXIST or e.errno == errno.ENOENT: | 306 if e.errno == errno.EEXIST or e.errno == errno.ENOENT: |
| 303 self._printer.write_update("No results.html file found in previo
us run, skipping it.") | 307 self._printer.write_update("No results.html file found in previo
us run, skipping it.") |
| 304 return None | 308 return None |
| 305 archived_name = ''.join((self._filesystem.basename(self._results_directo
ry), "_", timestamp)) | 309 archived_name = ''.join((self._filesystem.basename(self._results_directo
ry), "_", timestamp)) |
| 306 archived_path = self._filesystem.join(self._filesystem.dirname(self._res
ults_directory), archived_name) | 310 archived_path = self._filesystem.join(self._filesystem.dirname(self._res
ults_directory), archived_name) |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 for dir in file_list: | 468 for dir in file_list: |
| 465 file_path = self._filesystem.join(dir_above_results_path, dir) | 469 file_path = self._filesystem.join(dir_above_results_path, dir) |
| 466 if self._filesystem.isdir(file_path) and self._results_directory in
file_path: | 470 if self._filesystem.isdir(file_path) and self._results_directory in
file_path: |
| 467 results_directories.append(file_path) | 471 results_directories.append(file_path) |
| 468 self._delete_dirs(results_directories) | 472 self._delete_dirs(results_directories) |
| 469 | 473 |
| 470 # Port specific clean-up. | 474 # Port specific clean-up. |
| 471 self._port.clobber_old_port_specific_results() | 475 self._port.clobber_old_port_specific_results() |
| 472 | 476 |
| 473 def _tests_to_retry(self, run_results): | 477 def _tests_to_retry(self, run_results): |
| 474 # TODO(ojan): This should also check that result.type != test_expectatio
ns.MISSING since retrying missing expectations is silly. | 478 # TODO(ojan): This should also check that result.type != test_expectatio
ns.MISSING |
| 475 # But that's a bit tricky since we only consider the last retry attempt
for the count of unexpected regressions. | 479 # since retrying missing expectations is silly. But that's a bit tricky
since we |
| 480 # only consider the last retry attempt for the count of unexpected regre
ssions. |
| 476 return [result.test_name for result in run_results.unexpected_results_by
_name.values( | 481 return [result.test_name for result in run_results.unexpected_results_by
_name.values( |
| 477 ) if result.type != test_expectations.PASS] | 482 ) if result.type != test_expectations.PASS] |
| 478 | 483 |
| 479 def _write_json_files(self, summarized_full_results, summarized_failing_resu
lts, initial_results, running_all_tests): | 484 def _write_json_files(self, summarized_full_results, summarized_failing_resu
lts, initial_results, running_all_tests): |
| 480 _log.debug("Writing JSON files in %s.", self._results_directory) | 485 _log.debug("Writing JSON files in %s.", self._results_directory) |
| 481 | 486 |
| 482 # FIXME: Upload stats.json to the server and delete times_ms. | 487 # FIXME: Upload stats.json to the server and delete times_ms. |
| 483 times_trie = json_results_generator.test_timings_trie(initial_results.re
sults_by_name.values()) | 488 times_trie = json_results_generator.test_timings_trie(initial_results.re
sults_by_name.values()) |
| 484 times_json_path = self._filesystem.join(self._results_directory, "times_
ms.json") | 489 times_json_path = self._filesystem.join(self._results_directory, "times_
ms.json") |
| 485 json_results_generator.write_json(self._filesystem, times_trie, times_js
on_path) | 490 json_results_generator.write_json(self._filesystem, times_trie, times_js
on_path) |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 | 558 |
| 554 stats = {} | 559 stats = {} |
| 555 for result in initial_results.results_by_name.values(): | 560 for result in initial_results.results_by_name.values(): |
| 556 if result.type != test_expectations.SKIP: | 561 if result.type != test_expectations.SKIP: |
| 557 stats[result.test_name] = {'results': (_worker_number(result.wor
ker_name), result.test_number, result.pid, int( | 562 stats[result.test_name] = {'results': (_worker_number(result.wor
ker_name), result.test_number, result.pid, int( |
| 558 result.test_run_time * 1000), int(result.total_run_time * 10
00))} | 563 result.test_run_time * 1000), int(result.total_run_time * 10
00))} |
| 559 stats_trie = {} | 564 stats_trie = {} |
| 560 for name, value in stats.iteritems(): | 565 for name, value in stats.iteritems(): |
| 561 json_results_generator.add_path_to_trie(name, value, stats_trie) | 566 json_results_generator.add_path_to_trie(name, value, stats_trie) |
| 562 return stats_trie | 567 return stats_trie |
| OLD | NEW |