Changeset 78460 in vbox for trunk/src/VBox/ValidationKit/tests/api
- Timestamp:
- May 10, 2019 2:27:02 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 130489
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/api/tdMoveVM1.py
r77777 r78460 81 81 """ 82 82 reporter.log('ValidationKit folder is "%s"' % (g_ksValidationKitDir,)) 83 return 83 return self.testVMMove() 84 84 85 85 # … … 244 244 return self.oTstDrv.fpApiVer >= 5.3; 245 245 246 @staticmethod 247 def __safeListDir(sDir): 248 """ Wrapper around os.listdir that returns empty array instead of exceptions. """ 249 try: 250 return os.listdir(sDir); 251 except: 252 return []; 253 246 254 def __getStatesFiles(self, oMachine, fPrint = False): 247 255 asStateFilesList = set() 248 256 sFolder = oMachine.snapshotFolder 249 for sFile in os.listdir(sFolder):257 for sFile in self.__safeListDir(sFolder): 250 258 if sFile.endswith(".sav"): 251 259 sFullPath = os.path.join(sFolder, sFile) … … 258 266 asSnapshotsFilesList = set() 259 267 sFolder = oMachine.snapshotFolder 260 for sFile in os.listdir(sFolder):268 for sFile in self.__safeListDir(sFolder): 261 269 if sFile.endswith(".sav") is False: 262 270 sFullPath = os.path.join(sFolder, sFile) … … 269 277 asLogFilesList = set() 270 278 sFolder = oMachine.logFolder 271 for sFile in os.listdir(sFolder):279 for sFile in self.__safeListDir(sFolder): 272 280 if sFile.endswith(".log"): 273 281 sFullPath = os.path.join(sFolder, sFile) … … 354 362 fRes = oSession.saveSettings() 355 363 if fRes is False: 356 reporter.log('3 d scenario: Couldn\'t save machine settings')364 reporter.log('3rd scenario: Couldn\'t save machine settings') 357 365 358 366 return fRc … … 587 595 # 7. There are shareable disk and immutable disk attached to the VM. 588 596 589 try: 597 try: ## @todo r=bird: Would be nice to use sub-tests here for each scenario, however 598 ## this try/catch as well as lots of return points makes that very hard. 599 ## Big try/catch stuff like this should be avoided. 590 600 # Create test machine. 591 601 oMachine = self.createTestMachine() … … 614 624 # In this case only VM setting file should be moved (.vbox file) 615 625 # 626 reporter.log("Scenario #1:"); 616 627 for s in self.asImagesNames: 617 628 reporter.log('"%s"' % (s,)) … … 642 653 # There are no any snapshots and logs. 643 654 # 655 reporter.log("Scenario #2:"); 644 656 sOldLoc = sNewLoc + oMachine.name + os.sep 645 sNewLoc = os.path.join(sOrigLoc, 'moveFolder_2 d_scenario')657 sNewLoc = os.path.join(sOrigLoc, 'moveFolder_2nd_scenario') 646 658 os.mkdir(sNewLoc, 0o775) 647 659 … … 655 667 # There are snapshots. 656 668 # 669 reporter.log("Scenario #3:"); 657 670 sOldLoc = sNewLoc + oMachine.name + os.sep 658 sNewLoc = os.path.join(sOrigLoc, 'moveFolder_3 d_scenario')671 sNewLoc = os.path.join(sOrigLoc, 'moveFolder_3rd_scenario') 659 672 os.mkdir(sNewLoc, 0o775) 660 673 … … 671 684 # And next move VM 672 685 # 686 reporter.log("Scenario #4:"); 673 687 sOldLoc = sNewLoc + oMachine.name + os.sep 674 688 sNewLoc = os.path.join(sOrigLoc, 'moveFolder_4th_scenario') … … 692 706 # Prerequisites - there is IDE Controller and there are no any images attached to it. 693 707 # 708 reporter.log("Scenario #5:"); 694 709 sOldLoc = sNewLoc + os.sep + oMachine.name 695 710 sNewLoc = os.path.join(sOrigLoc, 'moveFolder_5th_scenario') … … 705 720 # Prerequisites - there is Floppy Controller and there are no any images attached to it. 706 721 # 722 reporter.log("Scenario #6:"); 707 723 sOldLoc = sNewLoc + os.sep + oMachine.name 708 724 sNewLoc = os.path.join(sOrigLoc, 'moveFolder_6th_scenario') … … 712 728 return reporter.testDone()[1] == 0 713 729 714 # # 715 # # 7. case: 716 # # 717 # # There are shareable disk and immutable disk attached to the VM. 718 # # 719 # fRc = fRc and oSession.saveSettings() 720 # if fRc is False: 721 # reporter.log('Couldn\'t save machine settings') 730 # # 731 # # 7. case: 732 # # 733 # # There are shareable disk and immutable disk attached to the VM. 734 # # 735 # reporter.log("Scenario #7:"); 736 # fRc = fRc and oSession.saveSettings() 737 # if fRc is False: 738 # reporter.log('Couldn\'t save machine settings') 722 739 # 723 740
Note:
See TracChangeset
for help on using the changeset viewer.