VirtualBox

Ignore:
Timestamp:
Dec 22, 2021 1:28:06 PM (3 years ago)
Author:
vboxsync
Message:

Validation Kit/Guest Control: A bit more code for investigating failing guest session process tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py

    r93052 r93055  
    27682768        # For them we don't have any references anymore intentionally.
    27692769        #
    2770         reporter.log2('Starting stale processes...');
     2770        reporter.log('Starting stale processes...');
    27712771        fRc = True;
    27722772        for i in xrange(0, cStaleProcs):
    27732773            try:
     2774                reporter.log2('Starting stale process #%d...' % (i));
    27742775                oGuestSession.processCreate(sCmd,
    27752776                                            asArgs if self.oTstDrv.fpApiVer >= 5.0 else asArgs[1:], [],
     
    27862787        else:
    27872788            if cProcesses != cStaleProcs:
    2788                 fRc = reporter.error('Got %d stale processes, expected %d' % (cProcesses, cStaleProcs));
     2789                fRc = reporter.error('Got %d stale processes, expected %d (stale)' % (cProcesses, cStaleProcs));
    27892790
    27902791        if fRc is True:
     
    27962797            else:
    27972798                asArgs = [ sCmd, '-c', 'ls -la ' + self.oTstDrv.getGuestSystemDir(oTestVm), ];
    2798             reporter.log2('Starting non-stale processes...');
     2799            reporter.log('Starting non-stale processes...');
    27992800            aoProcesses = [];
    28002801            for i in xrange(0, cStaleProcs):
    28012802                try:
     2803                    reporter.log2('Starting non-stale process #%d...' % (i));
    28022804                    oCurProc = oGuestSession.processCreate(sCmd, asArgs if self.oTstDrv.fpApiVer >= 5.0 else asArgs[1:],
    28032805                                                           [], [], 0); # Infinite timeout.
     
    28072809                    break;
    28082810
    2809             reporter.log2('Waiting for non-stale processes to terminate...');
     2811            reporter.log('Waiting for non-stale processes to terminate...');
    28102812            for i, oProcess in enumerate(aoProcesses):
    28112813                try:
    2812                     eWaitResult = oProcess.waitForArray([ vboxcon.ProcessWaitForFlag_Terminate, ], 120 * 1000);
     2814                    reporter.log('Waiting for non-stale process #%d...' % (i));
     2815                    eWaitResult = oProcess.waitForArray([ vboxcon.ProcessWaitForFlag_Terminate, ], 30 * 1000);
    28132816                    eProcessStatus = oProcess.status;
    28142817                except:
     
    28252828                # anymore for) and the started + terminated non-stale processes (that we still keep
    28262829                # a reference in aoProcesses[] for).
    2827                 if cProcesses != (cStaleProcs * 2):
    2828                     fRc = reporter.error('Got %d total processes, expected %d' % (cProcesses, cStaleProcs));
    2829 
     2830                cProcsExpected  = cStaleProcs * 2;
     2831                if cProcesses != cProcsExpected:
     2832                    fRc = reporter.error('Got %d total processes, expected %d (stale vs. non-stale)' \
     2833                                         % (cProcesses, cProcsExpected));
    28302834        if fRc is True:
    28312835            reporter.log2('All non-stale processes terminated');
     
    28382842            else:
    28392843                asArgs = [ sCmd ];
    2840             reporter.log2('Starting blocking processes...');
     2844            reporter.log('Starting blocking processes...');
    28412845            aoProcesses = [];
    28422846            for i in xrange(0, cStaleProcs):
    28432847                try:
     2848                    reporter.log2('Starting blocking process #%d...' % (i));
    28442849                    oCurProc = oGuestSession.processCreate(sCmd, asArgs if self.oTstDrv.fpApiVer >= 5.0 else asArgs[1:],
    28452850                                                           [],  [], 30 * 1000);
     
    28552860            for i, oProcess in enumerate(aoProcesses):
    28562861                try:
     2862                    reporter.log('Terminating blocking process #%d...' % (i));
    28572863                    oProcess.terminate();
    28582864                except: # Termination might not be supported, just skip and log it.
    28592865                    reporter.logXcpt('Termination of blocking process #%d failed, skipped:' % (i,));
    28602866
    2861             # There still should be 20 processes because we terminated the 10 newest ones.
     2867            # There still should be 20 processes because we just terminated the 10 blocking ones above.
    28622868            try:    cProcesses = len(self.oTstDrv.oVBoxMgr.getArray(oGuestSession, 'processes'));
    2863             except: fRc = reporter.errorXcpt();
     2869            except: fRc        = reporter.errorXcpt();
    28642870            else:
    28652871                if cProcesses != (cStaleProcs * 2):
    2866                     fRc = reporter.error('Got %d total processes, expected %d' % (cProcesses, cStaleProcs));
     2872                    fRc = reporter.error('Got %d total processes, expected %d (final)' % (cProcesses, cStaleProcs));
    28672873                reporter.log2('Final guest session processes count: %d' % (cProcesses,));
    28682874
     2875        if not fRc:
     2876            aoProcs = self.oTstDrv.oVBoxMgr.getArray(oGuestSession, 'processes');
     2877            for i, oProc in enumerate(aoProcs):
     2878                try:
     2879                    aoArgs = self.oTstDrv.oVBoxMgr.getArray(oProc, 'arguments');
     2880                    reporter.log('Process %d (\'%s\') still around, status is %d' \
     2881                                 % (i, ' '.join([str(x) for x in aoArgs]), oProc.status));
     2882                except:
     2883                    reporter.logXcpt('Process lookup failed');
    28692884        #
    28702885        # Now try to close the session and see what happens.
    28712886        #
    2872         reporter.log2('Closing guest session ...');
     2887        reporter.log('Closing guest session ...');
    28732888        try:
    28742889            oGuestSession.close();
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