Changeset 136769 in webkit


Ignore:
Timestamp:
Dec 5, 2012, 3:26:24 PM (12 years ago)
Author:
dpranke@chromium.org
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_fileserrors):
(MainTest.test_verbose_in_child_processes):

Location:
trunk/Tools
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r136768 r136769  
     12012-12-05  Dirk Pranke  <dpranke@chromium.org>
     2
     3        nrwt: collect all of the information about a run into a new RunDetails class
     4        https://bugs.webkit.org/show_bug.cgi?id=104158
     5
     6        Reviewed by Ojan Vafai.
     7
     8        This patch collects the information from both test passes (the
     9        main one and the retries) as well as the summarized results and
     10        the exit code into a RunDetails class, so that the integration
     11        tests can more easily tell what happened.
     12
     13        Also, change the way the --lint-test-files works slightly so that
     14        we don't need to create a printer object (and hence we need to
     15        rework the tests that are testing logging).
     16
     17        * Scripts/webkitpy/layout_tests/controllers/manager.py:
     18        (RunDetails):
     19        (RunDetails.__init__):
     20        (Manager.run):
     21        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
     22        (run):
     23        (main):
     24        * Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
     25        (passing_run):
     26        (run_and_capture):
     27        (LintTest.test_lint_test_files):
     28        (LintTest.test_lint_test_files__errors):
     29        (MainTest.test_verbose_in_child_processes):
     30
    1312012-12-05  Dirk Pranke  <dpranke@chromium.org>
    232
  • trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py

    r136768 r136769  
    5757
    5858
     59class RunDetails(object):
     60    def __init__(self, exit_code, summarized_results=None, result_summary=None, retry_summary=None):
     61        self.exit_code = exit_code
     62        self.summarized_results = summarized_results
     63        self.result_summary = result_summary
     64        self.retry_summary = retry_summary
     65
     66
    5967def interpret_test_failures(failures):
    6068    test_dict = {}
     
    332340
    333341    def run(self, args):
    334         """Run all our tests on all our test files and return the number of unexpected results (0 == success)."""
     342        """Run the tests and return a RunDetails object with the results."""
    335343        self._printer.write_update("Collecting tests ...")
    336344        try:
     
    338346        except IOError:
    339347            # This is raised if --test-list doesn't exist
    340             return -1
     348            return RunDetails(exit_code=-1)
    341349
    342350        self._printer.write_update("Parsing expectations ...")
     
    349357        if not tests_to_run:
    350358            _log.critical('No tests to run.')
    351             return -1
     359            return RunDetails(exit_code=-1)
    352360
    353361        if not self._set_up_run(tests_to_run):
    354             return -1
     362            return RunDetails(exit_code=-1)
    355363
    356364        start_time = time.time()
     
    392400                self._port.show_results_html_file(results_path)
    393401
    394         return self._port.exit_code_from_summarized_results(summarized_results)
     402        return RunDetails(self._port.exit_code_from_summarized_results(summarized_results),
     403                          summarized_results, result_summary, retry_summary)
    395404
    396405    def _run_tests(self, tests_to_run, tests_to_skip, repeat_each, iterations, num_workers, retrying):
  • trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py

    r136768 r136769  
    9292
    9393        _set_up_derived_options(port, options)
    94 
    95         if options.lint_test_files:
    96             return lint(port, options)
    97 
    9894        manager = Manager(port, options, printer)
    9995        printer.print_config(port.results_directory())
    10096
    101         unexpected_result_count = manager.run(args)
    102         _log.debug("Testing completed, Exit status: %d" % unexpected_result_count)
    103         return unexpected_result_count
     97        run_details = manager.run(args)
     98        _log.debug("Testing completed, Exit status: %d" % run_details.exit_code)
     99        return run_details
    104100    finally:
    105101        printer.cleanup()
     102
    106103
    107104def _set_up_derived_options(port, options):
     
    420417    logging.getLogger().setLevel(logging.DEBUG if options.debug_rwt_logging else logging.INFO)
    421418    try:
    422         return run(port, options, args)
     419        if options.lint_test_files:
     420            return lint(port, options)
     421        return run(port, options, args).exit_code
    423422    except Exception, e:
    424423        print >> sys.stderr, '\n%s raised: %s' % (e.__class__.__name__, str(e))
  • trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py

    r136768 r136769  
    8989    buildbot_output = StringIO.StringIO()
    9090    regular_output = StringIO.StringIO()
    91     res = run_webkit_tests.run(port_obj, options, parsed_args, buildbot_output=buildbot_output, regular_output=regular_output)
    92     return res == 0
     91    run_details = run_webkit_tests.run(port_obj, options, parsed_args, buildbot_output=buildbot_output, regular_output=regular_output)
     92    return run_details.exit_code == 0
    9393
    9494
     
    113113        buildbot_output = StringIO.StringIO()
    114114        regular_output = StringIO.StringIO()
    115         res = run_webkit_tests.run(port_obj, options, parsed_args,
    116                                    buildbot_output=buildbot_output,
    117                                    regular_output=regular_output)
     115        run_details = run_webkit_tests.run(port_obj, options, parsed_args,
     116                                           buildbot_output=buildbot_output,
     117                                           regular_output=regular_output)
    118118    finally:
    119119        oc.restore_output()
    120     return (res, buildbot_output, regular_output)
     120    return (run_details.exit_code, buildbot_output, regular_output)
    121121
    122122
     
    246246
    247247    def test_lint_test_files(self):
    248         res, out, err, user = logging_run(['--lint-test-files'])
     248        oc = outputcapture.OutputCapture()
     249        oc.capture_output()
     250        try:
     251            res = run_webkit_tests.main(['--platform', 'test', '--lint-test-files'])
     252        finally:
     253            out, err, logs = oc.restore_output()
     254
    249255        self.assertEqual(res, 0)
    250         self.assertEmpty(out)
    251         self.assertContains(err, 'Lint succeeded')
     256        self.assertEqual(out, '')
     257        self.assertEqual(err, '')
     258        self.assertTrue('Lint succeeded' in logs)
    252259
    253260    def test_lint_test_files__errors(self):
    254         options, parsed_args = parse_args(['--lint-test-files'])
     261        options, parsed_args = parse_args(['--platform', 'test', '--lint-test-files'])
    255262        host = MockHost()
    256263        port_obj = host.port_factory.get(options.platform, options=options)
    257264        port_obj.expectations_dict = lambda: {'': '-- syntax error'}
    258         res, out, err = run_and_capture(port_obj, options, parsed_args)
     265
     266        oc = outputcapture.OutputCapture()
     267        oc.capture_output()
     268        try:
     269            res = run_webkit_tests.lint(port_obj, options)
     270        finally:
     271            out, err, logs = oc.restore_output()
    259272
    260273        self.assertEqual(res, -1)
    261         self.assertEmpty(out)
    262         self.assertTrue(any(['Lint failed' in msg for msg in err.buflist]))
     274        self.assertEqual(out, '')
     275        self.assertEqual(err, '')
     276        self.assertTrue('Lint failed' in logs)
    263277
    264278        # ensure we lint *all* of the files in the cascade.
    265279        port_obj.expectations_dict = lambda: {'foo': '-- syntax error1', 'bar': '-- syntax error2'}
    266         res, out, err = run_and_capture(port_obj, options, parsed_args)
     280        oc.capture_output()
     281        try:
     282            res = run_webkit_tests.lint(port_obj, options)
     283        finally:
     284            out, err, logs = oc.restore_output()
    267285
    268286        self.assertEqual(res, -1)
    269         self.assertEmpty(out)
    270         self.assertTrue(any(['foo:1' in msg for msg in err.buflist]))
    271         self.assertTrue(any(['bar:1' in msg for msg in err.buflist]))
     287        self.assertEqual(out, '')
     288        self.assertEqual(err, '')
     289        self.assertTrue('foo:1' in logs)
     290        self.assertTrue('bar:1' in logs)
    272291
    273292
     
    945964        buildbot_output = StringIO.StringIO()
    946965        regular_output = StringIO.StringIO()
    947         res = run_webkit_tests.run(port_obj, options, parsed_args, buildbot_output=buildbot_output, regular_output=regular_output)
     966        run_webkit_tests.run(port_obj, options, parsed_args, buildbot_output=buildbot_output, regular_output=regular_output)
    948967        self.assertTrue('text.html passed' in regular_output.getvalue())
    949968        self.assertTrue('image.html passed' in regular_output.getvalue())
Note: See TracChangeset for help on using the changeset viewer.