Changeset 79447 in vbox
- Timestamp:
- Jul 1, 2019 3:48:27 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testdriver/txsclient.py
r79245 r79447 365 365 abPayload.append(ord(ch)) 366 366 abPayload.append(0); 367 elif isinstance(o, long):367 elif isinstance(o, (long, int)): 368 368 if o < 0 or o > 0xffffffff: 369 369 reporter.fatal('sendMsg: uint32_t payload is out of range: %s' % (hex(o))); … … 1005 1005 return rc; 1006 1006 1007 #def "CHMOD " 1008 #def "CHOWN " 1009 #def "CHGRP " 1007 def taskChMod(self, sRemotePath, fMode): 1008 rc = self.sendMsg('CHMOD', (int(fMode), sRemotePath,)); 1009 if rc is True: 1010 rc = self.recvAckLogged('CHMOD'); 1011 return rc; 1012 1013 def taskChOwn(self, sRemotePath, idUser, idGroup): 1014 rc = self.sendMsg('CHOWN', (int(idUser), int(idGroup), sRemotePath,)); 1015 if rc is True: 1016 rc = self.recvAckLogged('CHOWN'); 1017 return rc; 1010 1018 1011 1019 def taskIsDir(self, sRemoteDir): … … 1031 1039 #def "LIST " 1032 1040 1033 def taskUploadFile(self, sLocalFile, sRemoteFile ):1041 def taskUploadFile(self, sLocalFile, sRemoteFile, fMode, fFallbackOkay): 1034 1042 # 1035 1043 # Open the local file (make sure it exist before bothering TXS) and … … 1043 1051 1044 1052 # Common cause with taskUploadStr 1045 rc = self.taskUploadCommon(oLocalFile, sRemoteFile );1053 rc = self.taskUploadCommon(oLocalFile, sRemoteFile, fMode, fFallbackOkay); 1046 1054 1047 1055 # Cleanup. … … 1049 1057 return rc; 1050 1058 1051 def taskUploadString(self, sContent, sRemoteFile ):1059 def taskUploadString(self, sContent, sRemoteFile, fMode, fFallbackOkay): 1052 1060 # Wrap sContent in a file like class. 1053 1061 class InStringFile(object): # pylint: disable=too-few-public-methods … … 1068 1076 1069 1077 oLocalString = InStringFile(sContent); 1070 return self.taskUploadCommon(oLocalString, sRemoteFile );1071 1072 def taskUploadCommon(self, oLocalFile, sRemoteFile ):1078 return self.taskUploadCommon(oLocalString, sRemoteFile, fMode, fFallbackOkay); 1079 1080 def taskUploadCommon(self, oLocalFile, sRemoteFile, fMode, fFallbackOkay): 1073 1081 """Common worker used by taskUploadFile and taskUploadString.""" 1082 # 1074 1083 # Command + ACK. 1075 rc = self.sendMsg('PUT FILE', (sRemoteFile,)); 1076 if rc is True: 1077 rc = self.recvAckLogged('PUT FILE'); 1084 # 1085 # Only used the new PUT2FILE command if we've got a non-zero mode mask. 1086 # Fall back on the old command if the new one is not known by the TXS. 1087 # 1088 if fMode == 0: 1089 rc = self.sendMsg('PUT FILE', (sRemoteFile,)); 1090 if rc is True: 1091 rc = self.recvAckLogged('PUT FILE'); 1092 else: 1093 rc = self.sendMsg('PUT2FILE', (fMode, sRemoteFile)); 1094 if rc is True: 1095 rc = self.recvAck(); 1096 if rc is False: 1097 reporter.maybeErr(self.fErr, 'recvAckLogged: PUT2FILE transport error'); 1098 elif rc is not True: 1099 if rc[0] == 'UNKNOWN' and fFallbackOkay: 1100 # Fallback: 1101 rc = self.sendMsg('PUT FILE', (sRemoteFile,)); 1102 if rc is True: 1103 rc = self.recvAckLogged('PUT FILE'); 1104 else: 1105 reporter.maybeErr(self.fErr, 'recvAckLogged: PUT2FILE response was %s: %s' % (rc[0], rc[1],)); 1106 rc = False; 1078 1107 if rc is True: 1079 1108 # … … 1516 1545 return self.asyncToSync(self.asyncRmTree, sRemoteTree, cMsTimeout, fIgnoreErrors); 1517 1546 1518 #def "CHMOD " 1519 #def "CHOWN " 1520 #def "CHGRP " 1547 def asyncChMod(self, sRemotePath, fMode, cMsTimeout = 30000, fIgnoreErrors = False): 1548 """ 1549 Initiates a chmod task. 1550 1551 Returns True on success, False on failure (logged). 1552 1553 The task returns True on success, False on failure (logged). 1554 """ 1555 return self.startTask(cMsTimeout, fIgnoreErrors, "chMod", self.taskChMod, (sRemotePath, fMode)); 1556 1557 def syncChMod(self, sRemotePath, fMode, cMsTimeout = 30000, fIgnoreErrors = False): 1558 """Synchronous version.""" 1559 return self.asyncToSync(self.asyncChMod, sRemotePath, fMode, cMsTimeout, fIgnoreErrors); 1560 1561 def asyncChOwn(self, sRemotePath, idUser, idGroup, cMsTimeout = 30000, fIgnoreErrors = False): 1562 """ 1563 Initiates a chown task. 1564 1565 Returns True on success, False on failure (logged). 1566 1567 The task returns True on success, False on failure (logged). 1568 """ 1569 return self.startTask(cMsTimeout, fIgnoreErrors, "chOwn", self.taskChOwn, (sRemotePath, idUser, idGroup)); 1570 1571 def syncChOwn(self, sRemotePath, idUser, idGroup, cMsTimeout = 30000, fIgnoreErrors = False): 1572 """Synchronous version.""" 1573 return self.asyncToSync(self.asyncChMod, sRemotePath, idUser, idGroup, cMsTimeout, fIgnoreErrors); 1521 1574 1522 1575 def asyncIsDir(self, sRemoteDir, cMsTimeout = 30000, fIgnoreErrors = False): … … 1569 1622 #def "LIST " 1570 1623 1571 def asyncUploadFile(self, sLocalFile, sRemoteFile, cMsTimeout = 30000, fIgnoreErrors = False): 1624 def asyncUploadFile(self, sLocalFile, sRemoteFile, 1625 fMode = 0, fFallbackOkay = True, cMsTimeout = 30000, fIgnoreErrors = False): 1572 1626 """ 1573 1627 Initiates a download query task. … … 1577 1631 The task returns True on success, False on failure (logged). 1578 1632 """ 1579 return self.startTask(cMsTimeout, fIgnoreErrors, "upload", self.taskUploadFile, (sLocalFile, sRemoteFile)); 1580 1581 def syncUploadFile(self, sLocalFile, sRemoteFile, cMsTimeout = 30000, fIgnoreErrors = False): 1582 """Synchronous version.""" 1583 return self.asyncToSync(self.asyncUploadFile, sLocalFile, sRemoteFile, cMsTimeout, fIgnoreErrors); 1584 1585 def asyncUploadString(self, sContent, sRemoteFile, cMsTimeout = 30000, fIgnoreErrors = False): 1633 return self.startTask(cMsTimeout, fIgnoreErrors, "upload", 1634 self.taskUploadFile, (sLocalFile, sRemoteFile, fMode, fFallbackOkay)); 1635 1636 def syncUploadFile(self, sLocalFile, sRemoteFile, fMode = 0, fFallbackOkay = True, cMsTimeout = 30000, fIgnoreErrors = False): 1637 """Synchronous version.""" 1638 return self.asyncToSync(self.asyncUploadFile, sLocalFile, sRemoteFile, fMode, fFallbackOkay, cMsTimeout, fIgnoreErrors); 1639 1640 def asyncUploadString(self, sContent, sRemoteFile, 1641 fMode = 0, fFallbackOkay = True, cMsTimeout = 30000, fIgnoreErrors = False): 1586 1642 """ 1587 1643 Initiates a upload string task. … … 1591 1647 The task returns True on success, False on failure (logged). 1592 1648 """ 1593 return self.startTask(cMsTimeout, fIgnoreErrors, "uploadString", self.taskUploadString, (sContent, sRemoteFile)); 1594 1595 def syncUploadString(self, sContent, sRemoteFile, cMsTimeout = 30000, fIgnoreErrors = False): 1596 """Synchronous version.""" 1597 return self.asyncToSync(self.asyncUploadString, sContent, sRemoteFile, cMsTimeout, fIgnoreErrors); 1649 return self.startTask(cMsTimeout, fIgnoreErrors, "uploadString", 1650 self.taskUploadString, (sContent, sRemoteFile, fMode, fFallbackOkay)); 1651 1652 def syncUploadString(self, sContent, sRemoteFile, fMode = 0, fFallbackOkay = True, cMsTimeout = 30000, fIgnoreErrors = False): 1653 """Synchronous version.""" 1654 return self.asyncToSync(self.asyncUploadString, sContent, sRemoteFile, fMode, fFallbackOkay, cMsTimeout, fIgnoreErrors); 1598 1655 1599 1656 def asyncDownloadFile(self, sRemoteFile, sLocalFile, cMsTimeout = 30000, fIgnoreErrors = False):
Note:
See TracChangeset
for help on using the changeset viewer.