VirtualBox

Ignore:
Timestamp:
Nov 16, 2022 10:20:06 AM (2 years ago)
Author:
vboxsync
Message:

Validation Kit/Guest Control: Make sure (test) if the test VM's (guessed) path separator matches the (known) Guest Control guest path separator + use it for guest destination paths.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py

    r97537 r97565  
    144144
    145145        try:
    146             self.oGuest = oSession.o.console.guest;
     146            self.oGuest  = oSession.o.console.guest;
     147            self.oTestVm = oTestVm;
    147148        except:
    148149            reporter.errorXcpt();
     
    150151        if self.oCreds is None:
    151152            self.oCreds = tdCtxCreds();
    152         self.oCreds.applyDefaultsIfNotSet(oTestVm);
     153        self.oCreds.applyDefaultsIfNotSet(self.oTestVm);
    153154
    154155        return True;
     
    217218                        return (False, None);
    218219                    reporter.log('Session "%s" successfully started' % (sName,));
     220
     221                    #
     222                    # Make sure that the test VM configuration and Guest Control use the same path separator style for the guest.
     223                    #
     224                    sGstSep = '\\' if self.oGuestSession.pathStyle is vboxcon.PathStyle_DOS else '/';
     225                    if self.oTestVm.pathSep() != sGstSep:
     226                        reporter.error('Configured test VM uses a different path style (%s) than Guest Control (%s)' \
     227                                       % (self.oTestVm.pathSep(), sGstSep));
    219228                    break;
    220229                except:
     
    48504859            atTests.extend([
    48514860                # Should succeed, as the file isn't there yet on the destination.
    4852                 [ tdTestCopyToFile(sSrc = sBigFileHst,   sDst = sScratchGst + os.path.sep), tdTestResultSuccess() ],
     4861                [ tdTestCopyToFile(sSrc = sBigFileHst,   sDst = sScratchGst + oTestVm.pathSep()), tdTestResultSuccess() ],
    48534862                # Overwrite the existing file.
    4854                 [ tdTestCopyToFile(sSrc = sBigFileHst,   sDst = sScratchGst + os.path.sep), tdTestResultSuccess() ],
     4863                [ tdTestCopyToFile(sSrc = sBigFileHst,   sDst = sScratchGst + oTestVm.pathSep()), tdTestResultSuccess() ],
    48554864                # Same file, but with a different name on the destination.
    48564865                [ tdTestCopyToFile(sSrc = sEmptyFileHst, sDst = oTestVm.pathJoin(sScratchGst, os.path.split(sBigFileHst)[1])),
     
    48844893                # With a trailing slash added to the destination, copy the empty guest directory
    48854894                # (should end up as sScratchDstDir2Gst/empty):
    4886                 [ tdTestCopyToDir(sSrc = sScratchEmptyDirHst, sDst = sScratchDstDir2Gst + os.path.sep), tdTestResultSuccess() ],
     4895                [ tdTestCopyToDir(sSrc = sScratchEmptyDirHst, sDst = sScratchDstDir2Gst + oTestVm.pathSep()),
     4896                  tdTestResultSuccess() ],
    48874897                # Repeat -- this time it should fail, as the destination directory already exists (and
    48884898                # DirectoryCopyFlag_CopyIntoExisting is not specified):
    4889                 [ tdTestCopyToDir(sSrc = sScratchEmptyDirHst, sDst = sScratchDstDir2Gst + os.path.sep), tdTestResultFailure() ],
     4899                [ tdTestCopyToDir(sSrc = sScratchEmptyDirHst, sDst = sScratchDstDir2Gst + oTestVm.pathSep()),
     4900                  tdTestResultFailure() ],
    48904901                # Add the DirectoryCopyFlag_CopyIntoExisting flag being set and it should work (again).
    4891                 [ tdTestCopyToDir(sSrc = sScratchEmptyDirHst, sDst = sScratchDstDir2Gst + os.path.sep,
     4902                [ tdTestCopyToDir(sSrc = sScratchEmptyDirHst, sDst = sScratchDstDir2Gst + oTestVm.pathSep(),
    48924903                                  afFlags = [ vboxcon.DirectoryCopyFlag_CopyIntoExisting, ]), tdTestResultSuccess() ],
    48934904                # Copy with a different destination name just for the heck of it:
     
    49054916            atTests.extend([
    49064917                # Copy the entire test tree:
    4907                 [ tdTestCopyToDir(sSrc = sScratchTreeDirHst, sDst = sScratchDstDir4Gst + os.path.sep), tdTestResultSuccess() ],
     4918                [ tdTestCopyToDir(sSrc = sScratchTreeDirHst, sDst = sScratchDstDir4Gst + oTestVm.pathSep()), tdTestResultSuccess() ],
    49084919                # Again, should fail this time.
    4909                 [ tdTestCopyToDir(sSrc = sScratchTreeDirHst, sDst = sScratchDstDir4Gst + os.path.sep), tdTestResultFailure() ],
     4920                [ tdTestCopyToDir(sSrc = sScratchTreeDirHst, sDst = sScratchDstDir4Gst + oTestVm.pathSep()), tdTestResultFailure() ],
    49104921                # Works again, as DirectoryCopyFlag_CopyIntoExisting is specified.
    4911                 [ tdTestCopyToDir(sSrc = sScratchTreeDirHst, sDst = sScratchDstDir4Gst + os.path.sep,
     4922                [ tdTestCopyToDir(sSrc = sScratchTreeDirHst, sDst = sScratchDstDir4Gst + oTestVm.pathSep(),
    49124923                                  afFlags = [ vboxcon.DirectoryCopyFlag_CopyIntoExisting, ]), tdTestResultSuccess() ],
    49134924            ]);
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