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 wpt_tests_in_test_list = False | |
103 if self._options.test_list: | |
104 for test in self._options.test_list: | |
105 if test.startswith('external/wpt'): | |
106 wpt_tests_in_test_list = True | |
107 break | |
108 | |
109 # TODO(jeffcarp): unit test | |
110 if wpt_tests_in_test_list or not self._options.test_list: | |
111 self._generate_manifest() | |
112 | |
98 try: | 113 try: |
99 paths, test_names, running_all_tests = self._collect_tests(args) | 114 paths, test_names, running_all_tests = self._collect_tests(args) |
100 except IOError: | 115 except IOError: |
101 # This is raised if --test-list doesn't exist | 116 # 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) | 117 return test_run_results.RunDetails(exit_code=test_run_results.NO_TES TS_EXIT_STATUS) |
103 | 118 |
104 self._printer.write_update("Parsing expectations ...") | 119 self._printer.write_update("Parsing expectations ...") |
105 self._expectations = test_expectations.TestExpectations(self._port, test _names) | 120 self._expectations = test_expectations.TestExpectations(self._port, test _names) |
106 | 121 |
107 tests_to_run, tests_to_skip = self._prepare_lists(paths, test_names) | 122 tests_to_run, tests_to_skip = self._prepare_lists(paths, test_names) |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
538 | 553 |
539 stats = {} | 554 stats = {} |
540 for result in initial_results.results_by_name.values(): | 555 for result in initial_results.results_by_name.values(): |
541 if result.type != test_expectations.SKIP: | 556 if result.type != test_expectations.SKIP: |
542 stats[result.test_name] = {'results': (_worker_number(result.wor ker_name), result.test_number, result.pid, int( | 557 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))} | 558 result.test_run_time * 1000), int(result.total_run_time * 10 00))} |
544 stats_trie = {} | 559 stats_trie = {} |
545 for name, value in stats.iteritems(): | 560 for name, value in stats.iteritems(): |
546 json_results_generator.add_path_to_trie(name, value, stats_trie) | 561 json_results_generator.add_path_to_trie(name, value, stats_trie) |
547 return stats_trie | 562 return stats_trie |
563 | |
564 def _generate_manifest(self): | |
565 _log.info('Generating MANIFEST.json, this might result in changes to MAN IFEST.json\n' | |
foolip
2017/02/16 07:20:26
I have verified that removing MANIFEST.json from t
| |
566 'in your working directory. Please commit them along with your changes.\n' | |
567 'See https://crbug.com/666957.') | |
568 | |
569 wpt_path = self._webkit_finder.path_from_webkit_base('LayoutTests', 'ext ernal', 'wpt') | |
570 manifest_tool_path = self._webkit_finder.path_from_webkit_base( | |
571 'Tools', 'Scripts', 'webkitpy', 'thirdparty', 'wpt', 'wpt', 'manifes t') | |
572 | |
573 self._executive.run_command(['python', manifest_tool_path, '--work', '-- tests-root', wpt_path]) | |
OLD | NEW |