VirtualBox

Changeset 71457 in vbox for trunk/src


Ignore:
Timestamp:
Mar 22, 2018 2:17:46 PM (7 years ago)
Author:
vboxsync
Message:

bugref:8345. The test scenarios 5 and 6 have been unlocked. The reference ISO and floppy images are gotten from the folder testsrc/5.3 on the machine teststor.de.oracle.com

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/tests/api/tdMoveVM1.py

    r71411 r71457  
    3434import sys
    3535import time
     36import shutil
    3637
    3738# Only the main script needs to modify the path.
     
    5556    def __init__(self, oTstDrv):
    5657        base.SubTestDriverBase.__init__(self, 'move-vm', oTstDrv)
     58        self.asRsrcs = self.getResourceSet()
     59
     60        for oRes in self.asRsrcs:
     61            reporter.log('Resource is "%s"' % (oRes,))
    5762
    5863    def testIt(self):
     
    113118            oVM = None
    114119
    115 #       del oSession
    116 
    117120        return oVM
    118121
     
    166169        return False
    167170
     171    def getResourceSet(self):
     172        # Construct the resource list the first time it's queried.
     173        if self.oTstDrv.asRsrcs is None:
     174            self.oTstDrv.asRsrcs = []
     175            self.oTstDrv.asRsrcs.append('5.3/isos/tdMoveVM.iso')
     176            self.oTstDrv.asRsrcs.append('5.3/floppy/tdMoveVM.img')
     177
     178        return self.oTstDrv.asRsrcs
     179
    168180    #
    169181    #testVMMove
     
    236248            fRc = fRc and oSession.saveSettings()
    237249            if fRc is False:
    238                 reporter.log('Couldn\'t save machine settings')
     250                reporter.log('Couldn\'t save machine settings after 1t scenario')
    239251
    240252############# 2 case. ##########################################################################################
     
    254266            fRc = fRc and oSession.saveSettings()
    255267            if fRc is False:
    256                 reporter.log('Couldn\'t save machine settings')
     268                reporter.log('Couldn\'t save machine settings after 2nd scenario')
    257269
    258270############# 3 case. ##########################################################################################
     
    276288            fRc = fRc and oSession.saveSettings()
    277289            if fRc is False:
    278                 reporter.log('Couldn\'t save machine settings')
     290                reporter.log('Couldn\'t save machine settings after 3d scenario')
    279291
    280292############# 4 case. ##########################################################################################
     
    320332            #There is an ISO image (.iso) attached to the VM.
    321333            #Prerequisites - there is IDE Controller and there are no any images attached to it.
    322 #           fRc = True
    323 #           oVirtualBox = self.oTstDrv.oVBoxMgr.getVirtualBox()
    324 #           oMachine = oVirtualBox.findMachine('test-vm-move')
    325 #           if oMachine == None:
    326 #               reporter.log("Machine '%s' is unknown" % (oMachine.name))
    327 #               return False
    328 #
    329 #           del oVirtualBox
    330 #
    331 #           sLoc = sMoveLoc + os.sep + oMachine.name + os.sep
    332 #           sMoveLoc = os.path.join(sOrigLoc, 'moveFolder_5th_scenario')
    333 #           os.mkdir(sMoveLoc, 0o775)
    334 #           sISOLoc = os.path.join(g_ksValidationKitDir + os.sep, 'tests' + os.sep + 'api' + os.sep + 'tdMoveVM.iso')
    335 #           if not os.path.exists(sISOLoc):
    336 #               reporter.log('ISO file does not exist at "%s"' % (sISOLoc,))
    337 #               fRc = False
    338 #
    339 #           #attach ISO image to the IDE controller
    340 #           if fRc is True:
    341 #               sController='IDE Controller'
    342 #               aoMediumAttachments = oMachine.getMediumAttachmentsOfController(sController)
    343 #               iPort = len(aoMediumAttachments)
    344 #               reporter.log('sISOLoc "%s", sController "%s", iPort "%s"' % (sISOLoc,sController,iPort))
    345 #               fRc = oSession.attachDvd(sISOLoc, sController, iPort, iDevice = 0)
    346 #
    347 #           fRc = fRc and oSession.saveSettings()
    348 #           if fRc is False:
    349 #               reporter.log('Couldn\'t save machine settings')
    350 #
    351 #           reporter.log('fRc after oSession.attachDvd "%s"' % (fRc))
    352 #
    353 #           #move ISO image to the VM settings folder
    354 #           if fRc is True:
    355 #               aoMediumAttachments = oMachine.getMediumAttachmentsOfController(sController)
    356 #               reporter.log('number of attachments on IDE Controller is "%s"' % (len(aoMediumAttachments)))
    357 #               for oAttachment in aoMediumAttachments:
    358 #                   sActualFilePath = oAttachment.medium.location
    359 #                   reporter.log('medium location is "%s"' % (sActualFilePath))
    360 #
    361 #               oSubTstDrvMoveMedium1Instance = SubTstDrvMoveMedium1(self.oTstDrv)
    362 #               oSubTstDrvMoveMedium1Instance.setLocation(sLoc, aoMediumAttachments)
    363 #
    364 #           if fRc is True:
    365 #               fRc = self.moveVMToLocation(sMoveLoc, oSession.o.machine) and fRc
    366 #
    367 #           fRc = fRc and oSession.saveSettings()
    368 #           if fRc is False:
    369 #               reporter.log('Couldn\'t save machine settings')
    370 #
    371 #           #back ISO image to the original destination
    372 #           aoMediumAttachments = oMachine.getMediumAttachmentsOfController(sController)
    373 #           oSubTstDrvMoveMedium1Instance.setLocation(sActualFilePath, aoMediumAttachments)
    374 #           del oSubTstDrvMoveMedium1Instance
    375 #
    376 #           #detach ISO image
    377 #           fRc = oSession.detachHd(sController, iPort, 0)
    378 #
    379 #           fRc = fRc and oSession.saveSettings()
    380 #           if fRc is False:
    381 #               reporter.log('Couldn\'t save machine settings')
     334            fRc = True
     335            oVirtualBox = self.oTstDrv.oVBoxMgr.getVirtualBox()
     336            oMachine = oVirtualBox.findMachine('test-vm-move')
     337            if oMachine == None:
     338                reporter.log("Machine '%s' is unknown" % (oMachine.name))
     339                return False
     340
     341            del oVirtualBox
     342
     343            sLoc = sMoveLoc + os.sep + oMachine.name + os.sep
     344            sMoveLoc = os.path.join(sOrigLoc, 'moveFolder_5th_scenario')
     345            os.mkdir(sMoveLoc, 0o775)
     346            sISOLoc = '5.3/isos/tdMoveVM1.iso'
     347            reporter.log("sHost is '%s', sResourcePath is '%s'" % (self.oTstDrv.sHost, self.oTstDrv.sResourcePath))
     348            sISOLoc = self.oTstDrv.getFullResourceName(sISOLoc)
     349
     350            if not os.path.exists(sISOLoc):
     351                reporter.log('ISO file does not exist at "%s"' % (sISOLoc,))
     352                fRc = False
     353
     354            #Copy ISO image from the common resource folder into machine folder
     355            shutil.copy(sISOLoc, sLoc)
     356
     357            #attach ISO image to the IDE controller
     358            if fRc is True:
     359                #set actual ISO location
     360                sISOLoc = sLoc + os.sep + 'tdMoveVM1.iso'
     361                sController='IDE Controller'
     362                aoMediumAttachments = oMachine.getMediumAttachmentsOfController(sController)
     363                iPort = len(aoMediumAttachments)
     364                reporter.log('sISOLoc "%s", sController "%s", iPort "%s"' % (sISOLoc,sController,iPort))
     365                fRc = oSession.attachDvd(sISOLoc, sController, iPort, iDevice = 0)
     366
     367            if fRc is True:
     368                fRc = self.moveVMToLocation(sMoveLoc, oSession.o.machine) and fRc
     369
     370            #detach ISO image
     371            fRc = oSession.detachHd(sController, iPort, 0)
     372
     373            fRc = fRc and oSession.saveSettings()
     374            if fRc is False:
     375                reporter.log('Couldn\'t save machine settings after 5th scenario')
    382376
    383377############# 6 case. ##########################################################################################
    384378            #There is a floppy image (.img) attached to the VM.
    385379            #Prerequisites - there is Floppy Controller and there are no any images attached to it.
    386 #           fRc = True
    387 #           sLoc = sMoveLoc + os.sep + oMachine.name + os.sep
    388 #           sMoveLoc = os.path.join(sOrigLoc, 'moveFolder_6th_scenario')
    389 #           os.mkdir(sMoveLoc, 0o775)
    390 #           sFloppyLoc = os.path.join(g_ksValidationKitDir + os.sep, 'tests' + os.sep + 'api' + os.sep + 'tdMoveVM.img')
    391 #           if not os.path.exists(sISOLoc):
    392 #               reporter.log('Floppy disk does not exist at "%s"' % (sISOLoc,))
    393 #               fRc = False
    394 #
    395 #           # attach floppy image
    396 #           if fRc is True:
    397 #               sController='Floppy Controller'
    398 #               reporter.log('sFloppyLoc "%s", sController "%s"' % (sFloppyLoc,sController))
    399 #               fRc = fRc and oSession.attachFloppy(sFloppyLoc, sController, 0, 0)
    400 #
    401 #           fRc = fRc and oSession.saveSettings()
    402 #           if fRc is False:
    403 #               reporter.log('Couldn\'t save machine settings')
    404 #
    405 #           reporter.log('fRc after oSession.attachFloppy "%s"' % (fRc))
    406 #
    407 #           #move Floppy image to the VM settings folder
    408 #           if fRc is True:
    409 #               aoMediumAttachments = oMachine.getMediumAttachmentsOfController(sController)
    410 #               reporter.log('number of attachments on Floppy Controller is "%s"' % (len(aoMediumAttachments)))
    411 #               for oAttachment in aoMediumAttachments:
    412 #                   sActualFilePath = oAttachment.medium.location
    413 #                   reporter.log('medium location is "%s"' % (sActualFilePath))
    414 #
    415 #               oSubTstDrvMoveMedium1Instance = SubTstDrvMoveMedium1(self.oTstDrv)
    416 #               oSubTstDrvMoveMedium1Instance.setLocation(sLoc, aoMediumAttachments)
    417 #
    418 #           if fRc is True:
    419 #               fRc = self.moveVMToLocation(sMoveLoc, oSession.o.machine) and fRc
    420 #
    421 #           #back Floppy image to the original destination
    422 #           aoMediumAttachments = oMachine.getMediumAttachmentsOfController(sController)
    423 #           oSubTstDrvMoveMedium1Instance.setLocation(sActualFilePath, aoMediumAttachments)
    424 #           del oSubTstDrvMoveMedium1Instance
    425 #
    426 #           #detach Floppy image
    427 #           fRc = oSession.detachHd(sController, 0, 0)
    428 #
    429 #           fRc = fRc and oSession.saveSettings()
    430 #           if fRc is False:
    431 #               reporter.log('Couldn\'t save machine settings')
    432 #
     380            fRc = True
     381            sLoc = sMoveLoc + os.sep + oMachine.name + os.sep
     382            sMoveLoc = os.path.join(sOrigLoc, 'moveFolder_6th_scenario')
     383            os.mkdir(sMoveLoc, 0o775)
     384            sFloppyLoc = '5.3/floppy/tdMoveVM1.img'
     385            sFloppyLoc = self.oTstDrv.getFullResourceName(sFloppyLoc)
     386
     387            if not os.path.exists(sFloppyLoc):
     388                reporter.log('Floppy disk does not exist at "%s"' % (sFloppyLoc,))
     389                fRc = False
     390
     391            #Copy floppy image from the common resource folder into machine folder
     392            shutil.copy(sFloppyLoc, sLoc)
     393
     394            # attach floppy image
     395            if fRc is True:
     396                #set actual floppy location
     397                sFloppyLoc = sLoc + os.sep + 'tdMoveVM1.img'
     398                sController='Floppy Controller'
     399                reporter.log('sFloppyLoc "%s", sController "%s"' % (sFloppyLoc,sController))
     400                fRc = fRc and oSession.attachFloppy(sFloppyLoc, sController, 0, 0)
     401
     402            if fRc is True:
     403                fRc = self.moveVMToLocation(sMoveLoc, oSession.o.machine) and fRc
     404
     405            #detach floppy image
     406            fRc = oSession.detachHd(sController, 0, 0)
     407
     408            fRc = fRc and oSession.saveSettings()
     409            if fRc is False:
     410                reporter.log('Couldn\'t save machine settings after 6th scenario')
     411
    433412############# 7 case. ##########################################################################################
    434413#           #   There are shareable disk and immutable disk attached to the VM.
     
    439418#               reporter.log('Couldn\'t save machine settings')
    440419#
    441 ############# 8 case. ##########################################################################################
    442 #           #   There is "read-only" disk attached to the VM.
    443 #           #
    444 #
    445 #           fRc = fRc and oSession.saveSettings()
    446 #           if fRc is False:
    447 #               reporter.log('Couldn\'t save machine settings')
    448 
    449420
    450421            fRc = oSession.close() and fRc
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette