VirtualBox

Changeset 92868 in vbox


Ignore:
Timestamp:
Dec 10, 2021 9:58:58 PM (3 years ago)
Author:
vboxsync
Message:

ValKit/tdAddGuestCtrl.py: Fixed regression from r148744 which assumed afFlags were always lists and didn't account for they defaulting to None. bugref:9320

File:
1 edited

Legend:

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

    r92822 r92868  
    18781878        """
    18791879        Helper function to copy a single file from the host to the guest.
     1880
     1881        afFlags is either None or an array of vboxcon.DirectoryCopyFlag_Xxxx values.
    18801882        """
    18811883        reporter.log2('Copying host file "%s" to guest "%s" (flags %s)' % (limitString(sSrc), limitString(sDst), afFlags));
     
    19061908        """
    19071909        Helper function to copy a directory (tree) from the host to the guest.
     1910
     1911        afFlags is either None or an array of vboxcon.DirectoryCopyFlag_Xxxx values.
    19081912        """
    19091913        reporter.log2('Copying host directory "%s" to guest "%s" (flags %s)' % (limitString(sSrc), limitString(sDst), afFlags));
     
    19111915            if self.oTstDrv.fpApiVer >= 7.0:
    19121916                ## @todo Make the following new flags implicit for 7.0 for now. Develop dedicated tests for this later and remove.
    1913                 if vboxcon.DirectoryCopyFlag_Recursive not in afFlags:
    1914                     afFlags.extend([ vboxcon.DirectoryCopyFlag_Recursive ]);
     1917                if not afFlags:
     1918                    afFlags = [ vboxcon.DirectoryCopyFlag_Recursive, ];
     1919                elif vboxcon.DirectoryCopyFlag_Recursive not in afFlags:
     1920                    afFlags.append(vboxcon.DirectoryCopyFlag_Recursive);
    19151921                ## @todo Ditto.
    1916                 if vboxcon.DirectoryCopyFlag_FollowLinks not in afFlags:
    1917                     afFlags.extend([ vboxcon.DirectoryCopyFlag_FollowLinks ]);
     1922                if not afFlags:
     1923                    afFlags = [vboxcon.DirectoryCopyFlag_FollowLinks,];
     1924                elif vboxcon.DirectoryCopyFlag_FollowLinks not in afFlags:
     1925                    afFlags.append(vboxcon.DirectoryCopyFlag_FollowLinks);
    19181926            oCurProgress = oGuestSession.directoryCopyToGuest(sSrc, sDst, afFlags);
    19191927        except:
     
    46514659            [ tdTestCopyToDir( sDst = sScratchGst), tdTestResultFailure() ],
    46524660            # Both given, but invalid flags.
    4653             [ tdTestCopyToFile(sSrc = sBigFileHst, sDst = sScratchGst, afFlags = [ 0x40000000] ), tdTestResultFailure() ],
    4654             [ tdTestCopyToDir( sSrc = sScratchEmptyDirHst, sDst = sScratchGst, afFlags = [ 0x40000000] ),
     4661            [ tdTestCopyToFile(sSrc = sBigFileHst, sDst = sScratchGst, afFlags = [ 0x40000000, ] ), tdTestResultFailure() ],
     4662            [ tdTestCopyToDir( sSrc = sScratchEmptyDirHst, sDst = sScratchGst, afFlags = [ 0x40000000, ] ),
    46554663              tdTestResultFailure() ],
    46564664        ];
     
    47214729            atTests.extend([
    47224730                [ tdTestCopyToDir(sSrc = sScratchEmptyDirHst, sDst = sScratchDstDir1Gst,
    4723                                   afFlags = [vboxcon.DirectoryCopyFlag_CopyIntoExisting]),  tdTestResultSuccess() ],
     4731                                  afFlags = [vboxcon.DirectoryCopyFlag_CopyIntoExisting, ]),  tdTestResultSuccess() ],
    47244732                # Try again.
    47254733                [ tdTestCopyToDir(sSrc = sScratchEmptyDirHst, sDst = sScratchDstDir1Gst,
    4726                                   afFlags = [vboxcon.DirectoryCopyFlag_CopyIntoExisting]),  tdTestResultSuccess() ],
     4734                                  afFlags = [vboxcon.DirectoryCopyFlag_CopyIntoExisting, ]),  tdTestResultSuccess() ],
    47274735                # Should fail, as destination directory already exists.
    47284736                [ tdTestCopyToDir(sSrc = sScratchEmptyDirHst, sDst = sScratchDstDir1Gst),   tdTestResultFailure() ],
    47294737                # Try again with trailing slash, should yield the same result:
    47304738                [ tdTestCopyToDir(sSrc = sScratchEmptyDirHst, sDst = sScratchDstDir2Gst + oTestVm.pathSep(),
    4731                                   afFlags = [vboxcon.DirectoryCopyFlag_CopyIntoExisting]),  tdTestResultSuccess() ],
     4739                                  afFlags = [vboxcon.DirectoryCopyFlag_CopyIntoExisting, ]),  tdTestResultSuccess() ],
    47324740                # Try again.
    47334741                [ tdTestCopyToDir(sSrc = sScratchEmptyDirHst, sDst = sScratchDstDir2Gst + oTestVm.pathSep(),
    4734                                   afFlags = [vboxcon.DirectoryCopyFlag_CopyIntoExisting]),  tdTestResultSuccess() ],
     4742                                  afFlags = [vboxcon.DirectoryCopyFlag_CopyIntoExisting, ]),  tdTestResultSuccess() ],
    47354743                # Should fail, as destination directory already exists.
    47364744                [ tdTestCopyToDir(sSrc = sScratchEmptyDirHst, sDst = sScratchDstDir2Gst + oTestVm.pathSep()),
     
    47444752                # Now the same using a directory with files in it:
    47454753                [ tdTestCopyToDir(sSrc = sScratchNonEmptyDirHst, sDst = sScratchDstDir3Gst,
    4746                                   afFlags = [vboxcon.DirectoryCopyFlag_CopyIntoExisting]),   tdTestResultSuccess() ],
     4754                                  afFlags = [vboxcon.DirectoryCopyFlag_CopyIntoExisting, ]),   tdTestResultSuccess() ],
    47474755                # Again.
    47484756                [ tdTestCopyToDir(sSrc = sScratchNonEmptyDirHst, sDst = sScratchDstDir3Gst,
    4749                                   afFlags = [vboxcon.DirectoryCopyFlag_CopyIntoExisting]),   tdTestResultSuccess() ],
     4757                                  afFlags = [vboxcon.DirectoryCopyFlag_CopyIntoExisting, ]),   tdTestResultSuccess() ],
    47504758                # Should fail, as directory is existing already.
    47514759                [ tdTestCopyToDir(sSrc = sScratchNonEmptyDirHst, sDst = sScratchDstDir3Gst), tdTestResultFailure() ],
     
    47544762                # Copy the entire test tree:
    47554763                [ tdTestCopyToDir(sSrc = sScratchTreeDirHst, sDst = sScratchDstDir4Gst,
    4756                                   afFlags = [vboxcon.DirectoryCopyFlag_CopyIntoExisting]), tdTestResultSuccess() ],
     4764                                  afFlags = [vboxcon.DirectoryCopyFlag_CopyIntoExisting, ]), tdTestResultSuccess() ],
    47574765            ]);
    47584766
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