Changeset 103386 in vbox
- Timestamp:
- Feb 15, 2024 1:43:31 PM (10 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/audio/tdAudioTest.py
r103379 r103386 301 301 302 302 Might be called synchronously in main thread or via the thread exeuction helper (asynchronous). 303 304 Returns (success status, exit code). 303 305 """ 304 306 fRc = False; 307 iRc = -42; 305 308 306 309 asEnvTmp = os.environ.copy(); … … 322 325 if not oProcess: 323 326 reporter.error('Starting process for "%s" failed!' % (sWhat)); 324 return False;327 return fRc, iRc; 325 328 326 329 iPid = oProcess.pid; 327 330 self.pidFileAdd(iPid, sWhat); 328 329 iRc = 0;330 331 331 332 while True if sys.version_info[0] < 3 else oProcess.stdout.readable(): # pylint: disable=no-member … … 341 342 if iRc == 0: 342 343 reporter.log('*** %s: exit code %d' % (sWhat, iRc)); 343 fRc = True;344 344 else: 345 345 reporter.log('!*! %s: exit code %d' % (sWhat, iRc)); 346 346 347 fRc = True; 347 348 self.pidFileRemove(iPid); 348 349 # Save thread result code.350 self.iThreadHstProcRc = iRc;351 352 349 except: 353 350 reporter.logXcpt('Executing "%s" failed!' % (sWhat)); 354 351 355 352 reporter.log('Executing \"%s\" on host %s' % (sWhat, 'done' if fRc else 'failed',)); 356 return fRc;353 return (fRc, iRc); 357 354 358 355 def executeHstThread(self, sWhat, asArgs, asEnv = None, fAsAdmin = False): … … 360 357 Thread execution helper to run a process on the host. 361 358 """ 362 return self.executeHstLoop(sWhat, asArgs, asEnv, fAsAdmin); 363 364 def executeHst(self, sWhat, asArgs, asEnv = None, fAsAdmin = False, fBlocking = True): 359 _, iRc = self.executeHstLoop(sWhat, asArgs, asEnv, fAsAdmin); 360 361 # Save thread result code. 362 self.iThreadHstProcRc = iRc; 363 364 def executeHst(self, sWhat, asArgs, asEnv = None, fAsAdmin = False, fBlocking = True, iExpectedRc = None): 365 365 """ 366 366 Runs a binary (image) with optional admin (root) rights on the host and … … 369 369 Windows currently is not supported yet running stuff as Administrator. 370 370 371 Returns success status (exit code is 0). 372 """ 373 reporter.log('Executing \"%s\" on host (as admin = %s, blocking = %s)' % (sWhat, fAsAdmin, fBlocking)); 371 Returns (success status, exit code). 372 """ 373 reporter.log('Executing \"%s\" on host (as admin = %s, blocking = %s, expected rc = %d)' 374 % (sWhat, fAsAdmin, fBlocking, iExpectedRc)); 374 375 reporter.log2('Arguments: %s' % (asArgs,)); 375 376 if asEnv: … … 381 382 except: pass; 382 383 384 fRc = False; 385 iRc = -42; 386 383 387 if fBlocking: # Run in same thread (blocking). 384 fRc = self.executeHstLoop(sWhat, asArgs, asEnv, fAsAdmin);388 fRc, iRc = self.executeHstLoop(sWhat, asArgs, asEnv, fAsAdmin); 385 389 else: # Run in separate thread (asynchronous). 386 390 self.iThreadHstProcRc = -42; # Initialize thread rc. … … 393 397 self.processEvents(0); 394 398 reporter.log2('Thread returned exit code for "%s": %d' % (sWhat, self.iThreadHstProcRc)); 399 fRc = True; 400 iRc = self.iThreadHstProcRc; 395 401 except: 396 402 reporter.logXcpt('Starting thread for "%s" failed' % (sWhat,)); 397 fRc = self.iThreadHstProcRc == 0; 398 399 return fRc; 403 404 # Adjust fRc if caller expected a specific exit code. 405 if iExpectedRc \ 406 and iRc is not iExpectedRc: 407 reporter.error('Executing \"%s\" on host failed (got exit code %d, expected %d' 408 % (sWhat, iRc, iExpectedRc,)); 409 fRc = False; 410 411 return fRc, iRc; 400 412 401 413 def getWinFirewallArgsDisable(self, sOsType): … … 470 482 asArgs = self.getWinFirewallArgsDisable('vista'); 471 483 if asArgs: 472 fRc = self.executeHst('Disabling host firewall', asArgs, fAsAdmin = True);484 fRc, _ = self.executeHst('Disabling host firewall', asArgs, fAsAdmin = True); 473 485 else: 474 486 reporter.log('Firewall not available on host, skipping'); … … 609 621 # Let VKAT on the host run synchronously. 610 622 # 611 fRc = self.executeHst("VKAT Host", asArgs);623 fRc, _ = self.executeHst("VKAT Host", asArgs); 612 624 613 625 reporter.testDone(); … … 633 645 asArgs += self.asVkatVerifyArgs; 634 646 635 fRc = self.executeHst("VKAT Host Verify", asArgs);647 fRc, _ = self.executeHst("VKAT Host Verify", asArgs, iExpectedRc = 0); 636 648 if fRc: 637 649 reporter.log("Verification audio data successful"); … … 736 748 # Doesn't take long and gives us some more clue if it flies on the testboxes. 737 749 reporter.testStart('VKAT Selftest'); 738 fRc = self.executeHst("VKAT Host Selftest", [ sVkatExe, 'selftest' ]);750 fRc, _ = self.executeHst("VKAT Host Selftest", [ sVkatExe, 'selftest' ], iExpectedRc = 0); 739 751 reporter.testDone(); 740 752 if not fRc: … … 742 754 743 755 # Now probe the backends. 756 reporter.testStart('VKAT Probing'); 744 757 asArgs = [ sVkatExe, 'enum', '--probe-backends' ]; 745 758 for _ in range(1, reporter.getVerbosity()): # Verbosity always is initialized at 1. 746 759 asArgs.extend([ '-v' ]); 747 fRc 748 if not fRc:760 fRc, iRc = self.executeHst("VKAT Host Audio Probing", asArgs); 761 if iRc != 0: 749 762 # Not fatal, as VBox then should fall back to the NULL audio backend (also worth having as a test case). 750 763 reporter.log('Warning: Backend probing on host failed, no audio available (pure server installation?)'); 764 reporter.testDone(); 751 765 752 766 # Reconfigure the VM.
Note:
See TracChangeset
for help on using the changeset viewer.