Title: [124236] trunk/Tools
Revision
124236
Author
[email protected]
Date
2012-07-31 12:11:09 -0700 (Tue, 31 Jul 2012)

Log Message

nrwt: clean up self._test_files_list vs. self._test_files, other nits
https://bugs.webkit.org/show_bug.cgi?id=92702

Reviewed by Ojan Vafai.

Get rid of self._test_files, rename self._test_files_list to
self._test_names (removing the confusion between the two fields).

Also inline the one call to _parse_expectations, remove the one
use of more_tests_to_skip, and fix a couple of minor nits.

* Scripts/webkitpy/layout_tests/controllers/finder.py:
(LayoutTestFinder.split_into_chunks):
* Scripts/webkitpy/layout_tests/controllers/manager.py:
(Manager.__init__):
(Manager._collect_tests):
(Manager._http_tests):
(Manager._websocket_tests):
(Manager._is_perf_test):
(Manager.prepare_lists_and_print_output):
(Manager.needs_servers):
(Manager.run):
(Manager._mark_interrupted_tests_as_skipped):
(Manager._update_summary_with_result):
(Manager._upload_json_files):
* Scripts/webkitpy/layout_tests/controllers/manager_unittest.py:
(ManagerTest.test_interrupt_if_at_failure_limits):
(ManagerTest.test_needs_servers.get_manager_with_tests):
(ManagerTest.test_servers_started):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (124235 => 124236)


--- trunk/Tools/ChangeLog	2012-07-31 19:09:51 UTC (rev 124235)
+++ trunk/Tools/ChangeLog	2012-07-31 19:11:09 UTC (rev 124236)
@@ -1,5 +1,37 @@
 2012-07-31  Dirk Pranke  <[email protected]>
 
+        nrwt: clean up self._test_files_list vs. self._test_files, other nits
+        https://bugs.webkit.org/show_bug.cgi?id=92702
+
+        Reviewed by Ojan Vafai.
+
+        Get rid of self._test_files, rename self._test_files_list to
+        self._test_names (removing the confusion between the two fields).
+
+        Also inline the one call to _parse_expectations, remove the one
+        use of more_tests_to_skip, and fix a couple of minor nits.
+
+        * Scripts/webkitpy/layout_tests/controllers/finder.py:
+        (LayoutTestFinder.split_into_chunks):
+        * Scripts/webkitpy/layout_tests/controllers/manager.py:
+        (Manager.__init__):
+        (Manager._collect_tests):
+        (Manager._http_tests):
+        (Manager._websocket_tests):
+        (Manager._is_perf_test):
+        (Manager.prepare_lists_and_print_output):
+        (Manager.needs_servers):
+        (Manager.run):
+        (Manager._mark_interrupted_tests_as_skipped):
+        (Manager._update_summary_with_result):
+        (Manager._upload_json_files):
+        * Scripts/webkitpy/layout_tests/controllers/manager_unittest.py:
+        (ManagerTest.test_interrupt_if_at_failure_limits):
+        (ManagerTest.test_needs_servers.get_manager_with_tests):
+        (ManagerTest.test_servers_started):
+
+2012-07-31  Dirk Pranke  <[email protected]>
+
         nrwt: --verbose logging does not work right on windows
         https://bugs.webkit.org/show_bug.cgi?id=92673
 

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/finder.py (124235 => 124236)


--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/finder.py	2012-07-31 19:09:51 UTC (rev 124235)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/finder.py	2012-07-31 19:11:09 UTC (rev 124236)
@@ -120,9 +120,10 @@
 
         return tests_to_skip
 
-    def split_into_chunks_if_necessary(self, test_files_list):
+    def split_into_chunks(self, test_names):
+        """split into a list to run and a set to skip, based on --run-chunk and --run-part."""
         if not self._options.run_chunk and not self._options.run_part:
-            return test_files_list, set()
+            return test_names, set()
 
         # If the user specifies they just want to run a subset of the tests,
         # just grab a subset of the non-skipped tests.
@@ -135,10 +136,10 @@
             assert(test_size > 0)
         except AssertionError:
             _log.critical("invalid chunk '%s'" % chunk_value)
-            return None
+            return (None, None)
 
         # Get the number of tests
-        num_tests = len(test_files_list)
+        num_tests = len(test_names)
 
         # Get the start offset of the slice.
         if self._options.run_chunk:
@@ -165,7 +166,7 @@
         # Get the end offset of the slice.
         slice_end = min(num_tests, slice_start + chunk_len)
 
-        tests_to_run = test_files_list[slice_start:slice_end]
+        tests_to_run = test_names[slice_start:slice_end]
 
         _log.debug('chunk slice [%d:%d] of %d is %d tests' % (slice_start, slice_end, num_tests, (slice_end - slice_start)))
 
