VirtualBox

Changeset 65321 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jan 16, 2017 12:51:03 PM (8 years ago)
Author:
vboxsync
Message:

ValidationKit: Try to gather some basic process information for failed tests. Currently the stack and memory mappings are gathered on Linux, Darwin and Solaris. Windows is not supported (yet)

Location:
trunk/src/VBox/ValidationKit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/common/utils.py

    r65312 r65321  
    749749    return fRc;
    750750
     751def processGetInfo(uPid):
     752    """
     753    Tries to acquire state information of the given process.
     754
     755    Returns a string with the information on success or None on failure or
     756    if the host is not supported.
     757
     758    Note that the format of the information is host system dependent and will
     759    likely differ much between different hosts.
     760    """
     761    fRc = processExists(uPid);
     762    if fRc is not True:
     763        return None;
     764
     765    if sys.platform in ('linux2', ):
     766        sGdb = '/usr/bin/gdb';
     767        if not os.path.isfile(sGdb): sGdb = '/usr/local/bin/gdb';
     768        if not os.path.isfile(sGdb): sGdb = 'gdb';
     769        aasCmd = [
     770                     [sGdb, '-batch', '-ex', 'thread apply all bt',
     771                                      '-ex', 'info proc mapping',
     772                                      '-ex', 'info sharedlibrary',
     773                                      '-p', '%u' % (uPid,)]
     774                 ];
     775    elif sys.platform in ('darwin', ):
     776        # LLDB doesn't work in batch mode when attaching to a process, at least
     777        # with macOS Sierra (10.12). GDB might not be installed. Use the sample tool
     778        # instead with a 1 second duration and 1000ms sampling interval to get one stack trace.
     779        # For the process mappings use vmmap.
     780        aasCmd = [ \
     781                     ['/usr/bin/sample', '-mayDie', '%u' % (uPid,), '1', '1000'],
     782                     ['/usr/bin/vmmap', '%u' % (uPid,)]
     783                 ];
     784    elif sys.platform in ('sunos5',):
     785        aasCmd = [ \
     786                     ['/usr/bin/pstack', '%u' % (uPid,)],
     787                     ['/usr/bin/pmap', '%u' % (uPid,)]
     788                 ];
     789    else:
     790        aasCmd = None;
     791
     792    sInfo = '';
     793    if aasCmd is not None:
     794        for asCmd in aasCmd:
     795            try:
     796                sThisInfo = sudoProcessOutputChecked(asCmd);
     797                if sThisInfo is not None:
     798                    sInfo += sThisInfo;
     799            except:
     800                pass;
     801    if not sInfo:
     802        sInfo = None;
     803
     804    return sInfo;
     805
    751806
    752807class ProcessInfo(object):
  • trunk/src/VBox/ValidationKit/testdriver/vbox.py

    r65310 r65321  
    25802580        sVgaText            = None;
    25812581        asMiscInfos         = [];
     2582        sHostProcessInfo    = None;
     2583
     2584        # Try to fetch the VM process info before meddling with its state.
     2585        if self.fAlwaysUploadLogs or reporter.testErrorCount() > 0:
     2586            sHostProcessInfo = utils.processGetInfo(oSession.getPid());
     2587
    25822588        if not oSession.fHostMemoryLow:
    25832589            #
     
    27342740            reporter.addLogString(u''.join(asMiscInfos), 'info.txt', 'info/collection', 'A bunch of info items.');
    27352741
     2742        # Add the host process info if we were able to retrieve it.
     2743        if sHostProcessInfo is not None:
     2744            reporter.addLogString(sHostProcessInfo, 'vmprocess.log', 'log/host/vmprocess', 'VM process state');
    27362745
    27372746        return fRc;
  • trunk/src/VBox/ValidationKit/testmanager/core/testboxcontroller.py

    r62484 r65321  
    713713                          'log/uninstaller',
    714714                          'log/guest/kernel',
     715                          'log/host/vmprocess',
    715716                          'crash/report/vm',
    716717                          'crash/dump/vm',
  • trunk/src/VBox/ValidationKit/testmanager/core/testresults.py

    r65319 r65321  
    401401    ksKind_LogUninstaller       = 'log/uninstaller';
    402402    ksKind_LogGuestKernel       = 'log/guest/kernel';
     403    ksKind_LogHostVmProcess     = 'log/host/vmprocess';
    403404    ksKind_CrashReportVm        = 'crash/report/vm';
    404405    ksKind_CrashDumpVm          = 'crash/dump/vm';
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette