Changeset 71549 in vbox for trunk/src/VBox/ValidationKit/tests/api
- Timestamp:
- Mar 28, 2018 4:12:59 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/api/tdMoveVM1.py
r71548 r71549 275 275 return self.oTstDrv.asRsrcs 276 276 277 def __testScenario_2(self, oSession, oMachine, sNewLoc, sOldLoc): 278 279 sController = self.dsKeys['StandardImage'] 280 aoMediumAttachments = oMachine.getMediumAttachmentsOfController(sController) 281 oSubTstDrvMoveMedium1Instance = SubTstDrvMoveMedium1(self.oTstDrv) 282 oSubTstDrvMoveMedium1Instance.setLocation(sOldLoc, aoMediumAttachments) 283 284 del oSubTstDrvMoveMedium1Instance 285 286 dsReferenceFiles = defaultdict(set) 287 288 for s in self.asImagesNames: 289 reporter.log('"%s"' % (s,)) 290 dsReferenceFiles['StandardImage'].add(sNewLoc + os.sep + oMachine.name + os.sep + s) 291 292 sSettingFile = os.path.join(sNewLoc, os.path.join(oMachine.name, oMachine.name + '.vbox')) 293 dsReferenceFiles['SettingsFile'].add(sSettingFile) 294 295 fRc = self.moveVMToLocation(sNewLoc, oSession.o.machine) 296 297 if fRc is True: 298 fRc = self.checkLocation(oSession.o.machine, dsReferenceFiles) 299 if fRc is False: 300 reporter.testFailure('!!!!!!!!!!!!!!!!!! 2nd scenario: Check locations failed... !!!!!!!!!!!!!!!!!!') 301 else: 302 reporter.testFailure('!!!!!!!!!!!!!!!!!! 2nd scenario: Move VM failed... !!!!!!!!!!!!!!!!!!') 303 304 fRes = oSession.saveSettings() 305 if fRes is False: 306 reporter.log('2nd scenario: Couldn\'t save machine settings') 307 308 return fRc 309 310 def __testScenario_3(self, oSession, oMachine, sNewLoc): 311 312 #At moment, it's used only one snapshot due to the difficulty to get 313 #all attachments of the machine (i.e. not only attached at moment) 314 cSnap = 1 315 316 for counter in range(1,cSnap+1): 317 strSnapshot = 'Snapshot' + str(counter) 318 fRc = oSession.takeSnapshot(strSnapshot) 319 if fRc is False: 320 reporter.testFailure('3rd scenario: Can\'t take snapshot "%s"' % (strSnapshot,)) 321 322 dsReferenceFiles = defaultdict(set) 323 324 sController = self.dsKeys['StandardImage'] 325 aoMediumAttachments = oMachine.getMediumAttachmentsOfController(sController) 326 if fRc is True: 327 for oAttachment in aoMediumAttachments: 328 sRes = oAttachment.medium.location.rpartition(os.sep) 329 dsReferenceFiles['SnapshotFile'].add(sNewLoc + os.sep + oMachine.name + os.sep + 330 'Snapshots' + os.sep + sRes[2]) 331 332 sSettingFile = os.path.join(sNewLoc, os.path.join(oMachine.name, oMachine.name + '.vbox')) 333 dsReferenceFiles['SettingsFile'].add(sSettingFile) 334 335 fRc = self.moveVMToLocation(sNewLoc, oSession.o.machine) 336 337 if fRc is True: 338 fRc = self.checkLocation(oSession.o.machine, dsReferenceFiles) 339 if fRc is False: 340 reporter.testFailure('!!!!!!!!!!!!!!!!!! 3rd scenario: Check locations failed... !!!!!!!!!!!!!!!!!!') 341 else: 342 reporter.testFailure('!!!!!!!!!!!!!!!!!! 3rd scenario: Move VM failed... !!!!!!!!!!!!!!!!!!') 343 344 fRes = oSession.saveSettings() 345 if fRes is False: 346 reporter.log('3d scenario: Couldn\'t save machine settings') 347 348 return fRc 349 277 350 def __testScenario_4(self, oMachine, sNewLoc): 278 351 … … 538 611 sNewLoc = os.path.join(sOrigLoc, 'moveFolder_2d_scenario') 539 612 os.mkdir(sNewLoc, 0o775) 540 sController = self.dsKeys['StandardImage'] 541 aoMediumAttachments = oMachine.getMediumAttachmentsOfController(sController) 542 oSubTstDrvMoveMedium1Instance = SubTstDrvMoveMedium1(self.oTstDrv) 543 oSubTstDrvMoveMedium1Instance.setLocation(sOldLoc, aoMediumAttachments) 544 545 del oSubTstDrvMoveMedium1Instance 546 547 #always clear before each scenario 548 dsReferenceFiles.clear() 549 550 for s in self.asImagesNames: 551 reporter.log('"%s"' % (s,)) 552 dsReferenceFiles['StandardImage'].add(sNewLoc + os.sep + oMachine.name + os.sep + s) 553 554 sSettingFile = os.path.join(sNewLoc, os.path.join(oMachine.name, oMachine.name + '.vbox')) 555 dsReferenceFiles['SettingsFile'].add(sSettingFile) 556 557 fRc = self.moveVMToLocation(sNewLoc, oSession.o.machine) 558 559 if fRc is True: 560 fRc = self.checkLocation(oSession.o.machine, dsReferenceFiles) 561 if fRc is False: 562 reporter.testFailure('!!!!!!!!!!!!!!!!!! 2nd scenario: Check locations failed... !!!!!!!!!!!!!!!!!!') 563 return reporter.testDone()[1] == 0 564 else: 565 reporter.testFailure('!!!!!!!!!!!!!!!!!! 2nd scenario: Move VM failed... !!!!!!!!!!!!!!!!!!') 613 614 fRc = self.__testScenario_2(oSession, oMachine, sNewLoc, sOldLoc) 615 if fRc is False: 566 616 return reporter.testDone()[1] == 0 567 568 fRc = oSession.saveSettings()569 if fRc is False:570 reporter.testFailure('2nd scenario: Couldn\'t save machine settings')571 617 572 618 ############# 3 case. ########################################################################################## … … 576 622 os.mkdir(sNewLoc, 0o775) 577 623 578 #At moment, it's used only one snapshot due to the difficulty to get 579 #all attachments of the machine (i.e. not only attached at moment) 580 cSnap = 1 581 582 for counter in range(1,cSnap+1): 583 strSnapshot = 'Snapshot' + str(counter) 584 fRc = fRc and oSession.takeSnapshot(strSnapshot) 585 if fRc is False: 586 reporter.testFailure('3rd scenario: Can\'t take snapshot "%s"' % (strSnapshot,)) 587 return reporter.testDone()[1] == 0 588 589 #always clear before each scenario 590 dsReferenceFiles.clear() 591 592 sController = self.dsKeys['StandardImage'] 593 aoMediumAttachments = oMachine.getMediumAttachmentsOfController(sController) 594 if fRc is True: 595 for oAttachment in aoMediumAttachments: 596 sRes = oAttachment.medium.location.rpartition(os.sep) 597 dsReferenceFiles['SnapshotFile'].add(sNewLoc + os.sep + oMachine.name + os.sep + 598 'Snapshots' + os.sep + sRes[2]) 599 600 sSettingFile = os.path.join(sNewLoc, os.path.join(oMachine.name, oMachine.name + '.vbox')) 601 dsReferenceFiles['SettingsFile'].add(sSettingFile) 602 603 fRc = self.moveVMToLocation(sNewLoc, oSession.o.machine) 604 605 if fRc is True: 606 fRc = self.checkLocation(oSession.o.machine, dsReferenceFiles) 607 if fRc is False: 608 reporter.testFailure('!!!!!!!!!!!!!!!!!! 3rd scenario: Check locations failed... !!!!!!!!!!!!!!!!!!') 609 return reporter.testDone()[1] == 0 610 else: 611 reporter.testFailure('!!!!!!!!!!!!!!!!!! 3rd scenario: Move VM failed... !!!!!!!!!!!!!!!!!!') 624 fRc = self.__testScenario_3(oSession, oMachine, sNewLoc) 625 if fRc is False: 612 626 return reporter.testDone()[1] == 0 613 614 fRc = oSession.saveSettings()615 if fRc is False:616 reporter.testFailure('3d scenario: Couldn\'t save machine settings')617 627 618 628 ############# 4 case. ##########################################################################################
Note:
See TracChangeset
for help on using the changeset viewer.