Changeset 99518 in vbox
- Timestamp:
- Apr 24, 2023 9:47:11 AM (20 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testdriver/vbox.py
r99413 r99518 4327 4327 4328 4328 def txsRunTestRedirectStd(self, oTxsSession, sTestName, cMsTimeout, sExecName, asArgs = (), asAddEnv = (), sAsUser = "", 4329 oStdIn = '/dev/null', oStdOut = '/dev/null', oStdErr = '/dev/null', oTestPipe = '/dev/null'): 4329 oStdIn = '/dev/null', oStdOut = '/dev/null', oStdErr = '/dev/null', oTestPipe = '/dev/null', 4330 fIgnoreErrors = False): 4330 4331 """ 4331 4332 Executes the specified test task, waiting till it completes or times out, … … 4346 4347 fRc = False; 4347 4348 if oTxsSession.asyncExecEx(sExecName, asArgs, asAddEnv, oStdIn, oStdOut, oStdErr, 4348 oTestPipe, sAsUser, cMsTimeout = self.adjustTimeoutMs(cMsTimeout)): 4349 oTestPipe, sAsUser, cMsTimeout = self.adjustTimeoutMs(cMsTimeout), 4350 fIgnoreErrors = fIgnoreErrors): 4349 4351 self.addTask(oTxsSession); 4350 4352 … … 4353 4355 oTask = self.waitForTasks(cMsTimeout + 1); 4354 4356 if oTask is None: 4355 reporter.log('txsRunTestRedirectStd: waitForTasks timed out'); 4357 if fIgnoreErrors: 4358 reporter.log('txsRunTestRedirectStd: waitForTasks timed out'); 4359 else: 4360 reporter.error('txsRunTestRedirectStd: waitForTasks timed out'); 4356 4361 break; 4357 4362 if oTask is oTxsSession: 4358 4363 fRc = True; 4359 reporter.log('txsRunTestRedirectStd: isSuccess=%s getResult=%s' 4360 % (oTxsSession.isSuccess(), oTxsSession.getResult())); 4364 if not oTxsSession.isSuccess() \ 4365 and not fIgnoreErrors: 4366 reporter.error('txsRunTestRedirectStd: failed; result is "%s"' % (oTxsSession.getResult())); 4367 else: 4368 reporter.log('txsRunTestRedirectStd: isSuccess=%s getResult=%s' 4369 % (oTxsSession.isSuccess(), oTxsSession.getResult())); 4361 4370 break; 4371 4362 4372 if not self.handleTask(oTask, 'txsRunTestRedirectStd'): 4363 4373 break; … … 4371 4381 reporter.testDone(); 4372 4382 return fRc; 4383 4384 def txsRunTestStdIn(self, oTxsSession, sTestName, cMsTimeout, sExecName, asArgs = (), asAddEnv = (), sAsUser = "", 4385 sStdIn = None, fIgnoreErrors = False): 4386 """ 4387 Executes the specified test task, waiting till it completes or times out. 4388 Redirecting simple string input into stdin, redirecting text stdout / stderr output to verbose logging. 4389 4390 The VM session (if any) must be in the task list. 4391 4392 Returns True if we executed the task and nothing abnormal happend. 4393 Query the process status from the TXS session. 4394 4395 Returns False if some unexpected task was signalled or we failed to 4396 submit the job. 4397 """ 4398 assert sStdIn is not None; 4399 # Wrap sStdIn in a file like class. 4400 class StdInWrapper(object): # pylint: disable=too-few-public-methods 4401 def __init__(self, sStdIn): 4402 self.sContent = sStdIn; 4403 self.off = 0; 4404 4405 def read(self, cbMax): 4406 cbLeft = len(self.sContent) - self.off; 4407 if cbLeft == 0: 4408 return ""; 4409 if cbLeft <= cbMax: 4410 sRet = self.sContent[self.off:(self.off + cbLeft)]; 4411 else: 4412 sRet = self.sContent[self.off:(self.off + cbMax)]; 4413 self.off = self.off + len(sRet); 4414 reporter.log2('Reading from stdin: "%s"' % (sRet,)); 4415 return sRet; 4416 4417 return self.txsRunTestRedirectStd(oTxsSession, sTestName, cMsTimeout, sExecName, asArgs, asAddEnv, sAsUser, 4418 oStdIn = StdInWrapper(sStdIn), 4419 oStdErr = reporter.FileWrapper('stderr'), oStdOut = reporter.FileWrapper('stdout'), 4420 fIgnoreErrors = fIgnoreErrors); 4373 4421 4374 4422 def txsRunTest2(self, oTxsSession1, oTxsSession2, sTestName, cMsTimeout,
Note:
See TracChangeset
for help on using the changeset viewer.