summaryrefslogtreecommitdiff
path: root/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/Scripts/webkitpy/layout_tests/controllers/manager.py')
-rw-r--r--Tools/Scripts/webkitpy/layout_tests/controllers/manager.py91
1 files changed, 62 insertions, 29 deletions
diff --git a/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py b/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
index e762cfda0..3189563d2 100644
--- a/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
+++ b/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
@@ -236,10 +236,13 @@ def summarize_results(port_obj, expectations, result_summary, retry_summary, tes
results['layout_tests_dir'] = port_obj.layout_tests_dir()
results['has_wdiff'] = port_obj.wdiff_available()
results['has_pretty_patch'] = port_obj.pretty_patch_available()
+ results['pixel_tests_enabled'] = port_obj.get_option('pixel_tests')
+
try:
# We only use the svn revision for using trac links in the results.html file,
# Don't do this by default since it takes >100ms.
if use_trac_links_in_results_html(port_obj):
+ port_obj.host._initialize_scm()
results['revision'] = port_obj.host.scm().head_svn_revision()
except Exception, e:
_log.warn("Failed to determine svn revision for checkout (cwd: %s, webkit_base: %s), leaving 'revision' key blank in full_results.json.\n%s" % (port_obj._filesystem.getcwd(), port_obj.path_from_webkit_base(), e))
@@ -316,6 +319,8 @@ class Manager(object):
# a set of test files, and the same tests as a list
+ self._paths = set()
+
# FIXME: Rename to test_names.
self._test_files = set()
self._test_files_list = None
@@ -340,6 +345,7 @@ class Manager(object):
paths = self._strip_test_dir_prefixes(args)
if self._options.test_list:
paths += self._strip_test_dir_prefixes(read_test_files(self._filesystem, self._options.test_list, self._port.TEST_PATH_SEPARATOR))
+ self._paths = set(paths)
self._test_files = self._port.tests(paths)
def _strip_test_dir_prefixes(self, paths):
@@ -360,6 +366,9 @@ class Manager(object):
def _http_tests(self):
return set(test for test in self._test_files if self._is_http_test(test))
+ def _websocket_tests(self):
+ return set(test for test in self._test_files if self.WEBSOCKET_SUBDIR in test)
+
def _is_perf_test(self, test):
return self.PERF_SUBDIR == test or (self.PERF_SUBDIR + self._port.TEST_PATH_SEPARATOR) in test
@@ -456,24 +465,40 @@ class Manager(object):
# Remove skipped - both fixable and ignored - files from the
# top-level list of files to test.
+ found_test_files = set(self._test_files)
num_all_test_files = len(self._test_files)
- self._printer.print_expected("Found: %d tests" % (len(self._test_files)))
- if not num_all_test_files:
- _log.critical('No tests to run.')
- return None
-
- skipped = set()
+ skipped = self._expectations.get_tests_with_result_type(test_expectations.SKIP)
if not self._options.http:
- skipped = skipped.union(self._http_tests())
+ skipped.update(set(self._http_tests()))
+
+ if self._options.skipped == 'only':
+ self._test_files = self._test_files.intersection(skipped)
+ elif self._options.skipped == 'default':
+ self._test_files -= skipped
+ elif self._options.skipped == 'ignore':
+ pass # just to be clear that we're ignoring the skip list.
- if num_all_test_files > 1 and not self._options.force:
- skipped.update(self._expectations.get_tests_with_result_type(test_expectations.SKIP))
- if self._options.skip_failing_tests:
- skipped.update(self._expectations.get_tests_with_result_type(test_expectations.FAIL))
- skipped.update(self._expectations.get_tests_with_result_type(test_expectations.FLAKY))
+ if self._options.skip_failing_tests:
+ self._test_files -= self._expectations.get_tests_with_result_type(test_expectations.FAIL)
+ self._test_files -= self._expectations.get_tests_with_result_type(test_expectations.FLAKY)
- self._test_files -= skipped
+ # now make sure we're explicitly running any tests passed on the command line.
+ self._test_files.update(found_test_files.intersection(self._paths))
+
+ if not num_all_test_files:
+ _log.critical('No tests to run.')
+ return None
+
+ num_skipped = num_all_test_files - len(self._test_files)
+ if num_skipped:
+ self._printer.print_expected("Running %s (found %d, skipping %d)." % (
+ grammar.pluralize('test', num_all_test_files - num_skipped),
+ num_all_test_files, num_skipped))
+ elif len(self._test_files) > 1:
+ self._printer.print_expected("Running all %d tests." % len(self._test_files))
+ else:
+ self._printer.print_expected("Running %1 test.")
# Create a sorted list of test files so the subset chunk,
# if used, contains alphabetically consecutive tests.
@@ -504,9 +529,7 @@ class Manager(object):
self._print_expected_results_of_type(result_summary, test_expectations.FLAKY, "flaky")
self._print_expected_results_of_type(result_summary, test_expectations.SKIP, "skipped")
- if self._options.force:
- self._printer.print_expected('Running all tests, including skips (--force)')
- else:
+ if self._options.skipped != 'ignore':
# Note that we don't actually run the skipped tests (they were
# subtracted out of self._test_files, above), but we stub out the
# results here so the statistics can remain accurate.
@@ -742,7 +765,7 @@ class Manager(object):
all_shards = locked_shards + unlocked_shards
self._remaining_locked_shards = locked_shards
- if locked_shards and self._options.http:
+ if self._options.http and (self._http_tests() or self._websocket_tests()):
self.start_servers_with_lock()
num_workers = min(num_workers, len(all_shards))
@@ -797,7 +820,8 @@ class Manager(object):
_log.error('Worker %d did not exit in time.' % worker_state.number)
except KeyboardInterrupt:
- self._printer.print_update('Interrupted, exiting ...')
+ self._printer.flush()
+ self._printer.write('Interrupted, exiting ...')
self.cancel_workers()
keyboard_interrupted = True
except TestRunInterruptedException, e:
@@ -946,21 +970,24 @@ class Manager(object):
return self._port.exit_code_from_summarized_results(unexpected_results)
def start_servers_with_lock(self):
- assert(self._options.http)
self._printer.print_update('Acquiring http lock ...')
self._port.acquire_http_lock()
- self._printer.print_update('Starting HTTP server ...')
- self._port.start_http_server()
- self._printer.print_update('Starting WebSocket server ...')
- self._port.start_websocket_server()
+ if self._http_tests():
+ self._printer.print_update('Starting HTTP server ...')
+ self._port.start_http_server()
+ if self._websocket_tests():
+ self._printer.print_update('Starting WebSocket server ...')
+ self._port.start_websocket_server()
self._has_http_lock = True
def stop_servers_with_lock(self):
if self._has_http_lock:
- self._printer.print_update('Stopping HTTP server ...')
- self._port.stop_http_server()
- self._printer.print_update('Stopping WebSocket server ...')
- self._port.stop_websocket_server()
+ if self._http_tests():
+ self._printer.print_update('Stopping HTTP server ...')
+ self._port.stop_http_server()
+ if self._websocket_tests():
+ self._printer.print_update('Stopping WebSocket server ...')
+ self._port.stop_websocket_server()
self._printer.print_update('Releasing server lock ...')
self._port.release_http_lock()
self._has_http_lock = False
@@ -1445,9 +1472,10 @@ class Manager(object):
worker_state.current_test_name = test_info.test_name
worker_state.next_timeout = time.time() + hang_timeout
- def handle_done(self, source):
+ def handle_done(self, source, log_messages=None):
worker_state = self._worker_states[source]
worker_state.done = True
+ self._log_messages(log_messages)
def handle_exception(self, source, exception_type, exception_value, stack):
if exception_type in (KeyboardInterrupt, TestRunInterruptedException):
@@ -1474,16 +1502,21 @@ class Manager(object):
if not self._remaining_locked_shards:
self.stop_servers_with_lock()
- def handle_finished_test(self, source, result, elapsed_time):
+ def handle_finished_test(self, source, result, elapsed_time, log_messages=None):
worker_state = self._worker_states[source]
worker_state.next_timeout = None
worker_state.current_test_name = None
worker_state.stats['total_time'] += elapsed_time
worker_state.stats['num_tests'] += 1
+ self._log_messages(log_messages)
self._all_results.append(result)
self._update_summary_with_result(self._current_result_summary, result)
+ def _log_messages(self, messages):
+ for message in messages:
+ self._printer.writeln(*message)
+
def _log_worker_stack(self, stack):
webkitpydir = self._port.path_from_webkit_base('Tools', 'Scripts', 'webkitpy') + self._filesystem.sep
for filename, line_number, function_name, text in stack: