| 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 27 matching lines...) Expand all Loading... |
| 38 """ | 38 """ |
| 39 | 39 |
| 40 import json | 40 import json |
| 41 import logging | 41 import logging |
| 42 import random | 42 import random |
| 43 import sys | 43 import sys |
| 44 import time | 44 import time |
| 45 | 45 |
| 46 from webkitpy.common import exit_codes | 46 from webkitpy.common import exit_codes |
| 47 from webkitpy.common.net.file_uploader import FileUploader | 47 from webkitpy.common.net.file_uploader import FileUploader |
| 48 from webkitpy.common.webkit_finder import WebKitFinder | 48 from webkitpy.common.path_finder import PathFinder |
| 49 from webkitpy.layout_tests.controllers.layout_test_finder import LayoutTestFinde
r | 49 from webkitpy.layout_tests.controllers.layout_test_finder import LayoutTestFinde
r |
| 50 from webkitpy.layout_tests.controllers.layout_test_runner import LayoutTestRunne
r | 50 from webkitpy.layout_tests.controllers.layout_test_runner import LayoutTestRunne
r |
| 51 from webkitpy.layout_tests.controllers.test_result_writer import TestResultWrite
r | 51 from webkitpy.layout_tests.controllers.test_result_writer import TestResultWrite
r |
| 52 from webkitpy.layout_tests.layout_package import json_results_generator | 52 from webkitpy.layout_tests.layout_package import json_results_generator |
| 53 from webkitpy.layout_tests.models import test_expectations | 53 from webkitpy.layout_tests.models import test_expectations |
| 54 from webkitpy.layout_tests.models import test_failures | 54 from webkitpy.layout_tests.models import test_failures |
| 55 from webkitpy.layout_tests.models import test_run_results | 55 from webkitpy.layout_tests.models import test_run_results |
| 56 from webkitpy.layout_tests.models.test_input import TestInput | 56 from webkitpy.layout_tests.models.test_input import TestInput |
| 57 from webkitpy.tool import grammar | 57 from webkitpy.tool import grammar |
| 58 from webkitpy.w3c.wpt_manifest import WPTManifest | 58 from webkitpy.w3c.wpt_manifest import WPTManifest |
| (...skipping 25 matching lines...) Expand all Loading... |
| 84 self.PERF_SUBDIR = 'perf' | 84 self.PERF_SUBDIR = 'perf' |
| 85 self.WEBSOCKET_SUBDIR = 'websocket' + port.TEST_PATH_SEPARATOR | 85 self.WEBSOCKET_SUBDIR = 'websocket' + port.TEST_PATH_SEPARATOR |
| 86 self.LAYOUT_TESTS_DIRECTORY = 'LayoutTests' | 86 self.LAYOUT_TESTS_DIRECTORY = 'LayoutTests' |
| 87 self.ARCHIVED_RESULTS_LIMIT = 25 | 87 self.ARCHIVED_RESULTS_LIMIT = 25 |
| 88 self._http_server_started = False | 88 self._http_server_started = False |
| 89 self._wptserve_started = False | 89 self._wptserve_started = False |
| 90 self._websockets_server_started = False | 90 self._websockets_server_started = False |
| 91 | 91 |
| 92 self._results_directory = self._port.results_directory() | 92 self._results_directory = self._port.results_directory() |
| 93 self._finder = LayoutTestFinder(self._port, self._options) | 93 self._finder = LayoutTestFinder(self._port, self._options) |
| 94 self._webkit_finder = WebKitFinder(port.host.filesystem) | 94 self._path_finder = PathFinder(port.host.filesystem) |
| 95 self._runner = LayoutTestRunner(self._options, self._port, self._printer
, self._results_directory, self._test_is_slow) | 95 self._runner = LayoutTestRunner(self._options, self._port, self._printer
, self._results_directory, self._test_is_slow) |
| 96 | 96 |
| 97 def run(self, args): | 97 def run(self, args): |
| 98 """Run the tests and return a RunDetails object with the results.""" | 98 """Run the tests and return a RunDetails object with the results.""" |
| 99 start_time = time.time() | 99 start_time = time.time() |
| 100 self._printer.write_update("Collecting tests ...") | 100 self._printer.write_update("Collecting tests ...") |
| 101 running_all_tests = False | 101 running_all_tests = False |
| 102 | 102 |
| 103 self._printer.write_update('Generating MANIFEST.json for web-platform-te
sts ...') | 103 self._printer.write_update('Generating MANIFEST.json for web-platform-te
sts ...') |
| 104 | 104 |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 if response.code == 200: | 535 if response.code == 200: |
| 536 _log.debug("JSON uploaded.") | 536 _log.debug("JSON uploaded.") |
| 537 else: | 537 else: |
| 538 _log.debug("JSON upload failed, %d: '%s'", response.code, re
sponse.read()) | 538 _log.debug("JSON upload failed, %d: '%s'", response.code, re
sponse.read()) |
| 539 else: | 539 else: |
| 540 _log.error("JSON upload failed; no response returned") | 540 _log.error("JSON upload failed; no response returned") |
| 541 except Exception as err: | 541 except Exception as err: |
| 542 _log.error("Upload failed: %s", err) | 542 _log.error("Upload failed: %s", err) |
| 543 | 543 |
| 544 def _copy_results_html_file(self, destination_path): | 544 def _copy_results_html_file(self, destination_path): |
| 545 base_dir = self._webkit_finder.path_from_layout_tests('fast', 'harness') | 545 base_dir = self._path_finder.path_from_layout_tests('fast', 'harness') |
| 546 results_file = self._filesystem.join(base_dir, 'results.html') | 546 results_file = self._filesystem.join(base_dir, 'results.html') |
| 547 # Note that the results.html template file won't exist when we're using
a MockFileSystem during unit tests, | 547 # Note that the results.html template file won't exist when we're using
a MockFileSystem during unit tests, |
| 548 # so make sure it exists before we try to copy it. | 548 # so make sure it exists before we try to copy it. |
| 549 if self._filesystem.exists(results_file): | 549 if self._filesystem.exists(results_file): |
| 550 self._filesystem.copyfile(results_file, destination_path) | 550 self._filesystem.copyfile(results_file, destination_path) |
| 551 | 551 |
| 552 def _stats_trie(self, initial_results): | 552 def _stats_trie(self, initial_results): |
| 553 def _worker_number(worker_name): | 553 def _worker_number(worker_name): |
| 554 return int(worker_name.split('/')[1]) if worker_name else -1 | 554 return int(worker_name.split('/')[1]) if worker_name else -1 |
| 555 | 555 |
| 556 stats = {} | 556 stats = {} |
| 557 for result in initial_results.results_by_name.values(): | 557 for result in initial_results.results_by_name.values(): |
| 558 if result.type != test_expectations.SKIP: | 558 if result.type != test_expectations.SKIP: |
| 559 stats[result.test_name] = {'results': (_worker_number(result.wor
ker_name), result.test_number, result.pid, int( | 559 stats[result.test_name] = {'results': (_worker_number(result.wor
ker_name), result.test_number, result.pid, int( |
| 560 result.test_run_time * 1000), int(result.total_run_time * 10
00))} | 560 result.test_run_time * 1000), int(result.total_run_time * 10
00))} |
| 561 stats_trie = {} | 561 stats_trie = {} |
| 562 for name, value in stats.iteritems(): | 562 for name, value in stats.iteritems(): |
| 563 json_results_generator.add_path_to_trie(name, value, stats_trie) | 563 json_results_generator.add_path_to_trie(name, value, stats_trie) |
| 564 return stats_trie | 564 return stats_trie |
| OLD | NEW |