Changeset 65963 in vbox
- Timestamp:
- Mar 7, 2017 10:30:26 AM (8 years ago)
- Location:
- trunk/src/VBox/ValidationKit/tests
- Files:
-
- 8 edited
-
additions/tdAddGuestCtrl.py (modified) (2 diffs)
-
autostart/tdAutostart1.py (modified) (1 diff)
-
storage/remoteexecutor.py (modified) (1 diff)
-
storage/storagecfg.py (modified) (1 diff)
-
storage/tdStorageBenchmark1.py (modified) (10 diffs)
-
teleportation/tdTeleportLocal1.py (modified) (1 diff)
-
unittests/tdUnitTest1.py (modified) (2 diffs)
-
usb/usbgadget.py (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py
r62484 r65963 1403 1403 reporter.log2('Test #%d passed: Buffers match (%d bytes)' % (i, len(oRes.sBuf))); 1404 1404 elif oRes.sBuf is not None \ 1405 and len(oRes.sBuf):1405 and oRes.sBuf: 1406 1406 reporter.error('Test #%d failed: Got no buffer data, expected\n%s (%dbytes)' % 1407 1407 (i, map(hex, map(ord, oRes.sBuf)), len(oRes.sBuf))); … … 1460 1460 or waitResult == vboxcon.ProcessWaitResult_WaitFlagNotSupported: 1461 1461 reporter.log2('Reading stdout ...'); 1462 buf = curProc.Read(1, 64 * 1024, oTest.timeoutMS);1463 if len(buf):1464 reporter.log2('Process (PID %d) got %d bytes of stdout data' % (curProc.PID, len( buf)));1465 oTest.cbStdOut += len( buf);1466 oTest.sBuf = buf; # Appending does *not* work atm, so just assign it. No time now.1462 abBuf = curProc.Read(1, 64 * 1024, oTest.timeoutMS); 1463 if abBuf: 1464 reporter.log2('Process (PID %d) got %d bytes of stdout data' % (curProc.PID, len(abBuf))); 1465 oTest.cbStdOut += len(abBuf); 1466 oTest.sBuf = abBuf; # Appending does *not* work atm, so just assign it. No time now. 1467 1467 # Try stderr. 1468 1468 if waitResult == vboxcon.ProcessWaitResult_StdErr \ 1469 1469 or waitResult == vboxcon.ProcessWaitResult_WaitFlagNotSupported: 1470 1470 reporter.log2('Reading stderr ...'); 1471 buf = curProc.Read(2, 64 * 1024, oTest.timeoutMS);1472 if len(buf):1473 reporter.log2('Process (PID %d) got %d bytes of stderr data' % (curProc.PID, len( buf)));1474 oTest.cbStdErr += len( buf);1475 oTest.sBuf = buf; # Appending does *not* work atm, so just assign it. No time now.1471 abBuf = curProc.Read(2, 64 * 1024, oTest.timeoutMS); 1472 if abBuf: 1473 reporter.log2('Process (PID %d) got %d bytes of stderr data' % (curProc.PID, len(abBuf))); 1474 oTest.cbStdErr += len(abBuf); 1475 oTest.sBuf = abBuf; # Appending does *not* work atm, so just assign it. No time now. 1476 1476 # Use stdin. 1477 1477 if waitResult == vboxcon.ProcessWaitResult_StdIn \ -
trunk/src/VBox/ValidationKit/tests/autostart/tdAutostart1.py
r62484 r65963 69 69 # Extract the value 70 70 idxVmNameStart = sLine.find('"'); 71 if idxVmNameStart is-1:71 if idxVmNameStart == -1: 72 72 raise Exception('VBoxManageStdOutWrapper: Invalid output'); 73 73 -
trunk/src/VBox/ValidationKit/tests/storage/remoteexecutor.py
r65747 r65963 101 101 if self.oTxsSession is not None: 102 102 return self.oTxsSession.syncIsFile(sFile); 103 else: 104 return os.path.isfile(sFile); 103 return os.path.isfile(sFile); 105 104 106 105 def _getBinaryPath(self, sBinary): -
trunk/src/VBox/ValidationKit/tests/storage/storagecfg.py
r65746 r65963 291 291 fRc = oExec.execBinaryNoStdOut('sfdisk', ('--no-reread', '--wipe', 'always', '-q', '-f', sDiskPath), sFdiskScript); 292 292 if fRc: 293 if sDiskPath.find('nvme') is not-1:293 if sDiskPath.find('nvme') != -1: 294 294 sBlkDev = sDiskPath + 'p1'; 295 295 else: -
trunk/src/VBox/ValidationKit/tests/storage/tdStorageBenchmark1.py
r65731 r65963 228 228 # Extract the value 229 229 idxValue = sLine.rfind('='); 230 if idxValue is-1:230 if idxValue == -1: 231 231 raise Exception('IozoneTest: Invalid state'); 232 232 … … 243 243 244 244 for sNeedle, sTestVal in self.lstTests: 245 if sLine.rfind(sNeedle) is not-1:245 if sLine.rfind(sNeedle) != -1: 246 246 reporter.testValue(sTestVal, sLine[idxValue:idxValueEnd], 247 247 constants.valueunit.g_asNames[constants.valueunit.KILOBYTES_PER_SEC]); … … 281 281 # Get the first non blacklisted test. 282 282 asTestCfg = self.getCurrentTestCfg(); 283 while len(asTestCfg) > 0and self.isTestCfgBlacklisted(asTestCfg):283 while asTestCfg and self.isTestCfgBlacklisted(asTestCfg): 284 284 asTestCfg = self.advanceTestCfg(); 285 285 … … 305 305 if fnTestFmt is not None: 306 306 return fnTestFmt(oCfg); 307 else: 308 return oCfg; 307 return oCfg; 309 308 310 309 def isTestCfgBlacklisted(self, asTestCfg): … … 375 374 376 375 asTestCfg = self.advanceTestCfg(); 377 while len(asTestCfg) > 0and self.isTestCfgBlacklisted(asTestCfg):376 while asTestCfg and self.isTestCfgBlacklisted(asTestCfg): 378 377 asTestCfg = self.advanceTestCfg(); 379 378 … … 381 380 # categories. 382 381 reporter.testDone(fSkippedLast); 383 if len(asTestCfg) > 0:382 if asTestCfg: 384 383 idxSame = 0; 385 384 while asTestCfgCur[idxSame] == asTestCfg[idxSame]: … … 832 831 if fHardDisk: 833 832 return ('ahci', False); 834 else: 835 return ('ahci', True); 836 elif eStorageCtrl == vboxcon.StorageControllerType_PIIX4: 833 return ('ahci', True); 834 if eStorageCtrl == vboxcon.StorageControllerType_PIIX4: 837 835 return ('piix3ide', False); 838 elif eStorageCtrl == vboxcon.StorageControllerType_LsiLogicSas:836 if eStorageCtrl == vboxcon.StorageControllerType_LsiLogicSas: 839 837 return ('lsilogicsas', True); 840 elif eStorageCtrl == vboxcon.StorageControllerType_LsiLogic:838 if eStorageCtrl == vboxcon.StorageControllerType_LsiLogic: 841 839 return ('lsilogicscsi', True); 842 elif eStorageCtrl == vboxcon.StorageControllerType_BusLogic:840 if eStorageCtrl == vboxcon.StorageControllerType_BusLogic: 843 841 return ('buslogic', True); 844 elif eStorageCtrl == vboxcon.StorageControllerType_NVMe:842 if eStorageCtrl == vboxcon.StorageControllerType_NVMe: 845 843 return ('nvme', False); 846 844 … … 854 852 # Check whether the disk variant is supported by the selected format. 855 853 asVariants = self.getDiskFormatVariantsForTesting(asTestCfg[self.kiDiskFmt], [ asTestCfg[self.kiDiskVar] ]); 856 if len(asVariants) == 0:854 if not asVariants: 857 855 return False; 858 856 859 857 # For iSCSI check whether we have targets configured. 860 if asTestCfg[self.kiDiskFmt] == 'iSCSI' and len(self.asIscsiTargets) == 0:858 if asTestCfg[self.kiDiskFmt] == 'iSCSI' and not self.asIscsiTargets: 861 859 return False; 862 860 … … 879 877 if cCpus == 1: 880 878 return '1 cpu'; 881 else: 882 return '%u cpus' % (cCpus); 879 return '%u cpus' % (cCpus); 883 880 884 881 def fnFormatVirtMode(self, sVirtMode): … … 1172 1169 fRc = True; 1173 1170 asTestCfg = oTstCfgMgr.getCurrentTestCfg(); 1174 while len(asTestCfg) > 0:1171 while asTestCfg: 1175 1172 fRc = self.testOneCfg(asTestCfg[self.kiVmName], self.getStorageCtrlFromName(asTestCfg[self.kiStorageCtrl]), \ 1176 1173 asTestCfg[self.kiHostIoCache], asTestCfg[self.kiDiskFmt], asTestCfg[self.kiDiskVar], -
trunk/src/VBox/ValidationKit/tests/teleportation/tdTeleportLocal1.py
r62484 r65963 115 115 iArg += 1; 116 116 if iArg >= len(asArgs): raise base.InvalidOption('The "--test-vms" takes colon separated list'); 117 if len(asArgs[iArg]) > 0:117 if asArgs[iArg]: 118 118 self.asTestVMs = asArgs[iArg].split(':'); 119 119 for s in self.asTestVMs: -
trunk/src/VBox/ValidationKit/tests/unittests/tdUnitTest1.py
r65236 r65963 346 346 sPathName = 'Path'; 347 347 sPath = os.environ.get(sPathName, '.'); 348 if len(sPath) > 0and sPath[-1] != ';':348 if sPath and sPath[-1] != ';': 349 349 sPath += ';'; 350 350 os.environ[sPathName] = sPath + self.sVBoxInstallRoot + ';'; … … 463 463 try: aiValue = [int(sComp) for sComp in sValue.replace('r', '.').split('.')]; 464 464 except: aiValue = (); 465 if len(aiValue) == 0or len(aiValue) > 4:465 if not aiValue or len(aiValue) > 4: 466 466 reporter.error('Invalid exclusion expression for %s: "%s" [%s]' % (sTest, sSubExpr, dExclList[sTest])); 467 467 return True; -
trunk/src/VBox/ValidationKit/tests/usb/usbgadget.py
r61831 r65963 349 349 ord(sOpcode[6]), \ 350 350 ord(sOpcode[7]) ) ) ); 351 if len(abPayload) > 0:351 if abPayload: 352 352 abMsg.extend(abPayload); 353 353 except: … … 374 374 375 375 # Read the header. 376 if len(self.abReadAheadHdr) > 0:376 if self.abReadAheadHdr: 377 377 assert(len(self.abReadAheadHdr) == 16); 378 378 abHdr = self.abReadAheadHdr; … … 1165 1165 self.oSocket.setblocking(0); # just in case it's not set. 1166 1166 sData = "1"; 1167 while len(sData) > 0:1167 while sData: 1168 1168 sData = self.oSocket.recv(16384); 1169 1169 except: … … 1181 1181 self.oCv.release(); 1182 1182 1183 def sendBytes(self, ab Msg, cMsTimeout):1183 def sendBytes(self, abBuf, cMsTimeout): 1184 1184 if self.oSocket is None: 1185 1185 reporter.error('TransportTcp.sendBytes: No connection.'); … … 1188 1188 # Try send it all. 1189 1189 try: 1190 cbSent = self.oSocket.send(ab Msg);1191 if cbSent == len(ab Msg):1190 cbSent = self.oSocket.send(abBuf); 1191 if cbSent == len(abBuf): 1192 1192 return True; 1193 1193 except Exception, oXcpt: 1194 1194 if not self.__isWouldBlockXcpt(oXcpt): 1195 reporter.errorXcpt('TranportTcp.sendBytes: %s bytes' % (len(ab Msg)));1195 reporter.errorXcpt('TranportTcp.sendBytes: %s bytes' % (len(abBuf))); 1196 1196 return False; 1197 1197 cbSent = 0; … … 1202 1202 cMsElapsed = base.timestampMilli() - msStart; 1203 1203 if cMsElapsed > cMsTimeout: 1204 reporter.error('TranportTcp.sendBytes: %s bytes timed out (1)' % (len(ab Msg)));1204 reporter.error('TranportTcp.sendBytes: %s bytes timed out (1)' % (len(abBuf))); 1205 1205 break; 1206 1206 … … 1208 1208 try: 1209 1209 ttRc = select.select([], [self.oSocket], [self.oSocket], (cMsTimeout - cMsElapsed) / 1000.0); 1210 if len(ttRc[2]) > 0 and len(ttRc[1]) == 0:1210 if ttRc[2] and not ttRc[1]: 1211 1211 reporter.error('TranportTcp.sendBytes: select returned with exception'); 1212 1212 break; 1213 if len(ttRc[1]) == 0:1214 reporter.error('TranportTcp.sendBytes: %s bytes timed out (2)' % (len(ab Msg)));1213 if not ttRc[1]: 1214 reporter.error('TranportTcp.sendBytes: %s bytes timed out (2)' % (len(abBuf))); 1215 1215 break; 1216 1216 except: … … 1220 1220 # Try send more. 1221 1221 try: 1222 cbSent += self.oSocket.send(ab Msg[cbSent:]);1223 if cbSent == len(ab Msg):1222 cbSent += self.oSocket.send(abBuf[cbSent:]); 1223 if cbSent == len(abBuf): 1224 1224 return True; 1225 1225 except Exception, oXcpt: 1226 1226 if not self.__isWouldBlockXcpt(oXcpt): 1227 reporter.errorXcpt('TranportTcp.sendBytes: %s bytes' % (len(ab Msg)));1227 reporter.errorXcpt('TranportTcp.sendBytes: %s bytes' % (len(abBuf))); 1228 1228 break; 1229 1229 … … 1246 1246 try: 1247 1247 abBuf = self.oSocket.recv(cb - len(self.abReadAhead)); 1248 if len(abBuf) > 0:1248 if abBuf: 1249 1249 self.abReadAhead.extend(array.array('B', abBuf)); 1250 1250 except Exception, oXcpt: … … 1261 1261 cMsElapsed = base.timestampMilli() - msStart; 1262 1262 if cMsElapsed > cMsTimeout: 1263 if not fNoDataOk or len(self.abReadAhead) > 0:1263 if not fNoDataOk or self.abReadAhead: 1264 1264 reporter.error('TranportTcp.recvBytes: %s/%s bytes timed out (1)' % (len(self.abReadAhead), cb)); 1265 1265 break; … … 1268 1268 try: 1269 1269 ttRc = select.select([self.oSocket], [], [self.oSocket], (cMsTimeout - cMsElapsed) / 1000.0); 1270 if len(ttRc[2]) > 0 and len(ttRc[0]) == 0:1270 if ttRc[2] and not ttRc[0]: 1271 1271 reporter.error('TranportTcp.recvBytes: select returned with exception'); 1272 1272 break; 1273 if len(ttRc[0]) == 0:1274 if not fNoDataOk or len(self.abReadAhead) > 0:1273 if not ttRc[0]: 1274 if not fNoDataOk or self.abReadAhead: 1275 1275 reporter.error('TranportTcp.recvBytes: %s/%s bytes timed out (2) fNoDataOk=%s' 1276 1276 % (len(self.abReadAhead), cb, fNoDataOk)); … … 1283 1283 try: 1284 1284 abBuf = self.oSocket.recv(cb - len(self.abReadAhead)); 1285 if len(abBuf) == 0:1285 if not abBuf: 1286 1286 reporter.error('TranportTcp.recvBytes: %s/%s bytes (%s) - connection has been shut down' 1287 1287 % (len(self.abReadAhead), cb, fNoDataOk)); … … 1294 1294 reporter.log('recv => exception %s' % (oXcpt,)); 1295 1295 if not self.__isWouldBlockXcpt(oXcpt): 1296 if not fNoDataOk or not self.__isConnectionReset(oXcpt) or len(self.abReadAhead) > 0:1296 if not fNoDataOk or not self.__isConnectionReset(oXcpt) or self.abReadAhead: 1297 1297 reporter.errorXcpt('TranportTcp.recvBytes: %s/%s bytes (%s)' % (len(self.abReadAhead), cb, fNoDataOk)); 1298 1298 break; … … 1310 1310 try: 1311 1311 ttRc = select.select([], [], [self.oSocket], 0.0); 1312 if len(ttRc[2]) > 0:1312 if ttRc[2]: 1313 1313 return False; 1314 1314 … … 1321 1321 try: 1322 1322 ttRc = select.select([self.oSocket], [], [], cMsTimeout / 1000.0); 1323 if len(ttRc[0]) == 0:1323 if not ttRc[0]: 1324 1324 return False; 1325 1325 except:
Note:
See TracChangeset
for help on using the changeset viewer.