@@ -174,7 +175,6 @@
         if slice_end - slice_start < chunk_len:
             extra = chunk_len - (slice_end - slice_start)
             _log.debug('   last chunk is partial, appending [0:%d]' % extra)
-            tests_to_run.extend(test_files_list[0:extra])
+            tests_to_run.extend(test_names[0:extra])
 
-        more_tests_to_skip = set(test_files_list) - set(tests_to_run)
-        return (tests_to_run, more_tests_to_skip)
+        return (tests_to_run, set(test_names) - set(tests_to_run))

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


--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py	2012-07-31 19:09:51 UTC (rev 124235)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py	2012-07-31 19:11:09 UTC (rev 124236)
@@ -318,9 +318,7 @@
 
         self._paths = set()
 
-        # FIXME: Rename to test_names.
-        self._test_files = set()
-        self._test_files_list = None
+        self._test_names = None
         self._result_queue = Queue.Queue()
         self._retrying = False
         self._results_directory = self._port.results_directory()
@@ -332,63 +330,57 @@
         self._finder = LayoutTestFinder(self._port, self._options)
 
     def _collect_tests(self, args):
-        self._paths, self._test_files_list = self._finder.find_tests(self._options, args)
-        self._test_files = set(self._test_files_list)
+        self._paths, self._test_names = self._finder.find_tests(self._options, args)
 
     def _is_http_test(self, test):
         return self.HTTP_SUBDIR in test or self.WEBSOCKET_SUBDIR in test
 
     def _http_tests(self):
