Title: [123898] trunk/Tools
Revision
123898
Author
[email protected]
Date
2012-07-27 11:26:03 -0700 (Fri, 27 Jul 2012)

Log Message

nrwt: move collect_tests(), parse_expectations() into manager
https://bugs.webkit.org/show_bug.cgi?id=92423

Reviewed by Ojan Vafai.

This is the first in a series of patches refactoring
run_webkit_tests.py and manager.py to make them more
maintainable; all this patch does is move a couple of functions
into manager.run_tests() so manager's public interface is
simple.

* Scripts/webkitpy/layout_tests/controllers/manager.py:
(Manager._collect_tests):
(Manager._parse_expectations):
(Manager._split_into_chunks_if_necessary):
(Manager.run):
(read_test_files):
* Scripts/webkitpy/layout_tests/controllers/manager_unittest.py:
(ManagerTest.test_http_locking):
(ManagerTest.test_perf_locking):
(ManagerTest.integration_test_needs_servers.get_manager_with_tests):
(ManagerTest.test_look_for_new_crash_logs.get_manager_with_tests):
* Scripts/webkitpy/layout_tests/run_webkit_tests.py:
(run):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (123897 => 123898)


--- trunk/Tools/ChangeLog	2012-07-27 18:25:53 UTC (rev 123897)
+++ trunk/Tools/ChangeLog	2012-07-27 18:26:03 UTC (rev 123898)
@@ -1,5 +1,32 @@
 2012-07-27  Dirk Pranke  <[email protected]>
 
+        nrwt: move collect_tests(), parse_expectations() into manager
+        https://bugs.webkit.org/show_bug.cgi?id=92423
+
+        Reviewed by Ojan Vafai.
+
+        This is the first in a series of patches refactoring
+        run_webkit_tests.py and manager.py to make them more
+        maintainable; all this patch does is move a couple of functions
+        into manager.run_tests() so manager's public interface is
+        simple.
+
+        * Scripts/webkitpy/layout_tests/controllers/manager.py:
+        (Manager._collect_tests):
+        (Manager._parse_expectations):
+        (Manager._split_into_chunks_if_necessary):
+        (Manager.run):
+        (read_test_files):
+        * Scripts/webkitpy/layout_tests/controllers/manager_unittest.py:
+        (ManagerTest.test_http_locking):
+        (ManagerTest.test_perf_locking):
+        (ManagerTest.integration_test_needs_servers.get_manager_with_tests):
+        (ManagerTest.test_look_for_new_crash_logs.get_manager_with_tests):
+        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
+        (run):
+
+2012-07-27  Dirk Pranke  <[email protected]>
+
         nrwt: print filtered stderr after a crash correctly
         https://bugs.webkit.org/show_bug.cgi?id=92428
 

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py (123897 => 123898)


--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py	2012-07-27 18:25:53 UTC (rev 123897)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py	2012-07-27 18:26:03 UTC (rev 123898)
@@ -329,7 +329,7 @@
         self._worker_stats = {}
         self._current_result_summary = None
 
-    def collect_tests(self, args):
+    def _collect_tests(self, args):
         """Find all the files to test.
 
         Args:
@@ -366,7 +366,7 @@
     def _is_perf_test(self, test):
         return self.PERF_SUBDIR == test or (self.PERF_SUBDIR + self._port.TEST_PATH_SEPARATOR) in test
 
-    def parse_expectations(self):
+    def _parse_expectations(self):
         self._expectations = test_expectations.TestExpectations(self._port, self._test_files)
 
     def _split_into_chunks_if_necessary(self, skipped):
@@ -439,7 +439,7 @@
         self._test_files_list = files + skip_chunk_list
         self._test_files = set(self._test_files_list)
 
-        self.parse_expectations()
+        self._parse_expectations()
 
         self._test_files = set(files)
         self._test_files_list = files
@@ -833,22 +833,23 @@
 
         return result_summary
 
-    def run(self):
-        """Run all our tests on all our test files.
+    def run(self, args):
+        """Run all our tests on all our test files and return the number of unexpected results (0 == success)."""
+        self._printer.write_update("Collecting tests ...")
+        try:
+            self._collect_tests(args)
+        except IOError as e:
+            # This is raised when the --test-list doesn't exist.
+            return -1
 
