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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 self._printer = printer | 78 self._printer = printer |
79 self._expectations = None | 79 self._expectations = None |
80 | 80 |
81 self.HTTP_SUBDIR = 'http' + port.TEST_PATH_SEPARATOR | 81 self.HTTP_SUBDIR = 'http' + port.TEST_PATH_SEPARATOR |
82 self.INSPECTOR_SUBDIR = 'inspector' + port.TEST_PATH_SEPARATOR | 82 self.INSPECTOR_SUBDIR = 'inspector' + port.TEST_PATH_SEPARATOR |
83 self.PERF_SUBDIR = 'perf' | 83 self.PERF_SUBDIR = 'perf' |
84 self.WEBSOCKET_SUBDIR = 'websocket' + port.TEST_PATH_SEPARATOR | 84 self.WEBSOCKET_SUBDIR = 'websocket' + port.TEST_PATH_SEPARATOR |
85 self.LAYOUT_TESTS_DIRECTORY = 'LayoutTests' | 85 self.LAYOUT_TESTS_DIRECTORY = 'LayoutTests' |
86 self.ARCHIVED_RESULTS_LIMIT = 25 | 86 self.ARCHIVED_RESULTS_LIMIT = 25 |
87 self._http_server_started = False | 87 self._http_server_started = False |
| 88 self._wptserve_started = False |
88 self._websockets_server_started = False | 89 self._websockets_server_started = False |
89 | 90 |
90 self._results_directory = self._port.results_directory() | 91 self._results_directory = self._port.results_directory() |
91 self._finder = LayoutTestFinder(self._port, self._options) | 92 self._finder = LayoutTestFinder(self._port, self._options) |
92 self._runner = LayoutTestRunner(self._options, self._port, self._printer
, self._results_directory, self._test_is_slow) | 93 self._runner = LayoutTestRunner(self._options, self._port, self._printer
, self._results_directory, self._test_is_slow) |
93 | 94 |
94 def _collect_tests(self, args): | 95 def _collect_tests(self, args): |
95 return self._finder.find_tests(self._options, args) | 96 return self._finder.find_tests(self._options, args) |
96 | 97 |
97 def _is_http_test(self, test): | 98 def _is_http_test(self, test): |
98 return self.HTTP_SUBDIR in test or self._is_websocket_test(test) | 99 return test.startswith(self.HTTP_SUBDIR) or self._is_websocket_test(test
) |
99 | 100 |
100 def _is_inspector_test(self, test): | 101 def _is_inspector_test(self, test): |
101 return self.INSPECTOR_SUBDIR in test | 102 return self.INSPECTOR_SUBDIR in test |
102 | 103 |
103 def _is_websocket_test(self, test): | 104 def _is_websocket_test(self, test): |
| 105 if self._port.is_wpt_enabled() and self._port.is_wpt_test(test): |
| 106 return False |
| 107 |
104 return self.WEBSOCKET_SUBDIR in test | 108 return self.WEBSOCKET_SUBDIR in test |
105 | 109 |
106 def _http_tests(self, test_names): | 110 def _http_tests(self, test_names): |
107 return set(test for test in test_names if self._is_http_test(test)) | 111 return set(test for test in test_names if self._is_http_test(test)) |
108 | 112 |
109 def _is_perf_test(self, test): | 113 def _is_perf_test(self, test): |
110 return self.PERF_SUBDIR == test or (self.PERF_SUBDIR + self._port.TEST_P
ATH_SEPARATOR) in test | 114 return self.PERF_SUBDIR == test or (self.PERF_SUBDIR + self._port.TEST_P
ATH_SEPARATOR) in test |
111 | 115 |
112 def _prepare_lists(self, paths, test_names): | 116 def _prepare_lists(self, paths, test_names): |
113 tests_to_skip = self._finder.skip_tests(paths, test_names, self._expecta
tions, self._http_tests(test_names)) | 117 tests_to_skip = self._finder.skip_tests(paths, test_names, self._expecta
tions, self._http_tests(test_names)) |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 def _run_tests(self, tests_to_run, tests_to_skip, repeat_each, iterations, n
um_workers, retrying): | 329 def _run_tests(self, tests_to_run, tests_to_skip, repeat_each, iterations, n
um_workers, retrying): |
326 | 330 |
327 test_inputs = [] | 331 test_inputs = [] |
328 for _ in xrange(iterations): | 332 for _ in xrange(iterations): |
329 for test in tests_to_run: | 333 for test in tests_to_run: |
330 for _ in xrange(repeat_each): | 334 for _ in xrange(repeat_each): |
331 test_inputs.append(self._test_input_for_file(test)) | 335 test_inputs.append(self._test_input_for_file(test)) |
332 return self._runner.run_tests(self._expectations, test_inputs, tests_to_
skip, num_workers, retrying) | 336 return self._runner.run_tests(self._expectations, test_inputs, tests_to_
skip, num_workers, retrying) |
333 | 337 |
334 def _start_servers(self, tests_to_run): | 338 def _start_servers(self, tests_to_run): |
| 339 if self._port.is_wpt_enabled() and any(self._port.is_wpt_test(test) for
test in tests_to_run): |
| 340 self._printer.write_update('Starting WPTServe ...') |
| 341 self._port.start_wptserve() |
| 342 self._wptserve_started = True |
| 343 |
335 if self._port.requires_http_server() or any((self._is_http_test(test) or
self._is_inspector_test(test)) for test in tests_to_run): | 344 if self._port.requires_http_server() or any((self._is_http_test(test) or
self._is_inspector_test(test)) for test in tests_to_run): |
336 self._printer.write_update('Starting HTTP server ...') | 345 self._printer.write_update('Starting HTTP server ...') |
337 self._port.start_http_server(additional_dirs={}, number_of_drivers=s
elf._options.max_locked_shards) | 346 self._port.start_http_server(additional_dirs={}, number_of_drivers=s
elf._options.max_locked_shards) |
338 self._http_server_started = True | 347 self._http_server_started = True |
339 | 348 |
340 if any(self._is_websocket_test(test) for test in tests_to_run): | 349 if any(self._is_websocket_test(test) for test in tests_to_run): |
341 self._printer.write_update('Starting WebSocket server ...') | 350 self._printer.write_update('Starting WebSocket server ...') |
342 self._port.start_websocket_server() | 351 self._port.start_websocket_server() |
343 self._websockets_server_started = True | 352 self._websockets_server_started = True |
344 | 353 |
345 def _stop_servers(self): | 354 def _stop_servers(self): |
| 355 if self._wptserve_started: |
| 356 self._printer.write_update('Stopping WPTServe ...') |
| 357 self._wptserve_started = False |
| 358 self._port.stop_wptserve() |
346 if self._http_server_started: | 359 if self._http_server_started: |
347 self._printer.write_update('Stopping HTTP server ...') | 360 self._printer.write_update('Stopping HTTP server ...') |
348 self._http_server_started = False | 361 self._http_server_started = False |
349 self._port.stop_http_server() | 362 self._port.stop_http_server() |
350 if self._websockets_server_started: | 363 if self._websockets_server_started: |
351 self._printer.write_update('Stopping WebSocket server ...') | 364 self._printer.write_update('Stopping WebSocket server ...') |
352 self._websockets_server_started = False | 365 self._websockets_server_started = False |
353 self._port.stop_websocket_server() | 366 self._port.stop_websocket_server() |
354 | 367 |
355 def _clean_up_run(self): | 368 def _clean_up_run(self): |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 return int(worker_name.split('/')[1]) if worker_name else -1 | 509 return int(worker_name.split('/')[1]) if worker_name else -1 |
497 | 510 |
498 stats = {} | 511 stats = {} |
499 for result in initial_results.results_by_name.values(): | 512 for result in initial_results.results_by_name.values(): |
500 if result.type != test_expectations.SKIP: | 513 if result.type != test_expectations.SKIP: |
501 stats[result.test_name] = {'results': (_worker_number(result.wor
ker_name), result.test_number, result.pid, int(result.test_run_time * 1000), int
(result.total_run_time * 1000))} | 514 stats[result.test_name] = {'results': (_worker_number(result.wor
ker_name), result.test_number, result.pid, int(result.test_run_time * 1000), int
(result.total_run_time * 1000))} |
502 stats_trie = {} | 515 stats_trie = {} |
503 for name, value in stats.iteritems(): | 516 for name, value in stats.iteritems(): |
504 json_results_generator.add_path_to_trie(name, value, stats_trie) | 517 json_results_generator.add_path_to_trie(name, value, stats_trie) |
505 return stats_trie | 518 return stats_trie |
OLD | NEW |