Changeset 89843 in webkit


Ignore:
Timestamp:
Jun 27, 2011 11:47:44 AM (13 years ago)
Author:
abarth@webkit.org
Message:

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

Reviewed by Eric Seidel.

webkitpy should understand crash logs
https://bugs.webkit.org/show_bug.cgi?id=63468

We're planning to use this functionality to upload crash logs along
with test results for new-run-webkit-tests.

  • Scripts/webkitpy/common/system/crashlog.py: Added.
  • Scripts/webkitpy/common/system/crashlog_unittest.py: Added.
  • Scripts/webkitpy/common/system/executive.py:
  • Scripts/webkitpy/common/system/executive_unittest.py:
  • Scripts/webkitpy/common/system/filesystem.py:
  • Scripts/webkitpy/common/system/filesystem_mock.py:
  • Scripts/webkitpy/tool/commands/queries.py:
Location:
trunk/Tools
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r89841 r89843  
     12011-06-27  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        webkitpy should understand crash logs
     6        https://bugs.webkit.org/show_bug.cgi?id=63468
     7
     8        We're planning to use this functionality to upload crash logs along
     9        with test results for new-run-webkit-tests.
     10
     11        * Scripts/webkitpy/common/system/crashlog.py: Added.
     12        * Scripts/webkitpy/common/system/crashlog_unittest.py: Added.
     13        * Scripts/webkitpy/common/system/executive.py:
     14        * Scripts/webkitpy/common/system/executive_unittest.py:
     15        * Scripts/webkitpy/common/system/filesystem.py:
     16        * Scripts/webkitpy/common/system/filesystem_mock.py:
     17        * Scripts/webkitpy/tool/commands/queries.py:
     18
    1192011-06-27  Adam Roben  <aroben@apple.com>
    220
  • trunk/Tools/Scripts/webkitpy/common/system/executive.py

    r89412 r89843  
    290290        assert(False)
    291291
     292    def running_pids(self, process_name_filter=None):
     293        if not process_name_filter:
     294            process_name_filter = lambda process_name: True
     295
     296        running_pids = []
     297
     298        if sys.platform in ("win32", "cygwin"):
     299            raise NotImplemented()
     300
     301        ps_process = self.popen(['ps', '-eo', 'pid,comm'], stdout=self.PIPE, stderr=self.PIPE)
     302        stdout, _ = ps_process.communicate()
     303        for line in stdout.splitlines():
     304            try:
     305                pid, process_name = line.split(' ', 1)
     306                if process_name_filter(process_name):
     307                    running_pids.append(int(pid))
     308            except ValueError, e:
     309                pass
     310
     311        return sorted(running_pids)
     312
     313    def wait_newest(self, process_name_filter=None):
     314        if not process_name_filter:
     315            process_name_filter = lambda process_name: True
     316
     317        running_pids = self.running_pids(process_name_filter)
     318        if not running_pids:
     319            return
     320        pid = running_pids[-1]
     321
     322        while self.check_running_pid(pid):
     323            time.sleep(0.25)
     324
    292325    def _windows_image_name(self, process_name):
    293326        name, extension = os.path.splitext(process_name)
  • trunk/Tools/Scripts/webkitpy/common/system/executive_unittest.py

    r83015 r89843  
    200200        # Maximum pid number on Linux is 32768 by default
    201201        self.assertFalse(executive.check_running_pid(100000))
     202
     203    def test_running_pids(self):
     204        if sys.platform in ("win32", "cygwin"):
     205            return  # This function isn't implemented on Windows yet.
     206
     207        executive = Executive()
     208        pids = executive.running_pids()
     209        self.assertTrue(os.getpid() in pids)
  • trunk/Tools/Scripts/webkitpy/common/system/filesystem.py

    r89206 r89843  
    5858        return os.path.abspath(path)
    5959
     60    def expanduser(self, path):
     61        return os.path.expanduser(path)
     62
    6063    def basename(self, path):
    61         """Wraps os.path.basename()."""
    6264        return os.path.basename(path)
    6365
    6466    def chdir(self, path):
    65         """Wraps os.chdir()."""
    6667        return os.chdir(path)
    6768
  • trunk/Tools/Scripts/webkitpy/common/system/filesystem_mock.py

    r89206 r89843  
    7171        return self._split(path)[1]
    7272
     73    def expanduser(self, path):
     74        if path[0] != "~":
     75            return path
     76        parts = path.split(self.sep, 1)
     77        home_directory = self.sep + "Users" + self.sep + "mock"
     78        if len(parts) == 1:
     79            return home_directory
     80        return home_directory + self.sep + parts[1]
     81
    7382    def chdir(self, path):
    7483        path = self.normpath(path)
  • trunk/Tools/Scripts/webkitpy/tool/commands/queries.py

    r77913 r89843  
    3737from webkitpy.common.net.buildbot import BuildBot
    3838from webkitpy.common.net.regressionwindow import RegressionWindow
     39from webkitpy.common.system.crashlogs import CrashLogs
    3940from webkitpy.common.system.user import User
    4041from webkitpy.tool.grammar import pluralize
     
    4243from webkitpy.common.system.deprecated_logging import log
    4344from webkitpy.layout_tests import port
    44 
    4545
    4646class SuggestReviewers(AbstractDeclarativeCommand):
     
    369369
    370370
     371class CrashLog(AbstractDeclarativeCommand):
     372    name = "crash-log"
     373    argument_names = "PROCESS_NAME"
     374
     375    def execute(self, options, args, tool):
     376        crash_logs = CrashLogs(tool.executive, tool.filesystem)
     377        print crash_logs.find_newest_log(args[0])
     378
     379
    371380class SkippedPorts(AbstractDeclarativeCommand):
    372381    name = "skipped-ports"
Note: See TracChangeset for help on using the changeset viewer.