-        For each test file, we run each test type. If there are any failures,
-        we collect them for reporting.
+        self._printer.write_update("Checking build ...")
+        if not self._port.check_build(self.needs_servers()):
+            _log.error("Build check failed")
+            return -1
 
-        Args:
-          result_summary: a summary object tracking the test results.
+        self._printer.write_update("Parsing expectations ...")
+        self._parse_expectations()
 
-        Return:
-          The number of unexpected results (0 == success)
-        """
-        # collect_tests() must have been called first to initialize us.
-        # If we didn't find any files to test, we've errored out already in
-        # prepare_lists_and_print_output().
-
         result_summary = self._set_up_run()
         if not result_summary:
             return -1
@@ -1169,7 +1170,7 @@
         except IOError, e:
             if e.errno == errno.ENOENT:
                 _log.critical('')
-                _log.critical('--test-list file "%s" not found' % file)
+                _log.critical('--test-list file "%s" not found' % filename)
             raise
     return tests
 

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py (123897 => 123898)


--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py	2012-07-27 18:25:53 UTC (rev 123897)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py	2012-07-27 18:26:03 UTC (rev 123898)
@@ -263,9 +263,7 @@
         run_webkit_tests._set_up_derived_options(port, options)
         printer = printing.Printer(port, options, StringIO.StringIO(), StringIO.StringIO())
         manager = LockCheckingManager(port, options, printer, tester, True)
-        manager.collect_tests(args)
-        manager.parse_expectations()
-        num_unexpected_results = manager.run()
+        num_unexpected_results = manager.run(args)
         printer.cleanup()
         tester.assertEquals(num_unexpected_results, 0)
 
@@ -276,9 +274,7 @@
         run_webkit_tests._set_up_derived_options(port, options)
         printer = printing.Printer(port, options, StringIO.StringIO(), StringIO.StringIO())
         manager = LockCheckingManager(port, options, printer, tester, False)
-        manager.collect_tests(args)
-        manager.parse_expectations()
-        num_unexpected_results = manager.run()
+        num_unexpected_results = manager.run(args)
         printer.cleanup()
         tester.assertEquals(num_unexpected_results, 0)
 
@@ -350,7 +346,7 @@
             host = MockHost()
             port = host.port_factory.get()
             manager = Manager(port, options=MockOptions(test_list=None, http=True), printer=Mock())
-            manager.collect_tests(test_names)
+            manager._collect_tests(test_names)
             return manager
 
         manager = get_manager_with_tests(['fast/html'])
@@ -371,7 +367,7 @@
             host = MockHost()
             port = host.port_factory.get('test-mac-leopard')
             manager = Manager(port, options=MockOptions(test_list=None, http=True), printer=Mock())
-            manager.collect_tests(test_names)
+            manager._collect_tests(test_names)
             return manager
         host = MockHost()
         port = host.port_factory.get('test-mac-leopard')

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py (123897 => 123898)


--- trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py	2012-07-27 18:25:53 UTC (rev 123897)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py	2012-07-27 18:26:03 UTC (rev 123898)
@@ -112,23 +112,7 @@
         manager = Manager(port, options, printer)
         printer.print_config()
 
-        printer.write_update("Collecting tests ...")
-        try:
-            manager.collect_tests(args)
-        except IOError, e:
-            if e.errno == errno.ENOENT:
-                return -1
-            raise
-
-        printer.write_update("Checking build ...")
-        if not port.check_build(manager.needs_servers()):
-            _log.error("Build check failed")
-            return -1
-
-        printer.write_update("Parsing expectations ...")
-        manager.parse_expectations()
-
-        unexpected_result_count = manager.run()
+        unexpected_result_count = manager.run(args)
         _log.debug("Testing completed, Exit status: %d" % unexpected_result_count)
     except Exception:
         exception_type, exception_value, exception_traceback = sys.exc_info()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to