Title: [136896] trunk/Tools
Revision
136896
Author
[email protected]
Date
2012-12-06 14:45:34 -0800 (Thu, 06 Dec 2012)

Log Message

new-run-webkit-tests --lint-test-files seems to be broken
https://bugs.webkit.org/show_bug.cgi?id=104296

Unreviewed, build fix.

My recent refactoring caused me to not initialize the printer
before calling lint(); this patch restructures the code to make
the lint routine self-contained and do all the work necessary.
This will also make it easier to move this code out into a standalone
file.

* Scripts/webkitpy/layout_tests/run_webkit_tests.py:
(lint):
(main):
* Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
(LintTest.test_all_configurations):
(LintTest.test_lint_test_files):
(LintTest.test_lint_test_files__errors):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (136895 => 136896)


--- trunk/Tools/ChangeLog	2012-12-06 22:36:12 UTC (rev 136895)
+++ trunk/Tools/ChangeLog	2012-12-06 22:45:34 UTC (rev 136896)
@@ -1,3 +1,24 @@
+2012-12-06  Dirk Pranke  <[email protected]>
+
+        new-run-webkit-tests --lint-test-files seems to be broken
+        https://bugs.webkit.org/show_bug.cgi?id=104296
+
+        Unreviewed, build fix.
+
+        My recent refactoring caused me to not initialize the printer
+        before calling lint(); this patch restructures the code to make
+        the lint routine self-contained and do all the work necessary.
+        This will also make it easier to move this code out into a standalone
+        file.
+
+        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
+        (lint):
+        (main):
+        * Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
+        (LintTest.test_all_configurations):
+        (LintTest.test_lint_test_files):
+        (LintTest.test_lint_test_files__errors):
+
 2012-12-05  Filip Pizlo  <[email protected]>
 
         DFG profiler should be helpful about gem installation

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py (136895 => 136896)


--- trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py	2012-12-06 22:36:12 UTC (rev 136895)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py	2012-12-06 22:45:34 UTC (rev 136896)
@@ -54,8 +54,11 @@
 EXCEPTIONAL_EXIT_STATUS = 254
 
 
-def lint(port, options):
+def lint(port, options, logging_stream):
     host = port.host
+    logging.getLogger().setLevel(logging.DEBUG if options.debug_rwt_logging else logging.INFO)
+    printer = printing.Printer(port, options, logging_stream, logger=logging.getLogger())
+
     if options.platform:
         ports_to_lint = [port]
     else:
@@ -82,8 +85,10 @@
 
     if lint_failed:
         _log.error('Lint failed.')
+        printer.cleanup()
         return -1
     _log.info('Lint succeeded.')
+    printer.cleanup()
     return 0
 
 
@@ -415,11 +420,10 @@
         print >> stderr, str(e)
         return EXCEPTIONAL_EXIT_STATUS
 
-    logging.getLogger().setLevel(logging.DEBUG if options.debug_rwt_logging else logging.INFO)
+    if options.lint_test_files:
+        return lint(port, options, stderr)
+
     try:
-        if options.lint_test_files:
-            return lint(port, options)
-
         run_details = run(port, options, args, stderr)
 
         bot_printer = buildbot_results.BuildBotPrinter(stdout, options.debug_rwt_logging)

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py (136895 => 136896)


--- trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py	2012-12-06 22:36:12 UTC (rev 136895)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py	2012-12-06 22:45:34 UTC (rev 136896)
@@ -225,57 +225,43 @@
                                                FakePort(host, 'b', 'path-to-b'),
                                                FakePort(host, 'b-win', 'path-to-b')))
 
-        self.assertEqual(run_webkit_tests.lint(host.port_factory.ports['a'], MockOptions(platform=None)), 0)
+        logging_stream = StringIO.StringIO()
+        self.assertEqual(run_webkit_tests.lint(host.port_factory.ports['a'], MockOptions(platform=None, debug_rwt_logging=False), logging_stream), 0)
         self.assertEqual(host.ports_parsed, ['a', 'b', 'b-win'])
 
         host.ports_parsed = []
-        self.assertEqual(run_webkit_tests.lint(host.port_factory.ports['a'], MockOptions(platform='a')), 0)
+        self.assertEqual(run_webkit_tests.lint(host.port_factory.ports['a'], MockOptions(platform='a', debug_rwt_logging=False), logging_stream), 0)
         self.assertEqual(host.ports_parsed, ['a'])
 
     def test_lint_test_files(self):
-        oc = outputcapture.OutputCapture()
-        oc.capture_output()
-        try:
-            res = run_webkit_tests.main(['--platform', 'test', '--lint-test-files'])
-        finally:
-            out, err, logs = oc.restore_output()
-
+        logging_stream = StringIO.StringIO()
+        options, _ = parse_args(['--platform', 'test', '--lint-test-files'])
+        host = MockHost()
+        port_obj = host.port_factory.get(options.platform, options=options)
+        res = run_webkit_tests.lint(port_obj, options, logging_stream)
         self.assertEqual(res, 0)
-        self.assertEqual(out, '')
-        self.assertEqual(err, '')
-        self.assertTrue('Lint succeeded' in logs)
+        self.assertTrue('Lint succeeded' in logging_stream.getvalue())
 
     def test_lint_test_files__errors(self):
-        options, parsed_args = parse_args(['--platform', 'test', '--lint-test-files'])
+        options, _ = 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'}
 
-        oc = outputcapture.OutputCapture()
-        oc.capture_output()
-        try:
-            res = run_webkit_tests.lint(port_obj, options)
-        finally:
-            out, err, logs = oc.restore_output()
+        logging_stream = StringIO.StringIO()
+        res = run_webkit_tests.lint(port_obj, options, logging_stream)
 
         self.assertEqual(res, -1)
-        self.assertEqual(out, '')
-        self.assertEqual(err, '')
-        self.assertTrue('Lint failed' in logs)
+        self.assertTrue('Lint failed' in logging_stream.getvalue())
 
         # ensure we lint *all* of the files in the cascade.
         port_obj.expectations_dict = lambda: {'foo': '-- syntax error1', 'bar': '-- syntax error2'}
-        oc.capture_output()
-        try:
-            res = run_webkit_tests.lint(port_obj, options)
-        finally:
-            out, err, logs = oc.restore_output()
+        logging_stream = StringIO.StringIO()
+        res = run_webkit_tests.lint(port_obj, options, logging_stream)
 
         self.assertEqual(res, -1)
-        self.assertEqual(out, '')
-        self.assertEqual(err, '')
-        self.assertTrue('foo:1' in logs)
-        self.assertTrue('bar:1' in logs)
+        self.assertTrue('foo:1' in logging_stream.getvalue())
+        self.assertTrue('bar:1' in logging_stream.getvalue())
 
 
 class MainTest(unittest.TestCase, StreamTestingMixin):
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to