Changeset 84597 in vbox
- Timestamp:
- May 28, 2020 4:03:23 PM (5 years ago)
- Location:
- trunk/src/VBox/ValidationKit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testdriver/vbox.py
r84581 r84597 3437 3437 3438 3438 Returns False on error, logged. 3439 3440 3439 Returns task result on success. 3441 3440 """ … … 3543 3542 (sRemoteFile, sLocalFile, self.adjustTimeoutMs(cMsTimeout), fIgnoreErrors)); 3544 3543 3545 def txsDownloadFiles(self, oSession, oTxsSession, asFiles, fIgnoreErrors = False): 3546 """ 3547 Convenience function to get files from the guest and stores it 3548 into the scratch directory for later (manual) review. 3544 def txsDownloadFiles(self, oSession, oTxsSession, aasFiles, fAddToLog = True, fIgnoreErrors = False): 3545 """ 3546 Convenience function to get files from the guest, storing them in the 3547 scratch and adding them to the test result set (optional, but default). 3548 3549 The aasFiles parameter contains an array of with guest-path + host-path 3550 pairs, optionally a file 'kind', description and an alternative upload 3551 filename can also be specified. 3552 3553 Host paths are relative to the scratch directory or they must be given 3554 in absolute form. The guest path should be using guest path style. 3549 3555 3550 3556 Returns True on success. 3551 3552 Returns False on failure, logged. 3553 """ 3554 fRc = True; 3555 for sGstFile in asFiles: 3556 sTmpFile = os.path.join(self.sScratchPath, 'tmp-' + os.path.basename(sGstFile)); 3557 reporter.log2('Downloading file "%s" to "%s" ...' % (sGstFile, sTmpFile)); 3558 # First try to remove (unlink) an existing temporary file, as we don't truncate the file. 3559 try: os.unlink(sTmpFile); 3557 Returns False on failure (unless fIgnoreErrors is set), logged. 3558 """ 3559 for asEntry in aasFiles: 3560 # Unpack: 3561 sGstFile = asEntry[0]; 3562 sHstFile = asEntry[1]; 3563 sKind = asEntry[2] if len(asEntry) > 2 and asEntry[2] else 'misc/other'; 3564 sDescription = asEntry[3] if len(asEntry) > 3 and asEntry[3] else ''; 3565 sAltName = asEntry[4] if len(asEntry) > 4 and asEntry[4] else None; 3566 assert len(asEntry) <= 5 and sGstFile and sHstFile; 3567 if not os.path.isabs(sHstFile): 3568 sHstFile = os.path.join(self.sScratchPath, sHstFile); 3569 3570 reporter.log2('Downloading file "%s" to "%s" ...' % (sGstFile, sHstFile,)); 3571 3572 try: os.unlink(sHstFile); ## @todo txsDownloadFile doesn't truncate the output file. 3560 3573 except: pass; 3561 ## @todo Check for already existing files on the host and create a new 3562 # name for the current file to download. 3563 fRc = self.txsDownloadFile(oSession, oTxsSession, sGstFile, sTmpFile, 30 * 1000, fIgnoreErrors); 3574 3575 fRc = self.txsDownloadFile(oSession, oTxsSession, sGstFile, sHstFile, 30 * 1000, fIgnoreErrors); 3564 3576 if fRc: 3565 reporter.addLogFile(sTmpFile, 'misc/other', 'guest - ' + sGstFile); 3577 if fAddToLog: 3578 reporter.addLogFile(sHstFile, sKind, sDescription, sAltName); 3566 3579 else: 3567 3580 if fIgnoreErrors is not True: 3568 reporter.error('error downloading file "%s" to "%s"' % (sGstFile, sTmpFile)); 3569 return fRc; 3581 return reporter.error('error downloading file "%s" to "%s"' % (sGstFile, sHstFile)); 3570 3582 reporter.log('warning: file "%s" was not downloaded, ignoring.' % (sGstFile,)); 3571 3583 return True; -
trunk/src/VBox/ValidationKit/tests/additions/tdAddBasic1.py
r84529 r84597 193 193 the actual test result. 194 194 """ 195 fRc = False; 196 197 if oTestVm.isWindows(): 198 self.sFileCdWait = 'VBoxWindowsAdditions.exe'; 199 elif oTestVm.isLinux(): 200 self.sFileCdWait = 'VBoxLinuxAdditions.run'; 201 202 self.logVmInfo(oVM); 203 195 # HACK ALERT! HORRIBLE MESS THAT SHOULDN'T BE HERE! 196 aasLogFiles = [ ]; 204 197 if oTestVm.isLinux(): 205 198 reporter.testStart('Enabling udev logging ...'); … … 207 200 reporter.testDone(); 208 201 if oTxsSession: 209 oTxsSession.syncExec("sed", 210 ("sed", "-i", "'s/.*udev_log.*/udev_log=\"debug\"/'", "/etc/udev/udev.conf"), 202 oTxsSession.syncExec("sed", ("sed", "-i", "'s/.*udev_log.*/udev_log=\"debug\"/'", "/etc/udev/udev.conf"), 211 203 fIgnoreErrors = True); 212 204 213 205 sUDevMonitorLog = '/tmp/udev_monitor.log'; 206 aasLogFiles.append((sUDevMonitorLog, 'guest-udev_monitor-%s.log' % (oTestVm.sVmName,),)); 214 207 215 208 reporter.testStart('Enabling udev monitoring ...'); … … 228 221 oTxsSession.syncUploadString(sUdevSvc.getvalue(), '/etc/systemd/system/systemd-udev-monitor.service', 0o644, 229 222 fIgnoreErrors = True); 230 oTxsSession.syncExec("systemctl", ("systemctl", "enable", "systemd-udev-monitor.service"), 231 fIgnoreErrors = True); 223 oTxsSession.syncExec("systemctl", ("systemctl", "enable", "systemd-udev-monitor.service"), fIgnoreErrors = True); 232 224 reporter.testDone(); 225 # HACK ALERT - END. 226 227 fRc = False; 228 229 self.logVmInfo(oVM); 230 231 if oTestVm.isWindows(): 232 self.sFileCdWait = 'VBoxWindowsAdditions.exe'; 233 elif oTestVm.isLinux(): 234 self.sFileCdWait = 'VBoxLinuxAdditions.run'; 233 235 234 236 reporter.testStart('Waiting for TXS + CD (%s)' % (self.sFileCdWait,)); … … 243 245 reporter.testDone(); 244 246 245 if oTestVm.isLinux():246 asLogFiles = [ sUDevMonitorLog ];247 self.txsDownloadFiles(oSession, oTxsSession, a sLogFiles, fIgnoreErrors = True);247 # More HACK ALERT stuff. 248 if aasLogFiles and oTxsSession: 249 self.txsDownloadFiles(oSession, oTxsSession, aasLogFiles, fIgnoreErrors = True); 248 250 249 251 if oSession is not None: … … 418 420 # deletion errors from the guest side (e.g. sharing violations) and just continue. 419 421 # 420 asLogFiles = [];421 fHaveSetupApiDevLog = False;422 422 sWinDir = self.getGuestWinDir(oTestVm); 423 asLogFiles = [ oTestVm.pathJoin(sWinDir, 'setupapi.log'), 424 oTestVm.pathJoin(sWinDir, 'setupact.log'), 425 oTestVm.pathJoin(sWinDir, 'setuperr.log') ]; 423 aasLogFiles = [ 424 ( oTestVm.pathJoin(sWinDir, 'setupapi.log'), 'ga-setupapi-%s.log' % (oTestVm.sVmName,), ), 425 ( oTestVm.pathJoin(sWinDir, 'setupact.log'), 'ga-setupact-%s.log' % (oTestVm.sVmName,), ), 426 ( oTestVm.pathJoin(sWinDir, 'setuperr.log'), 'ga-setuperr-%s.log' % (oTestVm.sVmName,), ), 427 ]; 426 428 427 429 # Apply The SetupAPI logging level so that we also get the (most verbose) setupapi.dev.log file. … … 435 437 fCheckSessionStatus = True); 436 438 437 for s File inasLogFiles:438 self.txsRmFile(oSession, oTxsSession, s File, 10 * 1000, fIgnoreErrors = True);439 for sGstFile, _ in aasLogFiles: 440 self.txsRmFile(oSession, oTxsSession, sGstFile, 10 * 1000, fIgnoreErrors = True); 439 441 440 442 # … … 447 449 448 450 # Add the Windows Guest Additions installer files to the files we want to download 449 # from the guest. 450 sGuestAddsDir = 'C:/Program Files/Oracle/VirtualBox Guest Additions/'; 451 asLogFiles.append(sGuestAddsDir + 'install.log'); 452 # Note: There won't be a install_ui.log because of the silent installation. 453 asLogFiles.append(sGuestAddsDir + 'install_drivers.log'); 454 asLogFiles.append('C:/Windows/setupapi.log'); 451 # from the guest. Note: There won't be a install_ui.log because of the silent installation. 452 sGuestAddsDir = 'C:\\Program Files\\Oracle\\VirtualBox Guest Additions\\'; 453 aasLogFiles.append((sGuestAddsDir + 'install.log', 'ga-install-%s.log' % (oTestVm.sVmName,),)); 454 aasLogFiles.append((sGuestAddsDir + 'install_drivers.log', 'ga-install_drivers-%s.log' % (oTestVm.sVmName,),)); 455 aasLogFiles.append(('C:\\Windows\\setupapi.log', 'ga-setupapi-%s.log' % (oTestVm.sVmName,),)); 455 456 456 457 # Note: setupapi.dev.log only is available since Windows 2000. 457 458 if fHaveSetupApiDevLog: 458 a sLogFiles.append('C:/Windows/setupapi.dev.log');459 aasLogFiles.append(('C:\\Windows\\setupapi.dev.log', 'ga-setupapi.dev-%s.log' % (oTestVm.sVmName,),)); 459 460 460 461 # … … 463 464 # on different Windows guests. 464 465 # 465 self.txsDownloadFiles(oSession, oTxsSession, a sLogFiles, fIgnoreErrors = True);466 self.txsDownloadFiles(oSession, oTxsSession, aasLogFiles, fIgnoreErrors = True); 466 467 467 468 # … … 494 495 495 496 def testLinuxInstallAdditions(self, oSession, oTxsSession, oTestVm): 496 _ = oSession;497 _ = oTestVm;498 499 fRc = False;500 501 497 # 502 498 # The actual install. … … 523 519 # Ignore errors as all files above might not be present for whatever reason. 524 520 # 525 asLogFile = [];526 asLogFile.append('/var/log/vboxadd-install.log');527 self.txsDownloadFiles(oSession, oTxsSession, asLogFile,fIgnoreErrors = True);521 self.txsDownloadFiles(oSession, oTxsSession, 522 [('/var/log/vboxadd-install.log', 'vboxadd-install-%s.log' % oTestVm.sName), ], 523 fIgnoreErrors = True); 528 524 529 525 # Do the final reboot to get the just installed Guest Additions up and running.
Note:
See TracChangeset
for help on using the changeset viewer.