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 26 matching lines...) Expand all Loading... | |
37 The Manager object has a constructor and one main method called run. | 37 The Manager object has a constructor and one main method called run. |
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.net.file_uploader import FileUploader | 46 from webkitpy.common.net.file_uploader import FileUploader |
47 from webkitpy.common.webkit_finder import WebKitFinder | |
47 from webkitpy.layout_tests.controllers.layout_test_finder import LayoutTestFinde r | 48 from webkitpy.layout_tests.controllers.layout_test_finder import LayoutTestFinde r |
48 from webkitpy.layout_tests.controllers.layout_test_runner import LayoutTestRunne r | 49 from webkitpy.layout_tests.controllers.layout_test_runner import LayoutTestRunne r |
49 from webkitpy.layout_tests.controllers.test_result_writer import TestResultWrite r | 50 from webkitpy.layout_tests.controllers.test_result_writer import TestResultWrite r |
50 from webkitpy.layout_tests.layout_package import json_results_generator | 51 from webkitpy.layout_tests.layout_package import json_results_generator |
51 from webkitpy.layout_tests.models import test_expectations | 52 from webkitpy.layout_tests.models import test_expectations |
52 from webkitpy.layout_tests.models import test_failures | 53 from webkitpy.layout_tests.models import test_failures |
53 from webkitpy.layout_tests.models import test_run_results | 54 from webkitpy.layout_tests.models import test_run_results |
54 from webkitpy.layout_tests.models.test_input import TestInput | 55 from webkitpy.layout_tests.models.test_input import TestInput |
55 from webkitpy.tool import grammar | 56 from webkitpy.tool import grammar |
56 | 57 |
57 _log = logging.getLogger(__name__) | 58 _log = logging.getLogger(__name__) |
58 | 59 |
59 TestExpectations = test_expectations.TestExpectations | 60 TestExpectations = test_expectations.TestExpectations |
60 | 61 |
61 | 62 |
62 class Manager(object): | 63 class Manager(object): |
63 """A class for managing running a series of layout tests.""" | 64 """A class for managing running a series of layout tests.""" |
64 | 65 |
65 def __init__(self, port, options, printer): | 66 def __init__(self, port, options, printer): |
66 """Initialize test runner data structures. | 67 """Initialize test runner data structures. |
67 | 68 |
68 Args: | 69 Args: |
69 port: An object implementing platform-specific functionality. | 70 port: An object implementing platform-specific functionality. |
70 options: An options argument which contains command line options. | 71 options: An options argument which contains command line options. |
71 printer: A Printer object to record updates to. | 72 printer: A Printer object to record updates to. |
72 """ | 73 """ |
73 self._port = port | 74 self._port = port |
75 self._executive = port.host.executive | |
74 self._filesystem = port.host.filesystem | 76 self._filesystem = port.host.filesystem |
75 self._options = options | 77 self._options = options |
76 self._printer = printer | 78 self._printer = printer |
77 self._expectations = None | 79 self._expectations = None |
78 | 80 |
79 self.HTTP_SUBDIR = 'http' + port.TEST_PATH_SEPARATOR | 81 self.HTTP_SUBDIR = 'http' + port.TEST_PATH_SEPARATOR |
80 self.INSPECTOR_SUBDIR = 'inspector' + port.TEST_PATH_SEPARATOR | 82 self.INSPECTOR_SUBDIR = 'inspector' + port.TEST_PATH_SEPARATOR |
81 self.PERF_SUBDIR = 'perf' | 83 self.PERF_SUBDIR = 'perf' |
82 self.WEBSOCKET_SUBDIR = 'websocket' + port.TEST_PATH_SEPARATOR | 84 self.WEBSOCKET_SUBDIR = 'websocket' + port.TEST_PATH_SEPARATOR |
83 self.LAYOUT_TESTS_DIRECTORY = 'LayoutTests' | 85 self.LAYOUT_TESTS_DIRECTORY = 'LayoutTests' |
84 self.ARCHIVED_RESULTS_LIMIT = 25 | 86 self.ARCHIVED_RESULTS_LIMIT = 25 |
85 self._http_server_started = False | 87 self._http_server_started = False |
86 self._wptserve_started = False | 88 self._wptserve_started = False |
87 self._websockets_server_started = False | 89 self._websockets_server_started = False |
88 | 90 |
89 self._results_directory = self._port.results_directory() | 91 self._results_directory = self._port.results_directory() |
90 self._finder = LayoutTestFinder(self._port, self._options) | 92 self._finder = LayoutTestFinder(self._port, self._options) |
93 self._webkit_finder = WebKitFinder(port.host.filesystem) | |
91 self._runner = LayoutTestRunner(self._options, self._port, self._printer , self._results_directory, self._test_is_slow) | 94 self._runner = LayoutTestRunner(self._options, self._port, self._printer , self._results_directory, self._test_is_slow) |
92 | 95 |
93 def run(self, args): | 96 def run(self, args): |
94 """Run the tests and return a RunDetails object with the results.""" | 97 """Run the tests and return a RunDetails object with the results.""" |
95 start_time = time.time() | 98 start_time = time.time() |
96 self._printer.write_update("Collecting tests ...") | 99 self._printer.write_update("Collecting tests ...") |
97 running_all_tests = False | 100 running_all_tests = False |
101 | |
102 # TODO(jeffcarp): unit test | |
103 # if self._will_run_wpt_tests(): | |
104 # Conundrum: MANIFEST.json needs to be generated before we find tests, | |
105 # but to know if we need to generate MANIFEST.json we need to find tests ... | |
jeffcarp
2017/02/21 19:32:11
I need the most help here figuring out if there's
qyearsley
2017/02/21 22:47:57
Always regenerating it seems like a reasonable opt
foolip
2017/02/23 02:51:30
On some systems I think the mtime of LayoutTests/e
| |
106 | |
107 manifest_base_path = self._webkit_finder.path_from_webkit_base( | |
108 'LayoutTests', 'external', 'WPT_BASE_MANIFEST.json') | |
109 manifest_path = self._webkit_finder.path_from_webkit_base( | |
110 'LayoutTests', 'external', 'wpt', 'MANIFEST.json') | |
111 | |
112 if not self._filesystem.exists(manifest_path): | |
113 self._filesystem.copyfile(manifest_base_path, manifest_path) | |
114 | |
115 self._generate_manifest() | |
116 | |
98 try: | 117 try: |
99 paths, all_test_names, running_all_tests = self._collect_tests(args) | 118 paths, all_test_names, running_all_tests = self._collect_tests(args) |
100 except IOError: | 119 except IOError: |
101 # This is raised if --test-list doesn't exist | 120 # This is raised if --test-list doesn't exist |
102 return test_run_results.RunDetails(exit_code=test_run_results.NO_TES TS_EXIT_STATUS) | 121 return test_run_results.RunDetails(exit_code=test_run_results.NO_TES TS_EXIT_STATUS) |
103 | 122 |
104 # Create a sorted list of test files so the subset chunk, | 123 # Create a sorted list of test files so the subset chunk, |
105 # if used, contains alphabetically consecutive tests. | 124 # if used, contains alphabetically consecutive tests. |
106 if self._options.order == 'natural': | 125 if self._options.order == 'natural': |
107 all_test_names.sort(key=self._port.test_key) | 126 all_test_names.sort(key=self._port.test_key) |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
538 | 557 |
539 stats = {} | 558 stats = {} |
540 for result in initial_results.results_by_name.values(): | 559 for result in initial_results.results_by_name.values(): |
541 if result.type != test_expectations.SKIP: | 560 if result.type != test_expectations.SKIP: |
542 stats[result.test_name] = {'results': (_worker_number(result.wor ker_name), result.test_number, result.pid, int( | 561 stats[result.test_name] = {'results': (_worker_number(result.wor ker_name), result.test_number, result.pid, int( |
543 result.test_run_time * 1000), int(result.total_run_time * 10 00))} | 562 result.test_run_time * 1000), int(result.total_run_time * 10 00))} |
544 stats_trie = {} | 563 stats_trie = {} |
545 for name, value in stats.iteritems(): | 564 for name, value in stats.iteritems(): |
546 json_results_generator.add_path_to_trie(name, value, stats_trie) | 565 json_results_generator.add_path_to_trie(name, value, stats_trie) |
547 return stats_trie | 566 return stats_trie |
567 | |
568 def _generate_manifest(self): | |
569 self._printer.write_update('Generating MANIFEST.json for web-platform-te sts ...') | |
570 | |
571 wpt_path = self._webkit_finder.path_from_webkit_base('LayoutTests', 'ext ernal', 'wpt') | |
572 manifest_tool_path = self._webkit_finder.path_from_webkit_base( | |
573 'Tools', 'Scripts', 'webkitpy', 'thirdparty', 'wpt', 'wpt', 'manifes t') | |
574 | |
575 self._executive.run_command(['python', manifest_tool_path, '--work', '-- tests-root', wpt_path]) | |
OLD | NEW |