Changeset 124240 in webkit


Ignore:
Timestamp:
Jul 31, 2012, 12:42:55 PM (13 years ago)
Author:
dpranke@chromium.org
Message:

nrwt: clean up prepare_lists_and_print_output, run, set_up_run a bit
https://bugs.webkit.org/show_bug.cgi?id=92781

Reviewed by Ryosuke Niwa.

More refactoring ... rename prepare_lists_and_print_output to
just prepare_lists so that it only has a single purpose, and
clean up the surrounding code a bit as well.

  • Scripts/webkitpy/layout_tests/controllers/manager.py:

(Manager._collect_tests):
(Manager._prepare_lists):
(Manager._set_up_run):
(Manager.run):

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r124236 r124240  
     12012-07-31  Dirk Pranke  <dpranke@chromium.org>
     2
     3        nrwt: clean up prepare_lists_and_print_output, run, set_up_run a bit
     4        https://bugs.webkit.org/show_bug.cgi?id=92781
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        More refactoring ... rename prepare_lists_and_print_output to
     9        just prepare_lists so that it only has a single purpose, and
     10        clean up the surrounding code a bit as well.
     11
     12        * Scripts/webkitpy/layout_tests/controllers/manager.py:
     13        (Manager._collect_tests):
     14        (Manager._prepare_lists):
     15        (Manager._set_up_run):
     16        (Manager.run):
     17
    1182012-07-31  Dirk Pranke  <dpranke@chromium.org>
    219
  • trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py

    r124236 r124240  
    331331
    332332    def _collect_tests(self, args):
    333         self._paths, self._test_names = self._finder.find_tests(self._options, args)
     333        return self._finder.find_tests(self._options, args)
    334334
    335335    def _is_http_test(self, test):
     
    345345        return self.PERF_SUBDIR == test or (self.PERF_SUBDIR + self._port.TEST_PATH_SEPARATOR) in test
    346346
    347     # FIXME: This method is way too long and needs to be broken into pieces.
    348     def prepare_lists_and_print_output(self):
    349         """Create appropriate subsets of test lists and returns a
    350         ResultSummary object. Also prints expected test counts.
    351         """
    352         num_all_test_files = len(self._test_names)
    353 
     347    def _prepare_lists(self):
    354348        tests_to_skip = self._finder.skip_tests(self._paths, self._test_names, self._expectations, self._http_tests())
    355         if not self._test_names:
    356             _log.critical('No tests to run.')
    357             return None
     349        self._test_names = list(set(self._test_names) - tests_to_skip)
    358350
    359351        # Create a sorted list of test files so the subset chunk,
    360352        # if used, contains alphabetically consecutive tests.
    361         self._test_names = list(set(self._test_names) - tests_to_skip)
    362353        if self._options.randomize_order:
    363354            random.shuffle(self._test_names)
     
    379370
    380371        iterations = self._options.repeat_each * self._options.iterations
    381         result_summary = ResultSummary(self._expectations, set(self._test_names), iterations, tests_to_skip)
    382 
    383         self._printer.print_found(num_all_test_files, len(self._test_names), self._options.repeat_each, self._options.iterations)
    384         self._printer.print_expected(result_summary, self._expectations.get_tests_with_result_type)
    385 
    386         return result_summary
     372        return ResultSummary(self._expectations, set(self._test_names), iterations, tests_to_skip)
    387373
    388374    def _get_dir_for_test_file(self, test_file):
     
    664650
    665651    def _set_up_run(self):
    666         """Configures the system to be ready to run tests.
    667 
    668         Returns a ResultSummary object if we should continue to run tests,
    669         or None if we should abort.
    670 
    671         """
     652        self._printer.write_update("Checking build ...")
     653        if not self._port.check_build(self.needs_servers()):
     654            _log.error("Build check failed")
     655            return False
     656
    672657        # This must be started before we check the system dependencies,
    673658        # since the helper may do things to make the setup correct.
     
    681666            if not self._port.check_sys_deps(self.needs_servers()):
    682667                self._port.stop_helper()
    683                 return None
     668                return False
    684669
    685670        if self._options.clobber_old_results:
     
    690675
    691676        self._port.setup_test_run()
    692 
    693         self._printer.write_update("Preparing tests ...")
    694         result_summary = self.prepare_lists_and_print_output()
    695         if not result_summary:
    696             return None
    697 
    698         return result_summary
     677        return True
    699678
    700679    def run(self, args):
     
    702681        self._printer.write_update("Collecting tests ...")
    703682        try:
    704             self._collect_tests(args)
    705         except IOError as e:
    706             # This is raised when the --test-list doesn't exist.
    707             return -1
    708 
    709         self._printer.write_update("Checking build ...")
    710         if not self._port.check_build(self.needs_servers()):
    711             _log.error("Build check failed")
     683            self._paths, self._test_names = self._collect_tests(args)
     684        except IOError as exception:
     685            # This is raised if --test-list doesn't exist
    712686            return -1
    713687
     
    715689        self._expectations = test_expectations.TestExpectations(self._port, self._test_names)
    716690
    717         result_summary = self._set_up_run()
    718         if not result_summary:
     691        num_all_test_files_found = len(self._test_names)
     692        result_summary = self._prepare_lists()
     693
     694        # Check to make sure we're not skipping every test.
     695        if not self._test_names:
     696            _log.critical('No tests to run.')
    719697            return -1
    720698
    721         assert(self._test_names)
     699        self._printer.print_found(num_all_test_files_found, len(self._test_names), self._options.repeat_each, self._options.iterations)
     700        self._printer.print_expected(result_summary, self._expectations.get_tests_with_result_type)
     701
     702        if not self._set_up_run():
     703            return -1
    722704
    723705        start_time = time.time()
Note: See TracChangeset for help on using the changeset viewer.