Changeset 55634 in vbox for trunk/src/VBox/ValidationKit/tests/additions
- Timestamp:
- May 4, 2015 4:36:31 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py
r55591 r55634 340 340 self.aBuf = aBuf; 341 341 342 def getOpenAction(self): 343 """ Converts string disposition to open action enum. """ 344 if self.sDisposition == 'oe': return vboxcon.FileOpenAction_OpenExisting; 345 if self.sDisposition == 'oc': return vboxcon.FileOpenAction_OpenOrCreate; 346 if self.sDisposition == 'ce': return vboxcon.FileOpenAction_CreateNew; 347 if self.sDisposition == 'ca': return vboxcon.FileOpenAction_CreateOrReplace; 348 if self.sDisposition == 'ot': return vboxcon.FileOpenAction_OpenExistingTruncated; 349 if self.sDisposition == 'oa': return vboxcon.FileOpenAction_AppendOrCreate; 350 raise base.GenError(self.sDisposition); 351 352 def getAccessMode(self): 353 """ Converts open mode to access mode enum. """ 354 if self.sOpenMode == 'r': return vboxcon.FileOpenMode_ReadOnly; 355 if self.sOpenMode == 'w': return vboxcon.FileOpenMode_WriteOnly; 356 if self.sOpenMode == 'w+': return vboxcon.FileOpenMode_ReadWrite; 357 if self.sOpenMode == 'r+': return vboxcon.FileOpenMode_ReadWrite; 358 raise base.GenError(self.sOpenMode); 359 360 def getSharingMode(self): 361 """ Converts the sharing mode. """ 362 return vboxcon.FileSharingMode_All; 363 342 364 class tdTestSession(tdTestGuestCtrlBase): 343 365 """ … … 657 679 try: 658 680 reporter.log2('Copying guest file "%s" to host "%s"' % (sSrc, sDst)); 659 curProgress = oGuestSession.copyFrom(sSrc, sDst, aFlags); 681 if self.oTstDrv.fpApiVer >= 5.0: 682 curProgress = oGuestSession.fileCopyFromGuest(sSrc, sDst, aFlags); 683 else: 684 curProgress = oGuestSession.copyFrom(sSrc, sDst, aFlags); 660 685 if curProgress is not None: 661 686 oProgress = vboxwrappers.ProgressWrapper(curProgress, self.oTstDrv.oVBoxMgr, self, "gctrlCopyFrm"); … … 684 709 try: 685 710 reporter.log2('Copying host file "%s" to guest "%s"' % (sSrc, sDst)); 686 curProgress = oGuestSession.copyTo(sSrc, sDst, aFlags); 711 if self.oTstDrv.fpApiVer >= 5.0: 712 curProgress = oGuestSession.fileCopyToGuest(sSrc, sDst, aFlags); 713 else: 714 curProgress = oGuestSession.copyTo(sSrc, sDst, aFlags); 687 715 if curProgress is not None: 688 716 oProgress = vboxwrappers.ProgressWrapper(curProgress, self.oTstDrv.oVBoxMgr, self, "gctrlCopyTo"); … … 865 893 oGuestSession.directoryCreate(oTest.sDirectory, \ 866 894 oTest.fMode, oTest.aFlags); 867 fDirExists = oGuestSession.directoryExists(oTest.sDirectory); 895 if self.oTstDrv.fpApiVer >= 5.0: 896 fDirExists = oGuestSession.directoryExists(oTest.sDirectory, False); 897 else: 898 fDirExists = oGuestSession.directoryExists(oTest.sDirectory); 868 899 if fDirExists is False \ 869 900 and oRes.fRc is True: … … 1425 1456 for i in range(0, cStaleFiles): 1426 1457 try: 1427 oGuestSession.fileOpen(sFile, "r", "oe", 0); 1458 if self.oTstDrv.fpApiVer >= 5.0: 1459 oGuestSession.fileOpen(sFile, vboxcon.FileAccessMode_ReadOnly, vboxcon.FileOpenAction_OpenExisting, 0); 1460 else: 1461 oGuestSession.fileOpen(sFile, "r", "oe", 0); 1428 1462 # Note: Use a timeout in the call above for not letting the stale processes 1429 1463 # hanging around forever. This can happen if the installed Guest Additions … … 1448 1482 for i in range(0, cStaleFiles): 1449 1483 try: 1450 oCurFile = oGuestSession.fileOpen(sFile, "r", "oe", 0); 1484 if self.oTstDrv.fpApiVer >= 5.0: 1485 oCurFile = oGuestSession.fileOpen(sFile, vboxcon.FileAccessMode_ReadOnly, 1486 vboxcon.FileOpenAction_OpenExisting, 0); 1487 else: 1488 oCurFile = oGuestSession.fileOpen(sFile, "r", "oe", 0); 1451 1489 aaFiles.append(oCurFile); 1452 1490 except: … … 2335 2373 if sDirTemp != "": 2336 2374 reporter.log2('Temporary directory is: %s' % (sDirTemp,)); 2337 fExists = curGuestSession.directoryExists(sDirTemp); 2375 if self.oTstDrv.fpApiVer >= 5.0: 2376 fExists = curGuestSession.directoryExists(sDirTemp, False); 2377 else: 2378 fExists = curGuestSession.directoryExists(sDirTemp); 2338 2379 if fExists is False: 2339 2380 reporter.error('Test #%d failed: Temporary directory "%s" does not exists' % (i, sDirTemp)); … … 2479 2520 break; 2480 2521 try: 2481 curGuestSession.fileRemove(curTest.sFile); 2522 if self.oTstDrv.fpApiVer >= 5.0: 2523 curGuestSession.fsObjRemove(curTest.sFile); 2524 else: 2525 curGuestSession.fileRemove(curTest.sFile); 2482 2526 except: 2483 2527 if curRes.fRc is True: … … 2551 2595 fileObjInfo = None; 2552 2596 try: 2553 fileObjInfo = curGuestSession.fileQueryInfo(curTest.sFile); 2597 if self.oTstDrv.fpApiVer >= 5.0: 2598 fileObjInfo = curGuestSession.fsObjQueryInfo(curTest.sFile, True); 2599 else: 2600 fileObjInfo = curGuestSession.fileQueryInfo(curTest.sFile); 2554 2601 except: 2555 2602 if curRes.fRc is True: … … 2674 2721 try: 2675 2722 if curTest.cbOffset > 0: 2676 curFile = curGuestSession.fileOpenEx(curTest.sFile, curTest.sOpenMode, curTest.sDisposition, \ 2677 curTest.sSharingMode, curTest.lCreationMode, curTest.cbOffset); 2723 if self.oTstDrv.fpApiVer >= 5.0: 2724 curFile = curGuestSession.fileOpenEx(curTest.sFile, curTest.getAccessMode(), curTest.getOpenAction(), 2725 curTest.getSharingMode(), curTest.lCreationMode, curTest.cbOffset); 2726 else: 2727 curFile = curGuestSession.fileOpenEx(curTest.sFile, curTest.sOpenMode, curTest.sDisposition, \ 2728 curTest.sSharingMode, curTest.lCreationMode, curTest.cbOffset); 2678 2729 curOffset = long(curFile.offset); 2679 2730 resOffset = long(curTest.cbOffset); … … 2683 2734 fRc = False; 2684 2735 else: 2685 curFile = curGuestSession.fileOpen(curTest.sFile, curTest.sOpenMode, curTest.sDisposition, \ 2686 curTest.lCreationMode); 2736 if self.oTstDrv.fpApiVer >= 5.0: 2737 curFile = curGuestSession.fileOpen(curTest.sFile, curTest.getAccessMode(), curTest.getOpenAction(), 2738 curTest.lCreationMode); 2739 else: 2740 curFile = curGuestSession.fileOpen(curTest.sFile, curTest.sOpenMode, curTest.sDisposition, \ 2741 curTest.lCreationMode); 2687 2742 if fRc \ 2688 2743 and curTest.cbToReadWrite > 0: … … 2779 2834 try: 2780 2835 if curTest.cbOffset > 0: 2781 curFile = curGuestSession.fileOpenEx(curTest.sFile, curTest.sOpenMode, curTest.sDisposition, \ 2782 curTest.sSharingMode, curTest.lCreationMode, curTest.cbOffset); 2836 if self.oTstDrv.fpApiVer >= 5.0: 2837 curFile = curGuestSession.fileOpenEx(curTest.sFile, curTest.getAccessMode(), curTest.getOpenAction(), 2838 curTest.getSharingMode(), curTest.cbOffset); 2839 else: 2840 curFile = curGuestSession.fileOpenEx(curTest.sFile, curTest.sOpenMode, curTest.sDisposition, \ 2841 curTest.sSharingMode, curTest.lCreationMode, curTest.cbOffset); 2783 2842 curOffset = long(curFile.offset); 2784 2843 resOffset = long(curTest.cbOffset); … … 2788 2847 fRc = False; 2789 2848 else: 2790 curFile = curGuestSession.fileOpen(curTest.sFile, curTest.sOpenMode, curTest.sDisposition, \ 2791 curTest.lCreationMode); 2849 if self.oTstDrv.fpApiVer >= 5.0: 2850 curFile = curGuestSession.fileOpen(curTest.sFile, curTest.getAccessMode(), curTest.getOpenAction(), 2851 curTest.lCreationMode); 2852 else: 2853 curFile = curGuestSession.fileOpen(curTest.sFile, curTest.sOpenMode, curTest.sDisposition, \ 2854 curTest.lCreationMode); 2792 2855 if fRc \ 2793 2856 and curTest.cbToReadWrite > 0: … … 2804 2867 # re-read & compare the written data. 2805 2868 try: 2806 curFile.seek(-(curTest.cbToReadWrite), vboxcon.FileSeekType_Current); 2869 if self.oTstDrv.fpApiVer >= 5.0: 2870 curFile.seek(-(curTest.cbToReadWrite), vboxcon.FileSeekOrigin_Current); 2871 else: 2872 curFile.seek(-(curTest.cbToReadWrite), vboxcon.FileSeekType_Current); 2807 2873 except: 2808 2874 reporter.logXcpt('Seeking back to initial write position failed:');
Note:
See TracChangeset
for help on using the changeset viewer.