- Timestamp:
- Jan 7, 2022 3:41:29 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py
r93115 r93139 2745 2745 oCreds.applyDefaultsIfNotSet(oTestVm); 2746 2746 2747 # Number of stale guest processesto create.2748 c StaleProcs= 10;2747 # Number of guest processes per group to create. 2748 cProcsPerGroup = 10; 2749 2749 2750 2750 # … … 2770 2770 reporter.log('Starting stale processes...'); 2771 2771 fRc = True; 2772 for i in xrange(0, c StaleProcs):2772 for i in xrange(0, cProcsPerGroup): 2773 2773 try: 2774 2774 reporter.log2('Starting stale process #%d...' % (i)); … … 2776 2776 asArgs if self.oTstDrv.fpApiVer >= 5.0 else asArgs[1:], [], 2777 2777 [ 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 2778 2780 # Note: Use a timeout in the call above for not letting the stale processes 2779 2781 # hanging around forever. This can happen if the installed Guest Additions … … 2785 2787 if fRc: 2786 2788 reporter.log2('Starting stale processes successful'); 2787 try: cProc esses = len(self.oTstDrv.oVBoxMgr.getArray(oGuestSession, 'processes'));2788 except: fRc 2789 try: cProcs = len(self.oTstDrv.oVBoxMgr.getArray(oGuestSession, 'processes')); 2790 except: fRc = reporter.errorXcpt(); 2789 2791 else: 2790 reporter.log2('Proccess count is: %d' % (cProc esses));2791 if cProc esses != cStaleProcs:2792 fRc = reporter.error('Got %d stale processes, expected %d (stale)' % (cProc esses, 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)); 2793 2795 2794 2796 if fRc: … … 2801 2803 asArgs = [ sCmd, '-c', 'ls -la ' + self.oTstDrv.getGuestSystemDir(oTestVm), ]; 2802 2804 reporter.log('Starting non-stale processes...'); 2803 aoProc esses = [];2804 for i in xrange(0, c StaleProcs):2805 aoProcs = []; 2806 for i in xrange(0, cProcsPerGroup): 2805 2807 try: 2806 2808 reporter.log2('Starting non-stale process #%d...' % (i)); 2807 2809 oCurProc = oGuestSession.processCreate(sCmd, asArgs if self.oTstDrv.fpApiVer >= 5.0 else asArgs[1:], 2808 2810 [], [], 0); # Infinite timeout. 2809 aoProc esses.append(oCurProc);2811 aoProcs.append(oCurProc); 2810 2812 except: 2811 2813 fRc = reporter.errorXcpt('Creating non-stale process #%d failed:' % (i,)); 2812 2814 break; 2813 2815 2814 try: cProc esses = len(self.oTstDrv.oVBoxMgr.getArray(oGuestSession, 'processes'));2815 except: fRc 2816 try: cProcs = len(self.oTstDrv.oVBoxMgr.getArray(oGuestSession, 'processes')); 2817 except: fRc = reporter.errorXcpt(); 2816 2818 else: 2817 reporter.log2('Proccess count is: %d' % (cProc esses));2819 reporter.log2('Proccess count is: %d' % (cProcs)); 2818 2820 2819 2821 reporter.log('Waiting for non-stale processes to terminate...'); 2820 for i, oProcess in enumerate(aoProc esses):2822 for i, oProcess in enumerate(aoProcs): 2821 2823 try: 2822 2824 reporter.log('Waiting for non-stale process #%d...' % (i)); … … 2832 2834 reporter.log('All non-stale processes ended successfully'); 2833 2835 2834 try: cProc esses = len(self.oTstDrv.oVBoxMgr.getArray(oGuestSession, 'processes'));2835 except: fRc 2836 try: cProcs = len(self.oTstDrv.oVBoxMgr.getArray(oGuestSession, 'processes')); 2837 except: fRc = reporter.errorXcpt(); 2836 2838 else: 2837 reporter.log2('Proccess count is: %d' % (cProc esses));2839 reporter.log2('Proccess count is: %d' % (cProcs)); 2838 2840 2839 2841 # 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 keep2842 # anymore for) and the started + ended non-stale processes (that we still keep 2841 2843 # a reference in aoProcesses[] for). 2842 cProcsExpected = c StaleProcs* 2;2843 if cProc esses != cProcsExpected:2844 cProcsExpected = cProcsPerGroup * 2; 2845 if cProcs != cProcsExpected: 2844 2846 fRc = reporter.error('Got %d total processes, expected %d (stale vs. non-stale)' \ 2845 % (cProc esses, cProcsExpected));2847 % (cProcs, cProcsExpected)); 2846 2848 # 2847 2849 # Fire off non-stale blocking processes which are terminated via terminate(). … … 2852 2854 asArgs = [ sCmd ]; 2853 2855 reporter.log('Starting blocking processes...'); 2854 aoProc esses = [];2855 for i in xrange(0, c StaleProcs):2856 aoProcs = []; 2857 for i in xrange(0, cProcsPerGroup): 2856 2858 try: 2857 2859 reporter.log2('Starting blocking process #%d...' % (i)); … … 2861 2863 # hanging around forever. This can happen if the installed Guest Additions 2862 2864 # do not support terminating guest processes. 2863 aoProc esses.append(oCurProc);2865 aoProcs.append(oCurProc); 2864 2866 except: 2865 2867 fRc = reporter.errorXcpt('Creating non-stale blocking process #%d failed:' % (i,)); … … 2870 2872 2871 2873 reporter.log2('Terminating blocking processes...'); 2872 for i, oProcess in enumerate(aoProc esses):2874 for i, oProcess in enumerate(aoProcs): 2873 2875 try: 2874 2876 reporter.log('Terminating blocking process #%d...' % (i)); … … 2882 2884 2883 2885 # There still should be 20 processes because we just terminated the 10 blocking ones above. 2884 try: cProc esses = len(self.oTstDrv.oVBoxMgr.getArray(oGuestSession, 'processes'));2885 except: fRc 2886 try: cProcs = len(self.oTstDrv.oVBoxMgr.getArray(oGuestSession, 'processes')); 2887 except: fRc = reporter.errorXcpt(); 2886 2888 else: 2887 if cProc esses != (cStaleProcs * 2):2888 fRc = reporter.error('Got %d total processes, expected %d (final)' % (cProc esses, cStaleProcs));2889 reporter.log2('Final guest session processes count: %d' % (cProc esses,));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,)); 2890 2892 2891 2893 if not fRc:
Note:
See TracChangeset
for help on using the changeset viewer.