Title: [136769] trunk/Tools
Revision
136769
Author
dpra...@chromium.org
Date
2012-12-05 15:26:24 -0800 (Wed, 05 Dec 2012)

Log Message

nrwt: collect all of the information about a run into a new RunDetails class
https://bugs.webkit.org/show_bug.cgi?id=104158

Reviewed by Ojan Vafai.

This patch collects the information from both test passes (the
main one and the retries) as well as the summarized results and
the exit code into a RunDetails class, so that the integration
tests can more easily tell what happened.

Also, change the way the --lint-test-files works slightly so that
we don't need to create a printer object (and hence we need to
rework the tests that are testing logging).

* Scripts/webkitpy/layout_tests/controllers/manager.py:
(RunDetails):
(RunDetails.__init__):
(Manager.run):
* Scripts/webkitpy/layout_tests/run_webkit_tests.py:
(run):
(main):
* Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
(passing_run):
(run_and_capture):
(LintTest.test_lint_test_files):
(LintTest.test_lint_test_files__errors):
(MainTest.test_verbose_in_child_processes):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (136768 => 136769)


--- trunk/Tools/ChangeLog	2012-12-05 23:25:07 UTC (rev 136768)
+++ trunk/Tools/ChangeLog	2012-12-05 23:26:24 UTC (rev 136769)
@@ -1,5 +1,35 @@
 2012-12-05  Dirk Pranke  <dpra...@chromium.org>
 
+        nrwt: collect all of the information about a run into a new RunDetails class
+        https://bugs.webkit.org/show_bug.cgi?id=104158
+
+        Reviewed by Ojan Vafai.
+
+        This patch collects the information from both test passes (the
+        main one and the retries) as well as the summarized results and
+        the exit code into a RunDetails class, so that the integration
+        tests can more easily tell what happened.
+
+        Also, change the way the --lint-test-files works slightly so that
+        we don't need to create a printer object (and hence we need to
+        rework the tests that are testing logging).
+
+        * Scripts/webkitpy/layout_tests/controllers/manager.py:
+        (RunDetails):
+        (RunDetails.__init__):
+        (Manager.run):
+        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
+        (run):
+        (main):
+        * Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
+        (passing_run):
+        (run_and_capture):
+        (LintTest.test_lint_test_files):
+        (LintTest.test_lint_test_files__errors):
+        (MainTest.test_verbose_in_child_processes):
+
+2012-12-05  Dirk Pranke  <dpra...@chromium.org>
+
         nrwt: remove --no-record-results
         https://bugs.webkit.org/show_bug.cgi?id=104072
 

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())
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to