Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py (136768 => 136769)
--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py 2012-12-05 23:25:07 UTC (rev 136768)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py 2012-12-05 23:26:24 UTC (rev 136769)
@@ -56,6 +56,14 @@
TestExpectations = test_expectations.TestExpectations
+class RunDetails(object):
+ def __init__(self, exit_code, summarized_results=None, result_summary=None, retry_summary=None):
+ self.exit_code = exit_code
+ self.summarized_results = summarized_results
+ self.result_summary = result_summary
+ self.retry_summary = retry_summary
+
+
def interpret_test_failures(failures):
test_dict = {}
failure_types = [type(failure) for failure in failures]
@@ -331,13 +339,13 @@
return True
def run(self, args):
- """Run all our tests on all our test files and return the number of unexpected results (0 == success)."""
+ """Run the tests and return a RunDetails object with the results."""
self._printer.write_update("Collecting tests ...")
try:
paths, test_names = self._collect_tests(args)
except IOError:
# This is raised if --test-list doesn't exist
- return -1
+ return RunDetails(exit_code=-1)
self._printer.write_update("Parsing expectations ...")
self._expectations = test_expectations.TestExpectations(self._port, test_names)
@@ -348,10 +356,10 @@
# Check to make sure we're not skipping every test.
if not tests_to_run:
_log.critical('No tests to run.')
- return -1
+ return RunDetails(exit_code=-1)
if not self._set_up_run(tests_to_run):
- return -1
+ return RunDetails(exit_code=-1)
start_time = time.time()
try:
@@ -391,7 +399,8 @@
(self._options.full_results_html and result_summary.total_failures)):
self._port.show_results_html_file(results_path)
- return self._port.exit_code_from_summarized_results(summarized_results)
+ return RunDetails(self._port.exit_code_from_summarized_results(summarized_results),
+ summarized_results, result_summary, retry_summary)
def _run_tests(self, tests_to_run, tests_to_skip, repeat_each, iterations, num_workers, retrying):
needs_http = self._port.requires_http_server() or any(self._is_http_test(test) for test in tests_to_run)
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py (136768 => 136769)
--- trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py 2012-12-05 23:25:07 UTC (rev 136768)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py 2012-12-05 23:26:24 UTC (rev 136769)
@@ -91,19 +91,16 @@
printer = printing.Printer(port, options, regular_output, buildbot_output, logger=logging.getLogger())
_set_up_derived_options(port, options)
-
- if options.lint_test_files:
- return lint(port, options)
-
manager = Manager(port, options, printer)
printer.print_config(port.results_directory())
- unexpected_result_count = manager.run(args)
- _log.debug("Testing completed, Exit status: %d" % unexpected_result_count)
- return unexpected_result_count
+ run_details = manager.run(args)
+ _log.debug("Testing completed, Exit status: %d" % run_details.exit_code)
+ return run_details
finally:
printer.cleanup()
+
def _set_up_derived_options(port, options):
"""Sets the options values that depend on other options values."""
if not options.child_processes:
@@ -419,7 +416,9 @@
logging.getLogger().setLevel(logging.DEBUG if options.debug_rwt_logging else logging.INFO)
try:
- return run(port, options, args)
+ if options.lint_test_files:
+ return lint(port, options)
+ return run(port, options, args).exit_code
except Exception, e:
print >> sys.stderr, '\n%s raised: %s' % (e.__class__.__name__, str(e))
traceback.print_exc(file=sys.stderr)
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py (136768 => 136769)
--- trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py 2012-12-05 23:25:07 UTC (rev 136768)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py 2012-12-05 23:26:24 UTC (rev 136769)
@@ -88,8 +88,8 @@
buildbot_output = StringIO.StringIO()
regular_output = StringIO.StringIO()
- res = run_webkit_tests.run(port_obj, options, parsed_args, buildbot_output=buildbot_output, regular_output=regular_output)
- return res == 0
+ run_details = run_webkit_tests.run(port_obj, options, parsed_args, buildbot_output=buildbot_output, regular_output=regular_output)
+ return run_details.exit_code == 0
def logging_run(extra_args=None, port_obj=None, tests_included=False, host=None, new_results=False, shared_port=True):
@@ -112,12 +112,12 @@
oc.capture_output()
buildbot_output = StringIO.StringIO()
regular_output = StringIO.StringIO()
- res = run_webkit_tests.run(port_obj, options, parsed_args,
- buildbot_output=buildbot_output,
- regular_output=regular_output)
+ run_details = run_webkit_tests.run(port_obj, options, parsed_args,
+ buildbot_output=buildbot_output,
+ regular_output=regular_output)
finally:
oc.restore_output()
- return (res, buildbot_output, regular_output)
+ return (run_details.exit_code, buildbot_output, regular_output)
def get_tests_run(extra_args=None, tests_included=False, flatten_batches=False,
@@ -245,30 +245,49 @@
self.assertEqual(host.ports_parsed, ['a'])
def test_lint_test_files(self):
- res, out, err, user = logging_run(['--lint-test-files'])
+ oc = outputcapture.OutputCapture()
+ oc.capture_output()
+ try:
+ res = run_webkit_tests.main(['--platform', 'test', '--lint-test-files'])
+ finally:
+ out, err, logs = oc.restore_output()
+
self.assertEqual(res, 0)
- self.assertEmpty(out)
- self.assertContains(err, 'Lint succeeded')
+ self.assertEqual(out, '')
+ self.assertEqual(err, '')
+ self.assertTrue('Lint succeeded' in logs)
def test_lint_test_files__errors(self):
- options, parsed_args = parse_args(['--lint-test-files'])
+ options, parsed_args = parse_args(['--platform', 'test', '--lint-test-files'])
host = MockHost()
port_obj = host.port_factory.get(options.platform, options=options)
port_obj.expectations_dict = lambda: {'': '-- syntax error'}
- res, out, err = run_and_capture(port_obj, options, parsed_args)
+ oc = outputcapture.OutputCapture()
+ oc.capture_output()
+ try:
+ res = run_webkit_tests.lint(port_obj, options)
+ finally:
+ out, err, logs = oc.restore_output()
+
self.assertEqual(res, -1)
- self.assertEmpty(out)
- self.assertTrue(any(['Lint failed' in msg for msg in err.buflist]))
+ self.assertEqual(out, '')
+ self.assertEqual(err, '')
+ self.assertTrue('Lint failed' in logs)
# ensure we lint *all* of the files in the cascade.
port_obj.expectations_dict = lambda: {'foo': '-- syntax error1', 'bar': '-- syntax error2'}
- res, out, err = run_and_capture(port_obj, options, parsed_args)
+ oc.capture_output()
+ try:
+ res = run_webkit_tests.lint(port_obj, options)
+ finally:
+ out, err, logs = oc.restore_output()
self.assertEqual(res, -1)
- self.assertEmpty(out)
- self.assertTrue(any(['foo:1' in msg for msg in err.buflist]))
- self.assertTrue(any(['bar:1' in msg for msg in err.buflist]))
+ self.assertEqual(out, '')
+ self.assertEqual(err, '')
+ self.assertTrue('foo:1' in logs)
+ self.assertTrue('bar:1' in logs)
class MainTest(unittest.TestCase, StreamTestingMixin):
@@ -944,7 +963,7 @@
port_obj = host.port_factory.get(port_name=options.platform, options=options)
buildbot_output = StringIO.StringIO()
regular_output = StringIO.StringIO()
- res = run_webkit_tests.run(port_obj, options, parsed_args, buildbot_output=buildbot_output, regular_output=regular_output)
+ run_webkit_tests.run(port_obj, options, parsed_args, buildbot_output=buildbot_output, regular_output=regular_output)
self.assertTrue('text.html passed' in regular_output.getvalue())
self.assertTrue('image.html passed' in regular_output.getvalue())