VirtualBox

Changeset 85464 in vbox for trunk


Ignore:
Timestamp:
Jul 27, 2020 9:32:26 AM (4 years ago)
Author:
vboxsync
Message:

ValidationKit/tdMoveVm1: Fix testcase on Windows where file paths are case insensitive (only meant as a workaround until the original author of the testcase finds time to fix it properly)

File:
1 edited

Legend:

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

    r82968 r85464  
    5151
    5252
     53# @todo r=aeichner: The whole path handling/checking needs fixing to also work on Windows
     54#                   The current quick workaround is to spill os.path.normcase() all over the place when
     55#                   constructing paths. I'll leave the real fix to the original author...
    5356class SubTstDrvMoveVm1(base.SubTestDriverBase):
    5457    """
     
    198201                    aoMediumAttachments = oMachine.getMediumAttachmentsOfController(sValue) ##@todo r=bird: API call, try-except!
    199202                    for oAttachment in aoMediumAttachments:
    200                         aActuals.add(oAttachment.medium.location)
     203                        aActuals.add(os.path.normcase(oAttachment.medium.location))
    201204
    202205            elif sKey == 'SnapshotFile':
     
    209212                aReferences = dsReferenceFiles[sKey]
    210213                if aReferences:
    211                     aActuals.add(oMachine.settingsFilePath)
     214                    aActuals.add(os.path.normcase(oMachine.settingsFilePath))
    212215
    213216            # Check saved state files location
     
    234237
    235238                reporter.log('####### Reference locations: #######')
    236                 for eachItem in aReferences:
     239                for eachItem in aActuals:
    237240                    reporter.log(' "%s"' % (eachItem))
    238241
     
    256259    def __getStatesFiles(self, oMachine, fPrint = False):
    257260        asStateFilesList = set()
    258         sFolder = oMachine.snapshotFolder
     261        sFolder = oMachine.snapshotFolder;
    259262        for sFile in self.__safeListDir(sFolder):
    260263            if sFile.endswith(".sav"):
    261                 sFullPath = os.path.join(sFolder, sFile)
     264                sFullPath = os.path.normcase(os.path.join(sFolder, sFile));
    262265                asStateFilesList.add(sFullPath)
    263266                if fPrint is True:
     
    270273        for sFile in self.__safeListDir(sFolder):
    271274            if sFile.endswith(".sav") is False:
    272                 sFullPath = os.path.join(sFolder, sFile)
     275                sFullPath = os.path.normcase(os.path.join(sFolder, sFile));
    273276                asSnapshotsFilesList.add(sFullPath)
    274277                if fPrint is True:
     
    281284        for sFile in self.__safeListDir(sFolder):
    282285            if sFile.endswith(".log"):
    283                 sFullPath = os.path.join(sFolder, sFile)
     286                sFullPath = os.path.normcase(os.path.join(sFolder, sFile));
    284287                asLogFilesList.add(sFullPath)
    285288                if fPrint is True:
     
    305308        for s in self.asImagesNames:
    306309            reporter.log('"%s"' % (s,))
    307             dsReferenceFiles['StandardImage'].add(sNewLoc + os.sep + oMachine.name + os.sep + s)
     310            dsReferenceFiles['StandardImage'].add(os.path.normcase(sNewLoc + os.sep + oMachine.name + os.sep + s))
    308311
    309312        sSettingFile = os.path.join(sNewLoc, os.path.join(oMachine.name, oMachine.name + '.vbox'))
    310         dsReferenceFiles['SettingsFile'].add(sSettingFile)
     313        dsReferenceFiles['SettingsFile'].add(os.path.normcase(sSettingFile))
    311314
    312315        fRc = self.moveVMToLocation(sNewLoc, oSession.o.machine)
     
    347350            for oAttachment in aoMediumAttachments:
    348351                sRes = oAttachment.medium.location.rpartition(os.sep)
    349                 dsReferenceFiles['SnapshotFile'].add(sNewLoc + os.sep + oMachine.name + os.sep +
    350                                                      'Snapshots' + os.sep + sRes[2])
     352                dsReferenceFiles['SnapshotFile'].add(os.path.normcase(sNewLoc + os.sep + oMachine.name + os.sep +
     353                                                     'Snapshots' + os.sep + sRes[2]))
    351354
    352355            sSettingFile = os.path.join(sNewLoc, os.path.join(oMachine.name, oMachine.name + '.vbox'))
    353             dsReferenceFiles['SettingsFile'].add(sSettingFile)
     356            dsReferenceFiles['SettingsFile'].add(os.path.normcase(sSettingFile))
    354357
    355358            fRc = self.moveVMToLocation(sNewLoc, oSession.o.machine)
     
    403406            for sFile in asLogs:
    404407                sRes = sFile.rpartition(os.sep)
    405                 dsReferenceFiles['LogFile'].add(sNewLoc + os.sep + oMachine.name + os.sep + 'Logs' + os.sep + sRes[2])
     408                dsReferenceFiles['LogFile'].add(os.path.normcase(sNewLoc + os.sep + oMachine.name + os.sep +
     409                                                'Logs' + os.sep + sRes[2]))
    406410
    407411            asStates = self.__getStatesFiles(oMachine)
    408412            for sFile in asStates:
    409413                sRes = sFile.rpartition(os.sep)
    410                 dsReferenceFiles['SavedStateFile'].add(sNewLoc + os.sep + oMachine.name + os.sep + 'Snapshots' + os.sep + sRes[2])
     414                dsReferenceFiles['SavedStateFile'].add(os.path.normcase(sNewLoc + os.sep + oMachine.name + os.sep +
     415                                                       'Snapshots' + os.sep + sRes[2]))
    411416
    412417            fRc = self.moveVMToLocation(sNewLoc, oSession.o.machine)
     
    472477            iPort = len(aoMediumAttachments)
    473478            fRc = oSession.attachDvd(sISOLoc, sController, iPort, iDevice = 0)
    474             dsReferenceFiles['ISOImage'].add(os.path.join(os.path.join(sNewLoc, oMachine.name), sISOImageName))
     479            dsReferenceFiles['ISOImage'].add(os.path.normcase(os.path.join(os.path.join(sNewLoc, oMachine.name), sISOImageName)))
    475480
    476481        if fRc is True:
     
    532537            sController=self.dsKeys['FloppyImage']
    533538            fRc = fRc and oSession.attachFloppy(sFloppyLoc, sController, 0, 0)
    534             dsReferenceFiles['FloppyImage'].add(os.path.join(os.path.join(sNewLoc, oMachine.name), sFloppyImageName))
     539            dsReferenceFiles['FloppyImage'].add(os.path.normcase(os.path.join(os.path.join(sNewLoc, oMachine.name), sFloppyImageName)))
    535540
    536541        if fRc is True:
     
    626631            for s in self.asImagesNames:
    627632                reporter.log('"%s"' % (s,))
    628                 dsReferenceFiles['StandardImage'].add(os.path.join(sOrigLoc, s))
    629 
    630             sSettingFile = os.path.join(sNewLoc, os.path.join(oMachine.name, oMachine.name + '.vbox'))
     633                dsReferenceFiles['StandardImage'].add(os.path.normcase(os.path.join(sOrigLoc, s)))
     634
     635            sSettingFile = os.path.normcase(os.path.join(sNewLoc, os.path.join(oMachine.name, oMachine.name + '.vbox')))
    631636            dsReferenceFiles['SettingsFile'].add(sSettingFile)
    632637
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