VirtualBox

Changeset 79163 in vbox for trunk/src/VBox/ValidationKit


Ignore:
Timestamp:
Jun 17, 2019 1:52:20 AM (6 years ago)
Author:
vboxsync
Message:

tdAddGuestCtrl.py: testGuestCtrlCopyTo related cleanups. bugref:9151 bugref:9320

File:
1 edited

Legend:

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

    r79162 r79163  
    10161016                fRcTest = None;
    10171017
    1018             if fRcTest is False and reporter.testErrorCount() != 0:
     1018            if fRcTest is False and reporter.testErrorCount() == 0:
    10191019                fRcTest = reporter.error('Buggy test! Returned False w/o logging the error!');
    10201020            if reporter.testDone(fRcTest is None)[1] != 0:
     
    11551155        return True;
    11561156
    1157     def gctrlCopyFileTo(self, oGuestSession, sSrc, sDst, fFlags):
    1158         """
    1159         Helper function to copy a single file from host to the guest.
    1160         """
    1161         fRc = True; # Be optimistic.
    1162         try:
    1163             reporter.log2('Copying host file "%s" to guest "%s" (flags %s)' % (sSrc, sDst, fFlags));
     1157    def gctrlCopyFileTo(self, oGuestSession, sSrc, sDst, fFlags, fIsError):
     1158        """
     1159        Helper function to copy a single file from the host to the guest.
     1160        """
     1161        reporter.log2('Copying host file "%s" to guest "%s" (flags %s)' % (sSrc, sDst, fFlags));
     1162        try:
    11641163            if self.oTstDrv.fpApiVer >= 5.0:
    11651164                oCurProgress = oGuestSession.fileCopyToGuest(sSrc, sDst, fFlags);
    11661165            else:
    11671166                oCurProgress = oGuestSession.copyTo(sSrc, sDst, fFlags);
    1168             if oCurProgress is not None:
    1169                 oProgress = vboxwrappers.ProgressWrapper(oCurProgress, self.oTstDrv.oVBoxMgr, self.oTstDrv, "gctrlCopyFileTo");
    1170                 try:
    1171                     oProgress.wait();
    1172                     if not oProgress.isSuccess():
    1173                         oProgress.logResult(fIgnoreErrors = True);
    1174                         fRc = False;
    1175                 except:
    1176                     reporter.logXcpt('Wait exception for sSrc="%s", sDst="%s":' % (sSrc, sDst));
    1177                     fRc = False;
    1178             else:
    1179                 reporter.error('No progress object returned');
    1180                 fRc = False;
    11811167        except:
    1182             # Just log, don't assume an error here (will be done in the main loop then).
    1183             reporter.logXcpt('Copy to exception for sSrc="%s", sDst="%s":' % (sSrc, sDst));
    1184             fRc = False;
    1185 
    1186         return fRc;
     1168            reporter.maybeErrXcpt(fIsError, 'sSrc=%s sDst=%s' % (sSrc, sDst,));
     1169            return False;
     1170
     1171        if oCurProgress is None:
     1172            return reporter.error('No progress object returned');
     1173        oProgress = vboxwrappers.ProgressWrapper(oCurProgress, self.oTstDrv.oVBoxMgr, self.oTstDrv, "gctrlCopyFileTo");
     1174
     1175        try:
     1176            oProgress.wait();
     1177            if not oProgress.isSuccess():
     1178                oProgress.logResult(fIgnoreErrors = not fIsError);
     1179                return False;
     1180        except:
     1181            reporter.maybeErrXcpt(fIsError, 'Wait exception for sSrc="%s", sDst="%s":' % (sSrc, sDst));
     1182            return False;
     1183        return True;
     1184
     1185    def gctrlCopyDirTo(self, oGuestSession, sSrc, sDst, fFlags, fIsError):
     1186        """
     1187        Helper function to copy a directory tree from the host to the guest.
     1188        """
     1189        reporter.log2('Copying host directory "%s" to guest "%s" (flags %s)' % (sSrc, sDst, fFlags));
     1190        try:
     1191            oCurProgress = oGuestSession.directoryCopyToGuest(sSrc, sDst, fFlags);
     1192        except:
     1193            reporter.maybeErrXcpt(fIsError, 'sSrc=%s sDst=%s' % (sSrc, sDst,));
     1194            return False;
     1195
     1196        if oCurProgress is None:
     1197            return reporter.error('No progress object returned');
     1198        oProgress = vboxwrappers.ProgressWrapper(oCurProgress, self.oTstDrv.oVBoxMgr, self.oTstDrv, "gctrlCopyFileTo");
     1199
     1200        try:
     1201            oProgress.wait();
     1202            if not oProgress.isSuccess():
     1203                oProgress.logResult(fIgnoreErrors = not fIsError);
     1204                return False;
     1205        except:
     1206            reporter.maybeErrXcpt(fIsError, 'Wait exception for sSrc="%s", sDst="%s":' % (sSrc, sDst));
     1207            return False;
     1208        return True;
    11871209
    11881210    def gctrlCreateDir(self, oTest, oRes, oGuestSession):
     
    33353357        return (fRc, oTxsSession);
    33363358
     3359    @staticmethod
     3360    def __generateFile(sName, cbFile):
     3361        """ Helper for generating a file with a given size. """
     3362        oFile = open(sName, 'wb');
     3363        while cbFile > 0:
     3364            cb = cbFile if cbFile < 256*1024 else 256*1024;
     3365            oFile.write(bytearray(random.getrandbits(8) for _ in xrange(cb)));
     3366            cbFile -= cb;
     3367        oFile.close();
     3368
    33373369    def testGuestCtrlCopyTo(self, oSession, oTxsSession, oTestVm):
    33383370        """
     
    33403372        """
    33413373
     3374        # Paths.
     3375        sScratchGst             = oTestVm.pathJoin(self.getGuestTempDir(oTestVm), 'testGuestCtrlCopyTo');
     3376        #sScratchGstNotExist     = oTestVm.pathJoin(self.getGuestTempDir(oTestVm), 'no-such-file-or-directory');
     3377        sScratchHstNotExist     = os.path.join(self.oTstDrv.sScratchPath,         'no-such-file-or-directory');
     3378        sScratchGstPathNotFound = oTestVm.pathJoin(self.getGuestTempDir(oTestVm), 'no-such-directory', 'or-file');
     3379        #sScratchHstPathNotFound = os.path.join(self.oTstDrv.sScratchPath,         'no-such-directory', 'or-file');
     3380        sSomeDirHst             = self.oTstDrv.sScriptPath;
     3381
     3382        if oTestVm.isWindows() or oTestVm.isOS2():
     3383            sScratchGstInvalid  = "?*|<invalid-name>";
     3384        else:
     3385            sScratchGstInvalid  = None;
     3386
     3387
     3388        if oTxsSession.syncMkDir(sScratchGst) is not True:
     3389            return reporter.error('TXS failed to create directory "%s"!' % (sScratchGst,));
     3390
     3391        # Generate a test file in 32MB to 50 MB range.
     3392        sBigFileHst  = os.path.join(self.oTstDrv.sScratchPath, 'gctrl-random.data');
     3393        cbBigFileHst = random.randrange(32*1024*1024, 50*1024*1024);
     3394        reporter.log('cbBigFileHst=%s' % (cbBigFileHst,));
     3395        cbLeft       = cbBigFileHst;
     3396        try:
     3397            self.__generateFile(sBigFileHst, cbBigFileHst);
     3398        except:
     3399            return reporter.errorXcpt('sBigFileHst=%s cbBigFileHst=%s cbLeft=%s' % (sBigFileHst, cbBigFileHst, cbLeft,));
     3400        reporter.log('cbBigFileHst=%s' % (cbBigFileHst,));
     3401
     3402        # Generate an empty file on the host that we can use to save space in the guest.
     3403        sEmptyFileHst = os.path.join(self.oTstDrv.sScratchPath, 'gctrl-empty.data');
     3404        try:
     3405            oFile = open(sEmptyFileHst, "wb");
     3406            oFile.close();
     3407        except:
     3408            return reporter.errorXcpt('sEmptyFileHst=%s' % (sEmptyFileHst,));
     3409
     3410        #
     3411        # Tests.
     3412        #
     3413        atTests = [
     3414            ## @todo because of the way the test stats the source to figure out which API to use,
     3415            ##       not all of this necessarily testing both file and directory API variants like
     3416            ##       was intended.  This needs to be addressed by specializing tdTestCopyTo so it
     3417            ##       would be possible to test feeding directories to the file API and vice versa.
     3418
     3419            # Nothing given
     3420            [ tdTestCopyTo(), tdTestResultFailure() ],
     3421            # Only one given.
     3422            [ tdTestCopyTo(sSrc = sBigFileHst), tdTestResultFailure() ],
     3423            [ tdTestCopyTo(sDst = sScratchGst), tdTestResultFailure() ],
     3424            # Only one given, invalid flag.
     3425            [ tdTestCopyTo(sSrc = sBigFileHst, fFlags = [ 0x40000000, ]), tdTestResultFailure() ],
     3426            [ tdTestCopyTo(sDst = sScratchGst, fFlags = [ 0x40000000, ]), tdTestResultFailure() ],
     3427            ## Apparently Main doesn't check the flags, so the first test succeeds.
     3428            ## Both given, but invalid  flags.
     3429            #[ tdTestCopyTo(sSrc = sBigFileHst, sDst = sScratchGst, fFlags = [ 0x40000000] ), tdTestResultFailure() ],
     3430            #[ tdTestCopyTo(sSrc = sSomeDirHst, sDst = sScratchGst, fFlags = [ 0x40000000] ), tdTestResultFailure() ],
     3431            # Bogus source, but no destination.
     3432            [ tdTestCopyTo(sSrc = sScratchHstNotExist), tdTestResultFailure() ],
     3433            # Valid sources, but bogus destination (path not found).
     3434            [ tdTestCopyTo(sSrc = sBigFileHst, sDst = sScratchGstPathNotFound), tdTestResultFailure() ],
     3435            [ tdTestCopyTo(sSrc = sSomeDirHst, sDst = sScratchGstPathNotFound), tdTestResultFailure() ],
     3436        ];
     3437        if sScratchGstInvalid is not None:
     3438            # Invalid characters in destination path:
     3439            atTests.extend([
     3440                [ tdTestCopyTo(sSrc = sBigFileHst, sDst = oTestVm.pathJoin(sScratchGst, sScratchGstInvalid)),
     3441                  tdTestResultFailure() ],
     3442                [ tdTestCopyTo(sSrc = sSomeDirHst, sDst = oTestVm.pathJoin(sScratchGst, sScratchGstInvalid)),
     3443                  tdTestResultFailure() ],
     3444        ]);
     3445
     3446        #
     3447        # Single file handling.
     3448        #
     3449        atTests.extend([
     3450            [ tdTestCopyTo(sSrc = sBigFileHst, sDst = oTestVm.pathJoin(sScratchGst, 'HostGABig.dat')),
     3451              tdTestResultSuccess() ],
     3452            [ tdTestCopyTo(sSrc = sBigFileHst, sDst = oTestVm.pathJoin(sScratchGst, 'HostGABig.dat')),      # Overwrite
     3453              tdTestResultSuccess() ],
     3454            [ tdTestCopyTo(sSrc = sEmptyFileHst, sDst = oTestVm.pathJoin(sScratchGst, 'HostGABig.dat')),    # Overwrite
     3455              tdTestResultSuccess() ],
     3456        ]);
     3457        if self.oTstDrv.fpApiVer > 5.2: # Copying files into directories via Main is supported only 6.0 and later.
     3458            atTests.extend([
     3459                [ tdTestCopyTo(sSrc = sBigFileHst, sDst = sScratchGst), tdTestResultSuccess() ],
     3460                [ tdTestCopyTo(sSrc = sBigFileHst, sDst = sScratchGst), tdTestResultSuccess() ],            # Overwrite
     3461                [ tdTestCopyTo(sSrc = sEmptyFileHst, sDst = oTestVm.pathJoin(sScratchGst, os.path.split(sBigFileHst)[1])),
     3462                  tdTestResultSuccess() ],                                                                  # Overwrite
     3463            ]);
     3464
    33423465        if oTestVm.isWindows():
    3343             sScratchGst = "C:\\Temp\\vboxtest\\testGuestCtrlCopyTo\\";
    3344             sScratchGstNotExist = "C:\\does-not-exist\\";
    3345             sScratchGstInvalid = "?*|invalid-name?*|";
    3346         else:
    3347             sScratchGst = "/tmp/"; ## @todo Use "${SCRATCH}/testGuestCtrlCopyTo" as soon as TXS CHMOD is implemented.
    3348             sScratchGstNotExist = "/tmp/does-not-exist/";
    3349             sScratchGstInvalid = "/";
    3350 
    3351         if oTxsSession.syncMkDir('${SCRATCH}/testGuestCtrlCopyTo') is False:
    3352             reporter.error('Could not create scratch directory on guest');
    3353             return (False, oTxsSession);
    3354 
    3355         ## @todo r=klaus It's not good to use files with unpredictable size
    3356         # for testing. Causes all sorts of weird failures as things grow,
    3357         # exceeding the free space of the test VMs. Especially as this used
    3358         # the very big (and quickly growing) validation kit ISO originally.
    3359         sTestFileBig = self.oTstDrv.getFullResourceName('5.3/guestctrl/50mb_rnd.dat');
    3360         if not os.path.isfile(sTestFileBig):
    3361             sTestFileBig = self.oTstDrv.getGuestAdditionsIso();
    3362         if sTestFileBig == '' or not os.path.isfile(sTestFileBig):
    3363             sTestFileBig = self.oTstDrv.sVBoxValidationKitIso;
    3364         if os.path.isfile(sTestFileBig):
    3365             reporter.log('Test file for big copy found at: %s' % (sTestFileBig,));
    3366         else:
    3367             reporter.log('Warning: Test file for big copy not found -- some tests might fail');
    3368 
    3369         atTests = [];
    3370         atTests.extend([
    3371             # Destination missing.
    3372             [ tdTestCopyTo(sSrc = ''), tdTestResultFailure() ],
    3373             [ tdTestCopyTo(sSrc = '/placeholder', fFlags = [ 80 ] ), tdTestResultFailure() ],
    3374             # Source missing.
    3375             [ tdTestCopyTo(sDst = ''), tdTestResultFailure() ],
    3376             [ tdTestCopyTo(sDst = '/placeholder', fFlags = [ 80 ] ), tdTestResultFailure() ],
    3377             # Testing DirectoryCopyFlag flags.
    3378             [ tdTestCopyTo(sSrc = sTestFileBig, sDst = sScratchGstInvalid, fFlags = [ 80 ] ), tdTestResultFailure() ],
    3379             # Testing FileCopyFlag flags.
    3380             [ tdTestCopyTo(sSrc = sTestFileBig, sDst = sScratchGstInvalid, fFlags = [ 80 ] ), tdTestResultFailure() ],
    3381             # Nothing to copy (source and/or destination is empty).
    3382             [ tdTestCopyTo(sSrc = 'z:\\'), tdTestResultFailure() ],
    3383             [ tdTestCopyTo(sSrc = '\\\\uncrulez\\foo'), tdTestResultFailure() ],
    3384             [ tdTestCopyTo(sSrc = 'non-exist', sDst = os.path.join(sScratchGst, 'non-exist.dll')), tdTestResultFailure() ]
    3385         ]);
    3386 
    3387         #
    3388         # Single file handling.
    3389         #
    3390         if self.oTstDrv.fpApiVer > 5.2:
     3466            # Copy to a Windows alternative data stream (ADS).
    33913467            atTests.extend([
    3392                 [ tdTestCopyTo(sSrc = sTestFileBig, sDst = sScratchGstInvalid), tdTestResultFailure() ],
    3393                 [ tdTestCopyTo(sSrc = sTestFileBig, sDst = sScratchGstNotExist), tdTestResultFailure() ],
    3394                 [ tdTestCopyTo(sSrc = sTestFileBig, sDst = sScratchGstNotExist), tdTestResultFailure() ],
    3395                 [ tdTestCopyTo(sSrc = sTestFileBig, sDst = os.path.join(sScratchGstNotExist, 'renamedfile.dll')),
    3396                   tdTestResultFailure() ],
    3397                 [ tdTestCopyTo(sSrc = sTestFileBig, sDst = os.path.join(sScratchGst, 'HostGABig.dat')),
     3468                [ tdTestCopyTo(sSrc = sBigFileHst, sDst = os.path.join(sScratchGst, 'HostGABig.dat:ADS-Test')),
    33983469                  tdTestResultSuccess() ],
    3399                 [ tdTestCopyTo(sSrc = sTestFileBig, sDst = os.path.join(sScratchGst, 'HostGABig.dat')),
     3470                [ tdTestCopyTo(sSrc = sEmptyFileHst, sDst = os.path.join(sScratchGst, 'HostGABig.dat:ADS-Test')),
    34003471                  tdTestResultSuccess() ],
    3401                 # Note: Copying files into directories via Main is supported only in versions > 5.2.
    3402                 # Destination is a directory.
    3403                 [ tdTestCopyTo(sSrc = sTestFileBig, sDst = sScratchGst),
     3472            ]);
     3473
     3474        #
     3475        # Directory handling.
     3476        #
     3477        if self.oTstDrv.fpApiVer > 5.2: # Copying directories via Main is supported only in versions > 5.2.
     3478            # Create a directory to copy.
     3479            sHstCopyDir = os.path.join(self.oTstDrv.sScratchPath, 'gctrl-srcdir');
     3480            try:   ## @todo Take the TestFileSet idea to the generic realm, making host and guest specializations/whatever.
     3481                os.mkdir(sHstCopyDir);
     3482                os.mkdir(           os.path.join(sHstCopyDir, 'subdir1'));
     3483                os.mkdir(           os.path.join(sHstCopyDir, 'subdir2'));
     3484                os.mkdir(           os.path.join(sHstCopyDir, 'subdir2', 'subsub1'));
     3485                self.__generateFile(os.path.join(sHstCopyDir, 'subdir2', 'subsub1', 'file0'), 0);
     3486                self.__generateFile(os.path.join(sHstCopyDir, 'subdir2', 'subsub1', 'file1'), 1023);
     3487                self.__generateFile(os.path.join(sHstCopyDir, 'subdir2', 'subsub1', 'file2'), 2048);
     3488                self.__generateFile(os.path.join(sHstCopyDir, 'subdir2', 'subsub1', 'file3'), 2047);
     3489                self.__generateFile(os.path.join(sHstCopyDir, 'subdir2', 'subsub1', 'file4'), 16887);
     3490                self.__generateFile(os.path.join(sHstCopyDir, 'subdir2', 'subsub1', 'file4'), 32);
     3491                os.mkdir(           os.path.join(sHstCopyDir, 'subdir2', 'subsub2'));
     3492                self.__generateFile(os.path.join(sHstCopyDir, 'subdir2', 'subsub2', 'file5'), 31);
     3493                self.__generateFile(os.path.join(sHstCopyDir, 'subdir2', 'subsub2', 'file6'), 1);
     3494                self.__generateFile(os.path.join(sHstCopyDir, 'subdir2', 'subsub2', 'file7'), 1);
     3495                self.__generateFile(os.path.join(sHstCopyDir, 'subdir2', 'subsub2', 'file8'), 0);
     3496                os.mkdir(           os.path.join(sHstCopyDir, 'subdir2', 'subsub3'));
     3497                self.__generateFile(os.path.join(sHstCopyDir, 'subdir2', 'subsub3', 'file9'), 9);
     3498                self.__generateFile(os.path.join(sHstCopyDir, 'subdir2', 'subsub3', 'file10'), 63);
     3499                self.__generateFile(os.path.join(sHstCopyDir, 'subdir2', 'subsub3', 'file11'), 11);
     3500                self.__generateFile(os.path.join(sHstCopyDir, 'subdir2', 'subsub3', 'file12'), 67);
     3501                os.mkdir(           os.path.join(sHstCopyDir, 'subdir3'));
     3502                self.__generateFile(os.path.join(sHstCopyDir, 'file13'), 13);
     3503                self.__generateFile(os.path.join(sHstCopyDir, 'file14'), 67);
     3504                self.__generateFile(os.path.join(sHstCopyDir, 'file15'), 1111);
     3505            except:
     3506                reporter.errorXcpt('Error generating test tree on the host for the copy test (%s)' % (sHstCopyDir,));
     3507
     3508            atTests.extend([
     3509                [ tdTestCopyTo(sSrc = sHstCopyDir, sDst = sScratchGst, fFlags = [ vboxcon.DirectoryCopyFlag_CopyIntoExisting ]),
    34043510                  tdTestResultSuccess() ],
    3405                 # Copy over file again into same directory (overwrite).
    3406                 [ tdTestCopyTo(sSrc = sTestFileBig, sDst = sScratchGst),
    3407                   tdTestResultSuccess() ]
     3511                ## @todo r=bird: Why does this fail???
     3512                # [ tdTestCopyTo(sSrc = sHstCopyDir, sDst = oTestVm.pathJoin(sScratchGst, 'target-dir')), tdTestResultSuccess() ],
    34083513            ]);
    34093514
    3410             if oTestVm.isWindows():
    3411                 atTests.extend([
    3412                     # Copy the same file over to the guest, but this time store the file into the former
    3413                     # file's ADS (Alternate Data Stream). Only works on Windows, of course.
    3414                     [ tdTestCopyTo(sSrc = sTestFileBig, sDst = os.path.join(sScratchGst, 'HostGABig.dat:ADS-Test')),
    3415                       tdTestResultSuccess() ]
    3416                 ]);
    3417 
    3418             #
    3419             # Directory handling.
    3420             #
    3421             ## @todo r=michaln disabled completely, can fill up the guest disk or fail without giving a reason
    3422             if self.oTstDrv.fpApiVer > 6.0: # Copying directories via Main is supported only in versions > 5.2.
    3423                 if self.oTstDrv.sHost == "win":
    3424                     sSystemRoot = os.getenv('SystemRoot', 'C:\\Windows')
    3425                     atTests.extend([
    3426                         # Copying directories with contain files we don't have read access to.
    3427                         ## @todo r=klaus disabled, because this can fill up the guest disk, making other tests fail,
    3428                         ## additionally it's not really clear if this fails reliably on all Windows versions, even
    3429                         ## the old ones like XP with a "proper" administrator.
    3430                         #[ tdTestCopyTo(sSrc = os.path.join(sSystemRoot, 'security'),
    3431                         #               sDst = sScratchGst, fFlags = [ vboxcon.DirectoryCopyFlag_CopyIntoExisting ]),
    3432                         #
    3433                         # Copying directories with regular files.
    3434                         [ tdTestCopyTo(sSrc = os.path.join(sSystemRoot, 'Help'),
    3435                                        sDst = sScratchGst, fFlags = [ vboxcon.DirectoryCopyFlag_CopyIntoExisting ]),
    3436                           tdTestResultSuccess() ]
    3437                         ]);
    3438 
    34393515        fRc = True;
    3440         for (i, aTest) in enumerate(atTests):
    3441             oCurTest = aTest[0]; # tdTestExec, use an index, later.
    3442             oCurRes  = aTest[1]; # tdTestResult
    3443             reporter.log('Testing #%d, sSrc=%s, sDst=%s, fFlags=%s ...' % \
    3444                          (i, oCurTest.sSrc, oCurTest.sDst, oCurTest.fFlags));
     3516        for (i, tTest) in enumerate(atTests):
     3517            oCurTest = tTest[0]; # tdTestCopyTo
     3518            oCurRes  = tTest[1]; # tdTestResult
     3519            reporter.log('Testing #%d, sSrc=%s, sDst=%s, fFlags=%s ...' % (i, oCurTest.sSrc, oCurTest.sDst, oCurTest.fFlags));
     3520
    34453521            oCurTest.setEnvironment(oSession, oTxsSession, oTestVm);
    3446             fRc, oCurGuestSession = oCurTest.createSession('testGuestCtrlCopyTo: Test #%d' % (i,));
    3447             if fRc is False:
    3448                 reporter.error('Test #%d failed: Could not create session' % (i,));
     3522            fRc, oCurGuestSession = oCurTest.createSession('testGuestCtrlCopyTo: Test #%d' % (i,), fIsError = True);
     3523            if fRc is not True:
     3524                fRc = reporter.error('Test #%d failed: Could not create session' % (i,));
    34493525                break;
    34503526
    34513527            fRc2 = False;
    3452             if os.path.isdir(oCurTest.sSrc):
    3453                 try:
    3454                     oCurProgress = oCurGuestSession.directoryCopyToGuest(oCurTest.sSrc, oCurTest.sDst, oCurTest.fFlags);
    3455                     if oCurProgress is not None:
    3456                         oProgress = vboxwrappers.ProgressWrapper(oCurProgress, self.oTstDrv.oVBoxMgr, self.oTstDrv, \
    3457                                                                  "gctrlDirCopyTo");
    3458                         try:
    3459                             oProgress.wait();
    3460                             if oProgress.isSuccess():
    3461                                 fRc2 = True;
    3462                             else:
    3463                                 oProgress.logResult(fIgnoreErrors = True);
    3464                         except:
    3465                             reporter.logXcpt('Waiting exception for sSrc="%s", sDst="%s":' % (oCurTest.sSrc, oCurTest.sDst));
    3466                     else:
    3467                         reporter.error('No progress object returned');
    3468                 except:
    3469                     reporter.logXcpt('directoryCopyToGuest exception for sSrc="%s", sDst="%s":' % (oCurTest.sSrc, oCurTest.sDst));
     3528            if os.path.isdir(oCurTest.sSrc): ## @todo r=bird: Not good enough. Test case must know which one it's testing.
     3529                fRc2 = self.gctrlCopyDirTo(oCurGuestSession, oCurTest.sSrc, oCurTest.sDst, oCurTest.fFlags, oCurRes.fRc);
    34703530            else:
    3471                 fRc2 = self.gctrlCopyFileTo(oCurGuestSession, oCurTest.sSrc, oCurTest.sDst, oCurTest.fFlags);
    3472 
    3473             oCurTest.closeSession();
    3474 
    3475             if fRc2 is oCurRes.fRc:
    3476                 ## @todo Verify the copied results (size, checksum?).
    3477                 pass;
     3531                fRc2 = self.gctrlCopyFileTo(oCurGuestSession, oCurTest.sSrc, oCurTest.sDst, oCurTest.fFlags, oCurRes.fRc);
     3532            if fRc2 is not oCurRes.fRc:
     3533                fRc = reporter.error('Test #%d failed: Got %s, expected %s' % (i, fRc2, oCurRes.fRc));
    34783534            else:
    3479                 reporter.error('Test #%d failed: Got %s, expected %s' % (i, fRc2, oCurRes.fRc));
    3480                 fRc = False;
    3481                 break;
     3535                pass; ## @todo verify what was copied!!
     3536
     3537            fRc = oCurTest.closeSession(True) and fRc;
    34823538
    34833539        return (fRc, oTxsSession);
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