-        return set(test for test in self._test_files if self._is_http_test(test))
+        return set(test for test in self._test_names 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)
+        return set(test for test in self._test_names 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
 
-    def _parse_expectations(self):
-        self._expectations = test_expectations.TestExpectations(self._port, self._test_files)
-
     # FIXME: This method is way too long and needs to be broken into pieces.
     def prepare_lists_and_print_output(self):
         """Create appropriate subsets of test lists and returns a
         ResultSummary object. Also prints expected test counts.
         """
-        num_all_test_files = len(self._test_files_list)
+        num_all_test_files = len(self._test_names)
 
-        tests_to_skip = self._finder.skip_tests(self._paths, self._test_files_list, self._expectations, self._http_tests())
-        self._test_files = set(self._test_files_list) - tests_to_skip
-        if not self._test_files_list:
+        tests_to_skip = self._finder.skip_tests(self._paths, self._test_names, self._expectations, self._http_tests())
+        if not self._test_names:
             _log.critical('No tests to run.')
             return None
 
         # Create a sorted list of test files so the subset chunk,
         # if used, contains alphabetically consecutive tests.
-        self._test_files_list = list(self._test_files)
+        self._test_names = list(set(self._test_names) - tests_to_skip)
         if self._options.randomize_order:
-            random.shuffle(self._test_files_list)
+            random.shuffle(self._test_names)
         else:
-            self._test_files_list.sort(key=lambda test: test_key(self._port, test))
+            self._test_names.sort(key=lambda test: test_key(self._port, test))
 
-        self._test_files_list, tests_in_other_chunks = self._finder.split_into_chunks_if_necessary(self._test_files_list)
+        self._test_names, tests_in_other_chunks = self._finder.split_into_chunks(self._test_names)
         self._expectations.add_skipped_tests(tests_in_other_chunks)
         tests_to_skip.update(tests_in_other_chunks)
-        self._tests = set(self._test_files_list)
 
-        if self._options.repeat_each:
+        if self._options.repeat_each > 1:
             list_with_repetitions = []
-            for test in self._test_files_list:
+            for test in self._test_names:
                 list_with_repetitions += ([test] * self._options.repeat_each)
-            self._test_files_list = list_with_repetitions
+            self._test_names = list_with_repetitions
 
-        if self._options.iterations:
-            self._test_files_list = self._test_files_list * self._options.iterations
+        if self._options.iterations > 1:
+            self._test_names = self._test_names * self._options.iterations
 
         iterations = self._options.repeat_each * self._options.iterations
-        result_summary = ResultSummary(self._expectations, self._test_files, iterations, tests_to_skip)
+        result_summary = ResultSummary(self._expectations, set(self._test_names), iterations, tests_to_skip)
 
-        self._printer.print_found(num_all_test_files, len(self._test_files), self._options.repeat_each, self._options.iterations)
+        self._printer.print_found(num_all_test_files, len(self._test_names), self._options.repeat_each, self._options.iterations)
         self._printer.print_expected(result_summary, self._expectations.get_tests_with_result_type)
 
         return result_summary
@@ -668,7 +660,7 @@
             return self._filesystem.join(self._results_directory, 'retries')
 
     def needs_servers(self):
-        return any(self._test_requires_lock(test_name) for test_name in self._test_files) and self._options.http
+        return any(self._test_requires_lock(test_name) for test_name in self._test_names) and self._options.http
 
     def _set_up_run(self):
         """Configures the system to be ready to run tests.
@@ -720,17 +712,17 @@
             return -1
 
         self._printer.write_update("Parsing expectations ...")
-        self._parse_expectations()
+        self._expectations = test_expectations.TestExpectations(self._port, self._test_names)
 
         result_summary = self._set_up_run()
         if not result_summary:
             return -1
 
-        assert(len(self._test_files))
+        assert(self._test_names)
 
         start_time = time.time()
 
-        interrupted, keyboard_interrupted, thread_timings, test_timings, individual_test_timings = self._run_tests(self._test_files_list, result_summary, int(self._options.child_processes))
+        interrupted, keyboard_interrupted, thread_timings, test_timings, individual_test_timings = self._run_tests(self._test_names, result_summary, int(self._options.child_processes))
 
         # We exclude the crashes from the list of results to retry, because
         # we want to treat even a potentially flaky crash as an error.
@@ -836,7 +828,7 @@
                 writer.write_crash_log(crash_log)
 
     def _mark_interrupted_tests_as_skipped(self, result_summary):
-        for test_name in self._test_files:
+        for test_name in self._test_names:
             if test_name not in result_summary.results:
                 result = test_results.TestResult(test_name, [test_failures.FailureEarlyExit()])
                 # FIXME: We probably need to loop here if there are multiple iterations.
@@ -877,7 +869,7 @@
         result_summary.add(result, expected, self._test_is_slow(result.test_name))
 
         # FIXME: there's too many arguments to this function.
-        self._printer.print_finished_test(result, expected, exp_str, got_str, result_summary, self._retrying, self._test_files_list)
+        self._printer.print_finished_test(result, expected, exp_str, got_str, result_summary, self._retrying, self._test_names)
 
         self._interrupt_if_at_failure_limits(result_summary)
 
@@ -948,7 +940,7 @@
             self._port, self._options.builder_name, self._options.build_name,
             self._options.build_number, self._results_directory,
             BUILDER_BASE_URL, individual_test_timings,
-            self._expectations, result_summary, self._test_files_list,
+            self._expectations, result_summary, self._test_names,
             self._options.test_results_server,
             "layout-tests",
             self._options.master_name)

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


--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py	2012-07-31 19:09:51 UTC (rev 124235)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py	2012-07-31 19:11:09 UTC (rev 124236)
@@ -284,10 +284,10 @@
         manager = Manager(port=port, options=MockOptions(), printer=Mock())
 
         manager._options = MockOptions(exit_after_n_failures=None, exit_after_n_crashes_or_timeouts=None)
-        manager._test_files = ['foo/bar.html', 'baz.html']
+        manager._test_names = ['foo/bar.html', 'baz.html']
         manager._test_is_slow = lambda test_name: False
 
-        result_summary = ResultSummary(Mock(), manager._test_files, 1, set())
+        result_summary = ResultSummary(Mock(), manager._test_names, 1, set())
         result_summary.unexpected_failures = 100
         result_summary.unexpected_crashes = 50
         result_summary.unexpected_timeouts = 50
@@ -330,8 +330,7 @@
             port = Mock()  # FIXME: Use a tighter mock.
             port.TEST_PATH_SEPARATOR = '/'
             manager = Manager(port, options=MockOptions(http=True), printer=Mock())
-            manager._test_files = set(test_names)
-            manager._test_files_list = test_names
+            manager._test_names = test_names
             return manager
 
         manager = get_manager_with_tests(['fast/html'])
@@ -399,7 +398,7 @@
 
         self.http_started = self.http_stopped = self.websocket_started = self.websocket_stopped = False
         manager = Manager(port=port, options=MockOptions(http=True), printer=Mock())
-        manager._test_files = ['http/tests/pass.txt']
+        manager._test_names = ['http/tests/pass.txt']
         manager.start_servers_with_lock(number_of_servers=4)
         self.assertEquals(self.http_started, True)
         self.assertEquals(self.websocket_started, False)
@@ -409,7 +408,7 @@
 
         self.http_started = self.http_stopped = self.websocket_started = self.websocket_stopped = False
         manager = Manager(port=port, options=MockOptions(http=True), printer=Mock())
-        manager._test_files = ['websocket/pass.txt']
+        manager._test_names = ['websocket/pass.txt']
         manager.start_servers_with_lock(number_of_servers=4)
         self.assertEquals(self.http_started, True)
         self.assertEquals(self.websocket_started, True)
@@ -419,7 +418,7 @@
 
         self.http_started = self.http_stopped = self.websocket_started = self.websocket_stopped = False
         manager = Manager(port=port, options=MockOptions(http=True), printer=Mock())
-        manager._test_files = ['perf/foo/test.html']
+        manager._test_names = ['perf/foo/test.html']
         manager.start_servers_with_lock(number_of_servers=4)
         self.assertEquals(self.http_started, False)
         self.assertEquals(self.websocket_started, False)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to