Changeset 65967 in vbox
- Timestamp:
- Mar 7, 2017 10:54:16 AM (8 years ago)
- Location:
- trunk/src/VBox/ValidationKit/testdriver
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testdriver/base.py
r65732 r65967 306 306 return False; 307 307 sCurName = sCurName.strip(); 308 if sCurName is'':308 if sCurName == '': 309 309 return False; 310 310 … … 1094 1094 return self.pollTasks(); 1095 1095 1096 if len(self.aoTasks) == 0:1096 if not self.aoTasks: 1097 1097 return None; 1098 1098 … … 1544 1544 del dPids[iPid]; 1545 1545 1546 if len(dPids) == 0:1546 if not dPids: 1547 1547 reporter.log('All done.'); 1548 1548 return True; -
trunk/src/VBox/ValidationKit/testdriver/btresolver.py
r65378 r65967 99 99 asMembers = utils.unpackFile(sDbgArchive, self.sScratchPath, self.fnLog, 100 100 self.fnLog); 101 if asMembers is not None and len(asMembers) > 0:101 if asMembers: 102 102 # Populate the list of debug files. 103 103 for sMember in asMembers: … … 155 155 for sLine in asReport[iLine:]: 156 156 asCandidate = sLine.split(); 157 if len(asCandidate) is5 \157 if len(asCandidate) == 5 \ 158 158 and asCandidate[0].startswith('0x') \ 159 159 and asCandidate[1].startswith('0x') \ … … 300 300 while iLine < len(asReport): 301 301 asMatches = oRegExpPath.findall(asReport[iLine]); 302 if len(asMatches) > 0:302 if asMatches: 303 303 # Line contains the path, extract start address and path to binary 304 304 sAddr = oRegExpAddr.findall(asReport[iLine]); 305 305 sPath = oRegExpBinPath.findall(asReport[iLine]); 306 306 307 if len(sAddr) > 0 and len(sPath) > 0:307 if sAddr and sPath: 308 308 # Construct the path in into the build cache containing the debug symbols 309 309 oRegExp = re.compile(r'\w+\.{0,1}\w*$'); … … 338 338 # and the first one is a number. 339 339 if len(asStackTrace) == 6 and asStackTrace[0].isdigit() \ 340 and (asStackTrace[1].find('VBox') is not -1 or asStackTrace[1].find('VirtualBox') is not-1) \340 and (asStackTrace[1].find('VBox') != -1 or asStackTrace[1].find('VirtualBox') != -1) \ 341 341 and asStackTrace[3].startswith('0x'): 342 342 … … 404 404 asMembers = utils.unpackFile(sDbgArchive, self.sScratchPath, self.fnLog, 405 405 self.fnLog); 406 if asMembers is not None and len(asMembers) > 0:406 if asMembers: 407 407 # Populate the list of debug files. 408 408 for sMember in asMembers: … … 589 589 asListBinaries = self.oResolverOs.getBinaryListWithLoadAddrFromReport(sReport.split('\n')); 590 590 591 if len(asListBinaries) > 0:591 if asListBinaries: 592 592 asArgs = [self.sRTLdrFltPath, ]; 593 593 -
trunk/src/VBox/ValidationKit/testdriver/reporter.py
r65857 r65967 325 325 326 326 # Flush buffers when reaching the last test. 327 if len(self.atTests) == 0:327 if not self.atTests: 328 328 self.xmlFlush(fRetry = True); 329 329 … … 344 344 Returns True if no open tests, False if there were open tests. 345 345 """ 346 if len(self.atTests) == 0:346 if not self.atTests: 347 347 return True; 348 348 for _ in range(len(self.atTests)): … … 450 450 if self.oXmlFile is not None: 451 451 # pop the test stack 452 while len(self.atTests) > 0:452 while self.atTests: 453 453 sName, cErrorsStart, self.fTimedOut = self.atTests.pop(); 454 454 self._xmlWrite([ '<End timestamp="%s" errors="%d"/>' % (sTsIso, self.cErrors - cErrorsStart,), … … 538 538 self.log(0, 'error writing %s: %s' % (sDstFilename, oXcpt), sCaller, sTsPrf); 539 539 else: 540 if len(abBuf) > 0:540 if abBuf: 541 541 continue; 542 542 break; … … 693 693 def __del__(self): 694 694 """Flush pending log messages?""" 695 if len(self._asXml) > 0:695 if self._asXml: 696 696 self._xmlDoFlush(self._asXml, fRetry = True, fDtor = True); 697 697 … … 955 955 asXml = self._asXml; 956 956 self._asXml = []; 957 if len(asXml) > 0 orfForce is True:957 if asXml or fForce is True: 958 958 self._fXmlFlushing = True; 959 959 … … 1030 1030 1031 1031 def doPollWork(self, sDebug = None): 1032 if len(self._asXml) > 0:1032 if self._asXml: 1033 1033 g_oLock.acquire(); 1034 1034 try: … … 1083 1083 g_oReporter.log(0, '** internal-error: Hit exception #2! %s' % (traceback.format_exc()), sCaller, sTsPrf); 1084 1084 1085 if len(asInfo) > 0:1085 if asInfo: 1086 1086 # Do the logging. 1087 1087 for sItem in asInfo: … … 1193 1193 sText.strip(); 1194 1194 idxText = 0; 1195 while len(sText) > 0:1195 while sText: 1196 1196 if self.sTagBuffer is None: 1197 1197 # Look for the start of a tag. -
trunk/src/VBox/ValidationKit/testdriver/txsclient.py
r62484 r65967 257 257 ord(sOpcode[6]), \ 258 258 ord(sOpcode[7]) ) ) ); 259 if len(abPayload) > 0:259 if abPayload: 260 260 abMsg.extend(abPayload); 261 261 except: … … 282 282 283 283 # Read the header. 284 if len(self.abReadAheadHdr) > 0:284 if self.abReadAheadHdr: 285 285 assert(len(self.abReadAheadHdr) == 16); 286 286 abHdr = self.abReadAheadHdr; … … 756 756 rc = None; 757 757 break; 758 if len(sInput) > 0:758 if sInput: 759 759 oStdIn.uTxsClientCrc32 = zlib.crc32(sInput, oStdIn.uTxsClientCrc32); 760 760 # Convert to a byte array before handing it of to sendMsg or the string … … 1090 1090 # Update the file stream CRC and send it off. 1091 1091 uMyCrc32 = zlib.crc32(abBuf, uMyCrc32); 1092 if len(abBuf) == 0:1092 if not abBuf: 1093 1093 rc = self.sendMsg('DATA EOF', (long(uMyCrc32 & 0xffffffff), )); 1094 1094 else: … … 1108 1108 1109 1109 # EOF? 1110 if len(abBuf) == 0:1110 if not abBuf: 1111 1111 break; 1112 1112 … … 1149 1149 rc = self.taskDownloadCommon(sRemoteFile, oLocalString); 1150 1150 if rc is True: 1151 if len(oLocalString.asContent) == 0:1151 if not oLocalString.asContent: 1152 1152 rc = ''; 1153 1153 else: … … 1930 1930 self.oSocket.setblocking(0); # just in case it's not set. 1931 1931 sData = "1"; 1932 while len(sData) > 0:1932 while sData: 1933 1933 sData = self.oSocket.recv(16384); 1934 1934 except: … … 1946 1946 self.oCv.release(); 1947 1947 1948 def sendBytes(self, ab Msg, cMsTimeout):1948 def sendBytes(self, abBuf, cMsTimeout): 1949 1949 if self.oSocket is None: 1950 1950 reporter.error('TransportTcp.sendBytes: No connection.'); … … 1953 1953 # Try send it all. 1954 1954 try: 1955 cbSent = self.oSocket.send(ab Msg);1956 if cbSent == len(ab Msg):1955 cbSent = self.oSocket.send(abBuf); 1956 if cbSent == len(abBuf): 1957 1957 return True; 1958 1958 except Exception, oXcpt: 1959 1959 if not self.__isWouldBlockXcpt(oXcpt): 1960 reporter.errorXcpt('TranportTcp.sendBytes: %s bytes' % (len(ab Msg)));1960 reporter.errorXcpt('TranportTcp.sendBytes: %s bytes' % (len(abBuf))); 1961 1961 return False; 1962 1962 cbSent = 0; … … 1967 1967 cMsElapsed = base.timestampMilli() - msStart; 1968 1968 if cMsElapsed > cMsTimeout: 1969 reporter.error('TranportTcp.sendBytes: %s bytes timed out (1)' % (len(ab Msg)));1969 reporter.error('TranportTcp.sendBytes: %s bytes timed out (1)' % (len(abBuf))); 1970 1970 break; 1971 1971 … … 1973 1973 try: 1974 1974 ttRc = select.select([], [self.oSocket], [self.oSocket], (cMsTimeout - cMsElapsed) / 1000.0); 1975 if len(ttRc[2]) > 0 and len(ttRc[1]) == 0:1975 if ttRc[2] and not ttRc[1]: 1976 1976 reporter.error('TranportTcp.sendBytes: select returned with exception'); 1977 1977 break; 1978 if len(ttRc[1]) == 0:1979 reporter.error('TranportTcp.sendBytes: %s bytes timed out (2)' % (len(ab Msg)));1978 if not ttRc[1]: 1979 reporter.error('TranportTcp.sendBytes: %s bytes timed out (2)' % (len(abBuf))); 1980 1980 break; 1981 1981 except: … … 1985 1985 # Try send more. 1986 1986 try: 1987 cbSent += self.oSocket.send(ab Msg[cbSent:]);1988 if cbSent == len(ab Msg):1987 cbSent += self.oSocket.send(abBuf[cbSent:]); 1988 if cbSent == len(abBuf): 1989 1989 return True; 1990 1990 except Exception, oXcpt: 1991 1991 if not self.__isWouldBlockXcpt(oXcpt): 1992 reporter.errorXcpt('TranportTcp.sendBytes: %s bytes' % (len(ab Msg)));1992 reporter.errorXcpt('TranportTcp.sendBytes: %s bytes' % (len(abBuf))); 1993 1993 break; 1994 1994 … … 2011 2011 try: 2012 2012 abBuf = self.oSocket.recv(cb - len(self.abReadAhead)); 2013 if len(abBuf) > 0:2013 if abBuf: 2014 2014 self.abReadAhead.extend(array.array('B', abBuf)); 2015 2015 except Exception, oXcpt: … … 2026 2026 cMsElapsed = base.timestampMilli() - msStart; 2027 2027 if cMsElapsed > cMsTimeout: 2028 if not fNoDataOk or len(self.abReadAhead) > 0:2028 if not fNoDataOk or self.abReadAhead: 2029 2029 reporter.error('TranportTcp.recvBytes: %s/%s bytes timed out (1)' % (len(self.abReadAhead), cb)); 2030 2030 break; … … 2033 2033 try: 2034 2034 ttRc = select.select([self.oSocket], [], [self.oSocket], (cMsTimeout - cMsElapsed) / 1000.0); 2035 if len(ttRc[2]) > 0 and len(ttRc[0]) == 0:2035 if ttRc[2] and not ttRc[0]: 2036 2036 reporter.error('TranportTcp.recvBytes: select returned with exception'); 2037 2037 break; 2038 if len(ttRc[0]) == 0:2039 if not fNoDataOk or len(self.abReadAhead) > 0:2038 if not ttRc[0]: 2039 if not fNoDataOk or self.abReadAhead: 2040 2040 reporter.error('TranportTcp.recvBytes: %s/%s bytes timed out (2) fNoDataOk=%s' 2041 2041 % (len(self.abReadAhead), cb, fNoDataOk)); … … 2048 2048 try: 2049 2049 abBuf = self.oSocket.recv(cb - len(self.abReadAhead)); 2050 if len(abBuf) == 0:2050 if not abBuf: 2051 2051 reporter.error('TranportTcp.recvBytes: %s/%s bytes (%s) - connection has been shut down' 2052 2052 % (len(self.abReadAhead), cb, fNoDataOk)); … … 2059 2059 reporter.log('recv => exception %s' % (oXcpt,)); 2060 2060 if not self.__isWouldBlockXcpt(oXcpt): 2061 if not fNoDataOk or not self.__isConnectionReset(oXcpt) or len(self.abReadAhead) > 0:2061 if not fNoDataOk or not self.__isConnectionReset(oXcpt) or self.abReadAhead: 2062 2062 reporter.errorXcpt('TranportTcp.recvBytes: %s/%s bytes (%s)' % (len(self.abReadAhead), cb, fNoDataOk)); 2063 2063 break; … … 2075 2075 try: 2076 2076 ttRc = select.select([], [], [self.oSocket], 0.0); 2077 if len(ttRc[2]) > 0:2077 if ttRc[2]: 2078 2078 return False; 2079 2079 … … 2086 2086 try: 2087 2087 ttRc = select.select([self.oSocket], [], [], cMsTimeout / 1000.0); 2088 if len(ttRc[0]) == 0:2088 if not ttRc[0]: 2089 2089 return False; 2090 2090 except: -
trunk/src/VBox/ValidationKit/testdriver/vbox.py
r65513 r65967 2416 2416 ## @todo Do this elsewhere. 2417 2417 # Hack alert. Disables all annoying GUI popups. 2418 if sType == 'gui' and len(self.aoRemoteSessions) == 0:2418 if sType == 'gui' and not self.aoRemoteSessions: 2419 2419 try: 2420 2420 self.oVBox.setExtraData('GUI/Input/AutoCapture', 'false'); … … 2456 2456 if sType == 'gui': 2457 2457 sEnv += '\nVBOX_GUI_DBG_ENABLED=1' 2458 if asEnv is not None and len(asEnv) > 0:2458 if asEnv is not None and asEnv: 2459 2459 sEnv += '\n' + ('\n'.join(asEnv)); 2460 2460 … … 2647 2647 for iCpu in xrange(0, cCpus): 2648 2648 sThis = oSession.queryDbgGuestStack(iCpu); 2649 if sThis is not None and len(sThis) > 0:2649 if sThis: 2650 2650 asMiscInfos += [ 2651 2651 '================ start guest stack VCPU %s ================\n' % (iCpu,), … … 2671 2671 continue; 2672 2672 sThis = oSession.queryDbgInfo(sInfo, sArg); 2673 if sThis is not None and len(sThis) > 0:2673 if sThis: 2674 2674 if sThis[-1] != '\n': 2675 2675 sThis += '\n'; … … 2767 2767 2768 2768 # Add the "info xxxx" items if we've got any. 2769 if len(asMiscInfos) > 0:2769 if asMiscInfos: 2770 2770 reporter.addLogString(u''.join(asMiscInfos), 'info.txt', 'info/collection', 'A bunch of info items.'); 2771 2771 -
trunk/src/VBox/ValidationKit/testdriver/vboxinstaller.py
r65313 r65967 102 102 # End of our parameters and start of the sub driver invocation. 103 103 iArg = self.requireMoreArgs(1, asArgs, iArg); 104 assert len(self._asSubDriver) == 0;104 assert not self._asSubDriver; 105 105 self._asSubDriver = asArgs[iArg:]; 106 106 self._asSubDriver[0] = self._asSubDriver[0].replace('/', os.path.sep); … … 122 122 # Check that we've got what we need. 123 123 # 124 if len(self._asBuildUrls) == 0:124 if not self._asBuildUrls: 125 125 reporter.error('No build files specfiied ("--vbox-build file1[,file2[...]]")'); 126 126 return False; 127 if len(self._asSubDriver) == 0:127 if not self._asSubDriver: 128 128 reporter.error('No sub testdriver specified. (" -- test/stuff/tdStuff1.py args")'); 129 129 return False; … … 228 228 try: 229 229 oFile = open(sFull, 'w'); 230 if len(sValue) > 0:230 if sValue: 231 231 oFile.write(sValue.encode('utf-8')); 232 232 oFile.close(); … … 314 314 if iIteration in [0, 21] and sBase in [ 'windbg', 'gdb', 'gdb-i386-apple-darwin', ]: 315 315 reporter.log('Warning: debugger running: %s (%s)' % (oProcess.iPid, sBase,)); 316 if len(aoTodo) == 0:316 if not aoTodo: 317 317 return True; 318 318 -
trunk/src/VBox/ValidationKit/testdriver/vboxtestvms.py
r65835 r65967 626 626 raise base.InvalidOption('The "--paravirt-modes" value "%s" is not valid; valid values are: %s' 627 627 % (sPvMode, ', '.join(g_kasParavirtProviders),)); 628 if len(self.asParavirtModes) == 0:628 if not self.asParavirtModes: 629 629 self.asParavirtModes = None; 630 630
Note:
See TracChangeset
for help on using the changeset viewer.