Changeset 90184 in webkit


Ignore:
Timestamp:
Jun 30, 2011 4:40:32 PM (13 years ago)
Author:
abarth@webkit.org
Message:

2011-06-30 Adam Barth <abarth@webkit.org>

Reviewed by Darin Adler.

Clean up output from new-run-webkit-tests
https://bugs.webkit.org/show_bug.cgi?id=63759

Printing messages from the child process looks super ugly because of
the way the pretty-printer works. Printing a blank line first is a
hack, but it makes things at least partially sane.

Also, handle the case where calling sample throws an exception.

  • Scripts/webkitpy/layout_tests/port/server_process.py:
  • Scripts/webkitpy/layout_tests/port/server_process_unittest.py:
Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r90178 r90184  
     12011-06-30  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Clean up output from new-run-webkit-tests
     6        https://bugs.webkit.org/show_bug.cgi?id=63759
     7
     8        Printing messages from the child process looks super ugly because of
     9        the way the pretty-printer works.  Printing a blank line first is a
     10        hack, but it makes things at least partially sane.
     11
     12        Also, handle the case where calling sample throws an exception.
     13
     14        * Scripts/webkitpy/layout_tests/port/server_process.py:
     15        * Scripts/webkitpy/layout_tests/port/server_process_unittest.py:
     16
    1172011-06-27  Diego Gonzalez  <diegohcg@webkit.org>
    218
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/server_process.py

    r90074 r90184  
    4040    import fcntl
    4141
    42 from webkitpy.common.system.executive import Executive
     42from webkitpy.common.system.executive import Executive, ScriptError
    4343
    4444_log = logging.getLogger(__file__)
     
    167167            self.handle_interrupt()
    168168
     169    def _log(self, message):
     170        # This is a bit of a hack, but we first log a blank line to avoid
     171        # messing up the master process's output.
     172        _log.info('')
     173        _log.info(message)
     174
    169175    def _sample(self):
    170176        if sys.platform != "darwin":
    171177            return
    172         _log.warning('Sampling process... (use --no-sample-on-timeout to skip this step)')
    173         hang_report = os.path.join(self._port.results_directory(), "%s-%s.sample.txt" % (self._name, self._proc.pid))
    174         self._executive.run_command([
    175             "/usr/bin/sample",
    176             self._proc.pid,
    177             10,
    178             10,
    179             "-file",
    180             hang_report,
    181         ])
     178        try:
     179            self._log('Sampling %s process... (use --no-sample-on-timeout to skip this step)' % self._name)
     180            hang_report = os.path.join(self._port.results_directory(), "%s-%s.sample.txt" % (self._name, self._proc.pid))
     181            self._executive.run_command([
     182                "/usr/bin/sample",
     183                self._proc.pid,
     184                10,
     185                10,
     186                "-file",
     187                hang_report,
     188            ])
     189        except ScriptError, e:
     190            self._log('Unable to sample process.')
    182191
    183192    def _read(self, timeout, size):
     
    194203            if now > deadline:
    195204                if self._executive.running_pids(self._port.is_crash_reporter):
    196                     _log.warning('Waiting for crash reporter...')
     205                    self._log('Waiting for crash reporter...')
    197206                    self._executive.wait_newest(self._port.is_crash_reporter)
    198207                    if not self.crashed:
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/server_process_unittest.py

    r90074 r90184  
    3131
    3232from webkitpy.layout_tests.port import server_process
     33from webkitpy.common.system.executive import ScriptError
    3334from webkitpy.common.system.executive_mock import MockExecutive2
    3435from webkitpy.common.system.outputcapture import OutputCapture
     
    3738def _logging_run_command(args):
    3839    print args
     40
     41
     42def _throwing_run_command(args):
     43    raise ScriptError("MOCK script error")
    3944
    4045
     
    9398        expected_stdout = "['/usr/bin/sample', 1, 10, 10, '-file', '/mock/results/test-1.sample.txt']\n"
    9499        OutputCapture().assert_outputs(self, server_process._sample, expected_stdout=expected_stdout)
     100
     101    def test_sample_process_throws_exception(self):
     102        # Currently, sample-on-timeout only works on Darwin.
     103        if sys.platform != "darwin":
     104            return
     105        server_process = FakeServerProcess(port_obj=TrivialMockPort(), name="test", cmd=["test"], executive=MockExecutive2(run_command_fn=_throwing_run_command))
     106        server_process._proc = MockProc(server_process)
     107        OutputCapture().assert_outputs(self, server_process._sample)
Note: See TracChangeset for help on using the changeset viewer.