- Timestamp:
- Feb 23, 2022 12:48:02 PM (3 years ago)
- Location:
- trunk/src/VBox/ValidationKit
- Files:
-
- 3 edited
-
testdriver/txsclient.py (modified) (2 diffs)
-
testdriver/vbox.py (modified) (1 diff)
-
utils/TestExecServ/TestExecService.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testdriver/txsclient.py
r93156 r93895 1087 1087 #def "LIST " 1088 1088 1089 def taskCopyFile(self, sSrcFile, sDstFile, fMode, fFallbackOkay): 1090 """ Copies a file within the remote from source to destination. """ 1091 # Note: If fMode is set to 0, it's up to the target OS' implementation with 1092 # what a file mode the destination file gets created (i.e. via umask). 1093 rc = self.sendMsg('CPFILE', (fMode, sSrcFile, sDstFile,)); 1094 if rc is True: 1095 rc = self.recvAckLogged('CPFILE'); 1096 return rc; 1097 1089 1098 def taskUploadFile(self, sLocalFile, sRemoteFile, fMode, fFallbackOkay): 1090 1099 # … … 1715 1724 return Session.calcFileXferTimeout(cbFile); 1716 1725 1726 def asyncCopyFile(self, sSrcFile, sDstFile, 1727 fMode = 0, fFallbackOkay = True, cMsTimeout = 30000, fIgnoreErrors = False): 1728 """ 1729 Initiates a file copying task on the remote. 1730 1731 Returns True on success, False on failure (logged). 1732 1733 The task returns True on success, False on failure (logged). 1734 """ 1735 return self.startTask(cMsTimeout, fIgnoreErrors, "cpfile", 1736 self.taskCopyFile, (sSrcFile, sDstFile, fMode, fFallbackOkay)); 1737 1717 1738 def asyncUploadFile(self, sLocalFile, sRemoteFile, 1718 1739 fMode = 0, fFallbackOkay = True, cMsTimeout = 30000, fIgnoreErrors = False): -
trunk/src/VBox/ValidationKit/testdriver/vbox.py
r93115 r93895 3667 3667 (sRemoteSymlink, self.adjustTimeoutMs(cMsTimeout), fIgnoreErrors)); 3668 3668 3669 def txsCopyFile(self, oSession, oTxsSession, sSrcFile, sDstFile, fMode = 0, cMsTimeout = 30000, fIgnoreErrors = False): 3670 return self.txsDoTask(oSession, oTxsSession, oTxsSession.asyncCopyFile, \ 3671 (sSrcFile, sDstFile, fMode, self.adjustTimeoutMs(cMsTimeout), fIgnoreErrors)); 3672 3669 3673 def txsUploadFile(self, oSession, oTxsSession, sLocalFile, sRemoteFile, cMsTimeout = 30000, fIgnoreErrors = False): 3670 3674 return self.txsDoTask(oSession, oTxsSession, oTxsSession.asyncUploadFile, \ -
trunk/src/VBox/ValidationKit/utils/TestExecServ/TestExecService.cpp
r93747 r93895 660 660 * @returns true if valid, false if invalid. 661 661 * @param pPktHdr The packet being unpacked. 662 * @param pszArgName The argument name.662 * @param pszArgName The argument name. 663 663 * @param psz Pointer to the string within pPktHdr. 664 664 * @param ppszExp Where to return the expanded string. Must be … … 1007 1007 1008 1008 RTStrFree(pszPath); 1009 return rc; 1010 } 1011 1012 /** 1013 * Copies a file from the source to the destination locally. 1014 * 1015 * @returns IPRT status code from send. 1016 * @param pPktHdr The copy file packet. 1017 */ 1018 static int txsDoCopyFile(PCTXSPKTHDR pPktHdr) 1019 { 1020 /* After the packet header follows a 32-bit file mode, 1021 * the remainder of the packet are two zero terminated paths. */ 1022 size_t const cbMin = sizeof(TXSPKTHDR) + sizeof(RTFMODE) + 2; 1023 if (pPktHdr->cb < cbMin) 1024 return txsReplyBadMinSize(pPktHdr, cbMin); 1025 1026 RTFMODE const fMode = *(RTFMODE const *)(pPktHdr + 1); 1027 1028 int rc; 1029 1030 char *pszSrc; 1031 const char *pch; 1032 if (txsIsStringValid(pPktHdr, "source", (const char *)(pPktHdr + 1) + sizeof(uint32_t) * 2, &pszSrc, &pch, &rc)) 1033 { 1034 char *pszDst; 1035 if (txsIsStringValid(pPktHdr, "dest", pch, &pszDst, NULL /* Check for string termination */, &rc)) 1036 { 1037 rc = RTFileCopy(pszSrc, pszDst); 1038 if (RT_SUCCESS(rc)) 1039 { 1040 if (fMode) /* Do we need to set the file mode? */ 1041 { 1042 rc = RTPathSetMode(pszDst, fMode); 1043 if (RT_FAILURE(rc)) 1044 rc = txsReplyRC(pPktHdr, rc, "RTPathSetMode(\"%s\", %#x)", pszDst, fMode); 1045 } 1046 1047 if (RT_SUCCESS(rc)) 1048 rc = txsReplyAck(pPktHdr); 1049 } 1050 else 1051 rc = txsReplyRC(pPktHdr, rc, "RTFileCopy"); 1052 RTStrFree(pszDst); 1053 } 1054 1055 RTStrFree(pszSrc); 1056 } 1057 1009 1058 return rc; 1010 1059 } … … 3105 3154 else if (txsIsSameOpcode(pPktHdr, "LIST ")) 3106 3155 rc = txsDoList(pPktHdr); 3156 else if (txsIsSameOpcode(pPktHdr, "CPFILE ")) 3157 rc = txsDoCopyFile(pPktHdr); 3107 3158 else if (txsIsSameOpcode(pPktHdr, "PUT FILE")) 3108 3159 rc = txsDoPutFile(pPktHdr, false /*fHasMode*/); … … 3973 4024 return rcExit; 3974 4025 } 3975
Note:
See TracChangeset
for help on using the changeset viewer.

