VirtualBox

Changeset 93139 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jan 7, 2022 3:41:29 PM (3 years ago)
Author:
vboxsync
Message:

Validation Kit/Guest Control: Renaming / cleanup.

File:
1 edited

Legend:

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

    r93115 r93139  
    27452745        oCreds.applyDefaultsIfNotSet(oTestVm);
    27462746
    2747         # Number of stale guest processes to create.
    2748         cStaleProcs = 10;
     2747        # Number of guest processes per group to create.
     2748        cProcsPerGroup = 10;
    27492749
    27502750        #
     
    27702770        reporter.log('Starting stale processes...');
    27712771        fRc = True;
    2772         for i in xrange(0, cStaleProcs):
     2772        for i in xrange(0, cProcsPerGroup):
    27732773            try:
    27742774                reporter.log2('Starting stale process #%d...' % (i));
     
    27762776                                            asArgs if self.oTstDrv.fpApiVer >= 5.0 else asArgs[1:], [],
    27772777                                            [ vboxcon.ProcessCreateFlag_WaitForStdOut ], 30 * 1000);
     2778                # Note: Not keeping a process reference from the created process above is intentional and part of the test!
     2779
    27782780                # Note: Use a timeout in the call above for not letting the stale processes
    27792781                #       hanging around forever.  This can happen if the installed Guest Additions
     
    27852787        if fRc:
    27862788            reporter.log2('Starting stale processes successful');
    2787             try:    cProcesses = len(self.oTstDrv.oVBoxMgr.getArray(oGuestSession, 'processes'));
    2788             except: fRc        = reporter.errorXcpt();
     2789            try:    cProcs = len(self.oTstDrv.oVBoxMgr.getArray(oGuestSession, 'processes'));
     2790            except: fRc    = reporter.errorXcpt();
    27892791            else:
    2790                 reporter.log2('Proccess count is: %d' % (cProcesses));
    2791                 if cProcesses != cStaleProcs:
    2792                     fRc = reporter.error('Got %d stale processes, expected %d (stale)' % (cProcesses, cStaleProcs));
     2792                reporter.log2('Proccess count is: %d' % (cProcs));
     2793                if cProcs != cProcsPerGroup:
     2794                    fRc = reporter.error('Got %d stale processes, expected %d (stale)' % (cProcs, cProcsPerGroup));
    27932795
    27942796        if fRc:
     
    28012803                asArgs = [ sCmd, '-c', 'ls -la ' + self.oTstDrv.getGuestSystemDir(oTestVm), ];
    28022804            reporter.log('Starting non-stale processes...');
    2803             aoProcesses = [];
    2804             for i in xrange(0, cStaleProcs):
     2805            aoProcs = [];
     2806            for i in xrange(0, cProcsPerGroup):
    28052807                try:
    28062808                    reporter.log2('Starting non-stale process #%d...' % (i));
    28072809                    oCurProc = oGuestSession.processCreate(sCmd, asArgs if self.oTstDrv.fpApiVer >= 5.0 else asArgs[1:],
    28082810                                                           [], [], 0); # Infinite timeout.
    2809                     aoProcesses.append(oCurProc);
     2811                    aoProcs.append(oCurProc);
    28102812                except:
    28112813                    fRc = reporter.errorXcpt('Creating non-stale process #%d failed:' % (i,));
    28122814                    break;
    28132815
    2814             try:    cProcesses = len(self.oTstDrv.oVBoxMgr.getArray(oGuestSession, 'processes'));
    2815             except: fRc        = reporter.errorXcpt();
     2816            try:    cProcs = len(self.oTstDrv.oVBoxMgr.getArray(oGuestSession, 'processes'));
     2817            except: fRc    = reporter.errorXcpt();
    28162818            else:
    2817                 reporter.log2('Proccess count is: %d' % (cProcesses));
     2819                reporter.log2('Proccess count is: %d' % (cProcs));
    28182820
    28192821            reporter.log('Waiting for non-stale processes to terminate...');
    2820             for i, oProcess in enumerate(aoProcesses):
     2822            for i, oProcess in enumerate(aoProcs):
    28212823                try:
    28222824                    reporter.log('Waiting for non-stale process #%d...' % (i));
     
    28322834                reporter.log('All non-stale processes ended successfully');
    28332835
    2834             try:    cProcesses = len(self.oTstDrv.oVBoxMgr.getArray(oGuestSession, 'processes'));
    2835             except: fRc        = reporter.errorXcpt();
     2836            try:    cProcs = len(self.oTstDrv.oVBoxMgr.getArray(oGuestSession, 'processes'));
     2837            except: fRc    = reporter.errorXcpt();
    28362838            else:
    2837                 reporter.log2('Proccess count is: %d' % (cProcesses));
     2839                reporter.log2('Proccess count is: %d' % (cProcs));
    28382840
    28392841                # Here we count the stale processes (that is, processes we don't have a reference
    2840                 # anymore for) and the started + terminated non-stale processes (that we still keep
     2842                # anymore for) and the started + ended non-stale processes (that we still keep
    28412843                # a reference in aoProcesses[] for).
    2842                 cProcsExpected = cStaleProcs * 2;
    2843                 if cProcesses != cProcsExpected:
     2844                cProcsExpected = cProcsPerGroup * 2;
     2845                if cProcs != cProcsExpected:
    28442846                    fRc = reporter.error('Got %d total processes, expected %d (stale vs. non-stale)' \
    2845                                          % (cProcesses, cProcsExpected));
     2847                                         % (cProcs, cProcsExpected));
    28462848            #
    28472849            # Fire off non-stale blocking processes which are terminated via terminate().
     
    28522854                asArgs = [ sCmd ];
    28532855            reporter.log('Starting blocking processes...');
    2854             aoProcesses = [];
    2855             for i in xrange(0, cStaleProcs):
     2856            aoProcs = [];
     2857            for i in xrange(0, cProcsPerGroup):
    28562858                try:
    28572859                    reporter.log2('Starting blocking process #%d...' % (i));
     
    28612863                    #       hanging around forever.  This can happen if the installed Guest Additions
    28622864                    #       do not support terminating guest processes.
    2863                     aoProcesses.append(oCurProc);
     2865                    aoProcs.append(oCurProc);
    28642866                except:
    28652867                    fRc = reporter.errorXcpt('Creating non-stale blocking process #%d failed:' % (i,));
     
    28702872
    28712873            reporter.log2('Terminating blocking processes...');
    2872             for i, oProcess in enumerate(aoProcesses):
     2874            for i, oProcess in enumerate(aoProcs):
    28732875                try:
    28742876                    reporter.log('Terminating blocking process #%d...' % (i));
     
    28822884
    28832885            # There still should be 20 processes because we just terminated the 10 blocking ones above.
    2884             try:    cProcesses = len(self.oTstDrv.oVBoxMgr.getArray(oGuestSession, 'processes'));
    2885             except: fRc        = reporter.errorXcpt();
     2886            try:    cProcs = len(self.oTstDrv.oVBoxMgr.getArray(oGuestSession, 'processes'));
     2887            except: fRc    = reporter.errorXcpt();
    28862888            else:
    2887                 if cProcesses != (cStaleProcs * 2):
    2888                     fRc = reporter.error('Got %d total processes, expected %d (final)' % (cProcesses, cStaleProcs));
    2889                 reporter.log2('Final guest session processes count: %d' % (cProcesses,));
     2889                if cProcs != cProcsPerGroup * 2:
     2890                    fRc = reporter.error('Got %d total processes, expected %d (final)' % (cProcs, cProcsPerGroup));
     2891                reporter.log2('Final guest session processes count: %d' % (cProcs,));
    28902892
    28912893        if not fRc:
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