Changeset 99282 in vbox for trunk/src/VBox/ValidationKit/tests/additions
- Timestamp:
- Apr 4, 2023 1:36:43 PM (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py
r99279 r99282 2289 2289 return fRc; 2290 2290 2291 def processCreateWrapper(self, oGuestSession, sCmd, asArgs, sCwd, aEnv, afFlags, timeoutMS): 2292 """ 2293 Wrapepr function to deal with different flavors of the IGuestProcess::processCreate call, 2294 depending on the API version. 2295 2296 Returns oProcess object on success, None on failure. 2297 """ 2298 oProcess = None; 2299 2300 reporter.log2('Executing sCmd=%s, cCwd=%s, afFlags=%s, timeoutMS=%d, asArgs=%s, asEnv=%s' 2301 % (sCmd, sCwd, afFlags, timeoutMS, limitString(asArgs), limitString(aEnv),)); 2302 2303 if self.oTstDrv.fpApiVer >= 7.1 and self.oTstDrv.uRevision >= 156485: 2304 # 7.1 adds a current working directory parameter. 2305 oProcess = oGuestSession.processCreate(sCmd, asArgs, sCwd, aEnv, afFlags, timeoutMS); 2306 else: 2307 oProcess = oGuestSession.processCreate(sCmd, 2308 asArgs if self.oTstDrv.fpApiVer >= 5.0 else asArgs[1:], 2309 aEnv, afFlags, timeoutMS); 2310 return oProcess; 2311 2291 2312 def gctrlExecute(self, oTest, oGuestSession, fIsError): # pylint: disable=too-many-statements 2292 2313 """ … … 2316 2337 # Start the process: 2317 2338 # 2318 reporter.log2('Executing sCmd=%s, cCwd=%s, afFlags=%s, timeoutMS=%d, asArgs=%s, asEnv=%s' 2319 % (oTest.sCmd, oTest.sCwd, oTest.afFlags, oTest.timeoutMS, limitString(oTest.asArgs), 2320 limitString(oTest.aEnv),)); 2339 2321 2340 try: 2322 if self.oTstDrv.fpApiVer >= 7.1 and self.oTstDrv.uRevision >= 156485: 2323 oProcess = oGuestSession.processCreate(oTest.sCmd, 2324 oTest.asArgs if self.oTstDrv.fpApiVer >= 5.0 else oTest.asArgs[1:], 2325 oTest.sCwd, 2326 oTest.aEnv, oTest.afFlags, oTest.timeoutMS); 2327 else: 2328 oProcess = oGuestSession.processCreate(oTest.sCmd, 2329 oTest.asArgs if self.oTstDrv.fpApiVer >= 5.0 else oTest.asArgs[1:], 2330 oTest.aEnv, oTest.afFlags, oTest.timeoutMS); 2341 oProcess = self.processCreateWrapper(oGuestSession, oTest.sCmd, oTest.asArgs, oTest.sCwd, 2342 oTest.aEnv, oTest.afFlags, oTest.timeoutMS); 2331 2343 except: 2332 2344 reporter.maybeErrXcpt(fIsError, 'type=%s, asArgs=%s' % (type(oTest.asArgs), oTest.asArgs,)); … … 2889 2901 try: 2890 2902 reporter.log2('Starting stale process #%d...' % (i)); 2891 if self.oTstDrv.fpApiVer >= 7.1 and self.oTstDrv.uRevision >= 156485: 2892 oGuestSession.processCreate(sShell, 2893 asArgs if self.oTstDrv.fpApiVer >= 5.0 else asArgs[1:], 2894 "", # Working directory. 2895 [], # Environment changes. 2896 [ vboxcon.ProcessCreateFlag_WaitForStdOut ], 30 * 1000); 2897 else: 2898 oGuestSession.processCreate(sShell, 2899 asArgs if self.oTstDrv.fpApiVer >= 5.0 else asArgs[1:], [], 2900 [ vboxcon.ProcessCreateFlag_WaitForStdOut ], 30 * 1000); 2903 self.processCreateWrapper(oGuestSession, sShell, asArgs, "", # Working directory. 2904 [], # Environment changes. 2905 [ vboxcon.ProcessCreateFlag_WaitForStdOut ], 30 * 1000); 2901 2906 # Note: Not keeping a process reference from the created process above is intentional and part of the test! 2902 2907 … … 2930 2935 try: 2931 2936 reporter.log2('Starting non-stale process #%d...' % (i)); 2932 if self.oTstDrv.fpApiVer >= 7.1 and self.oTstDrv.uRevision >= 156485: 2933 oCurProc = oGuestSession.processCreate(sShell, asArgs if self.oTstDrv.fpApiVer >= 5.0 else asArgs[1:], 2934 "", # Working directory. 2935 [], [], 0); # Infinite timeout. 2936 else: 2937 oCurProc = oGuestSession.processCreate(sShell, asArgs if self.oTstDrv.fpApiVer >= 5.0 else asArgs[1:], 2938 [], [], 0); # Infinite timeout. 2937 oCurProc = self.processCreateWrapper(oGuestSession, sShell, asArgs, 2938 "", # Working directory. 2939 [], [], 0); # Infinite timeout. 2939 2940 aoProcs.append(oCurProc); 2940 2941 except: … … 2988 2989 try: 2989 2990 reporter.log2('Starting blocking process #%d...' % (i)); 2990 if self.oTstDrv.fpApiVer >= 7.1 and self.oTstDrv.uRevision >= 156485: 2991 oCurProc = oGuestSession.processCreate(sCmd, asArgs if self.oTstDrv.fpApiVer >= 5.0 else asArgs[1:], 2992 "", # Working directory. 2993 [], [], 30 * 1000); 2994 else: 2995 oCurProc = oGuestSession.processCreate(sCmd, asArgs if self.oTstDrv.fpApiVer >= 5.0 else asArgs[1:], 2996 [], [], 30 * 1000); 2991 oCurProc = self.processCreateWrapper(oGuestSession, sCmd, asArgs, 2992 "", # Working directory. 2993 [], [], 30 * 1000); 2994 2997 2995 # Note: Use a timeout in the call above for not letting the stale processes 2998 2996 # hanging around forever. This can happen if the installed Guest Additions … … 3424 3422 afFlags = []; 3425 3423 try: 3426 if self.oTstDrv.fpApiVer >= 7.1 and self.oTstDrv.uRevision >= 156485: 3427 oGuestProcess = oGuestSession.processCreate(sImage, 3428 asArgs if self.oTstDrv.fpApiVer >= 5.0 else asArgs[1:], 3429 "", # Working directory. 3430 aEnv, afFlags, 3431 30 * 1000); 3432 else: 3433 oGuestProcess = oGuestSession.processCreate(sImage, 3434 asArgs if self.oTstDrv.fpApiVer >= 5.0 else asArgs[1:], aEnv, afFlags, 3435 30 * 1000); 3424 oGuestProcess = self.processCreateWrapper(oGuestSession, sImage, asArgs, 3425 "", # Working directory. 3426 aEnv, afFlags, 30 * 1000); 3436 3427 except: 3437 3428 fRc = reporter.error('Failed to start shell process (%s)' % (sImage,)); … … 3547 3538 fRc = True; 3548 3539 try: 3549 if self.oTstDrv.fpApiVer >= 7.1 and self.oTstDrv.uRevision >= 156485: 3550 oCurProcess = oGuestSession.processCreate(sShell, [sShell,] if self.oTstDrv.fpApiVer >= 5.0 else [], 3551 "", # Working directory. 3552 [], [], 30 * 1000); 3553 else: 3554 oCurProcess = oGuestSession.processCreate(sShell, [sShell,] if self.oTstDrv.fpApiVer >= 5.0 else [], 3555 [], [], 30 * 1000); 3540 oCurProcess = self.processCreateWrapper(oGuestSession, sShell, [ sShell,] if self.oTstDrv.fpApiVer >= 5.0 else [], 3541 "", # Working directory. 3542 [], [], 30 * 1000); 3556 3543 except: 3557 3544 fRc = reporter.errorXcpt(); … … 3590 3577 # 3591 3578 try: 3592 if self.oTstDrv.fpApiVer >= 7.1 and self.oTstDrv.uRevision >= 156485: 3593 oCurProcess = oGuestSession.processCreate(sShell, [sShell,] if self.oTstDrv.fpApiVer >= 5.0 else [], 3594 "", # Working directory. 3595 [], [], 3 * 1000); 3596 else: 3597 oCurProcess = oGuestSession.processCreate(sShell, [sShell,] if self.oTstDrv.fpApiVer >= 5.0 else [], 3598 [], [], 3 * 1000); 3579 oCurProcess = self.processCreateWrapper(oGuestSession, sShell, [sShell,] if self.oTstDrv.fpApiVer >= 5.0 else [], 3580 "", # Working directory. 3581 [], [], 3 * 1000); 3599 3582 except: 3600 3583 fRc = reporter.errorXcpt(); … … 5589 5572 5590 5573 for _ in xrange(100): 5591 oProc = oGuestSession.processCreate(sCmd, asArgs if self.fpApiVer >= 5.0 else asArgs[1:],5592 5593 5574 oProc = self.processCreateWrapper(oGuestSession, sCmd, asArgs if self.fpApiVer >= 5.0 else asArgs[1:], 5575 "", # Working directory. 5576 aEnv, afFlags, 30 * 1000); 5594 5577 5595 5578 aWaitFor = [ vboxcon.ProcessWaitForFlag_Terminate ];
Note:
See TracChangeset
for help on using the changeset viewer.