VirtualBox

Ignore:
Timestamp:
Nov 17, 2022 7:55:49 AM (2 years ago)
Author:
vboxsync
Message:

Validation Kit/Guest Control: Added some more tests for using dotdot ("..") directories for sources and destinations.

File:
1 edited

Legend:

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

    r97567 r97586  
    47444744        sScratchDstDir3Gst      = oTestVm.pathJoin(sScratchGst, 'dstdir3');
    47454745        sScratchDstDir4Gst      = oTestVm.pathJoin(sScratchGst, 'dstdir4');
     4746        sScratchDotDotDirGst    = oTestVm.pathJoin(sScratchGst, '..');
    47464747        #sScratchGstNotExist     = oTestVm.pathJoin(self.oTstDrv.getGuestTempDir(oTestVm), 'no-such-file-or-directory');
    47474748        sScratchHstNotExist     = os.path.join(self.oTstDrv.sScratchPath,         'no-such-file-or-directory');
     
    47954796        except:
    47964797            return reporter.errorXcpt('sEmptyFileHst=%s' % (sEmptyFileHst,));
     4798
     4799        # os.path.join() is too clever for "..", so we just build up the path here ourselves.
     4800        sScratchDotDotFileHst = sScratchHst + os.path.sep + '..' + os.path.sep + 'gctrl-empty.data';
    47974801
    47984802        #
     
    49264930                                  afFlags = [ vboxcon.DirectoryCopyFlag_CopyIntoExisting, ]), tdTestResultSuccess() ],
    49274931            ]);
     4932        #
     4933        # Dotdot path handling.
     4934        #
     4935        if self.oTstDrv.fpApiVer >= 6.1:
     4936            atTests.extend([
     4937                # Test if copying stuff from a host dotdot ".." directory works.
     4938                [ tdTestCopyToFile(sSrc = sScratchDotDotFileHst, sDst = sScratchDstDir1Gst + oTestVm.pathSep()),
     4939                  tdTestResultSuccess() ],
     4940                # Test if copying stuff from the host to a guest's dotdot ".." directory works.
     4941                # That should fail on destinations.
     4942                [ tdTestCopyToFile(sSrc = sEmptyFileHst, sDst = sScratchDotDotDirGst), tdTestResultFailure() ],
     4943            ]);
    49284944
    49294945        fRc = True;
     
    49674983        sScratchDstDir3Hst      = os.path.join(sScratchHst, "dstdir3");
    49684984        sScratchDstDir4Hst      = os.path.join(sScratchHst, "dstdir4");
     4985        # os.path.join() is too clever for "..", so we just build up the path here ourselves.
     4986        sScratchDotDotDirHst    = sScratchHst + os.path.sep + '..' + os.path.sep;
    49694987        oExistingFileGst        = self.oTestFiles.chooseRandomFile();
    49704988        oNonEmptyDirGst         = self.oTestFiles.chooseRandomDirFromTree(fNonEmpty = True);
     
    49804998        else:
    49814999            sScratchHstInvalid  = None;
     5000
     5001        sScratchDotDotDirGst = oTestVm.pathJoin(self.oTstDrv.getGuestTempDir(oTestVm), '..');
    49825002
    49835003        if os.path.exists(sScratchHst):
     
    51245144                                    afFlags = [ vboxcon.DirectoryCopyFlag_CopyIntoExisting, ]), tdTestResultSuccess() ],
    51255145            ]);
     5146        #
     5147        # Dotdot path handling.
     5148        #
     5149        if self.oTstDrv.fpApiVer >= 6.1:
     5150            atTests.extend([
     5151                # Test if copying stuff from a guest dotdot ".." directory works.
     5152                [ tdTestCopyFromDir(sSrc = sScratchDotDotDirGst, sDst = sScratchDstDir1Hst + os.path.sep,
     5153                                    afFlags = [ vboxcon.DirectoryCopyFlag_CopyIntoExisting, ]),
     5154                  tdTestResultFailure() ],
     5155                # Test if copying stuff from the guest to a host's dotdot ".." directory works.
     5156                # That should fail on destinations.
     5157                [ tdTestCopyFromFile(oSrc = oExistingFileGst, sDst = sScratchDotDotDirHst), tdTestResultFailure() ],
     5158            ]);
    51265159
    51275160        reporter.log2('Executing tests ...');
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