Changeset 94129 in vbox
- Timestamp:
- Mar 8, 2022 2:57:25 PM (3 years ago)
- Location:
- trunk/src/VBox/ValidationKit/testmanager
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testmanager/batch/filearchiver.py
r93115 r94129 123 123 124 124 utils.noxcptDeleteFile(sZipFileNm + '.tmp'); 125 oZipFile = zipfile.ZipFile(sZipFileNm + '.tmp', 'w', zipfile.ZIP_DEFLATED, allowZip64 = True); 126 127 for sFile in asFiles: 128 sSuff = os.path.splitext(sFile)[1]; 129 if sSuff in [ '.png', '.webm', '.gz', '.bz2', '.zip', '.mov', '.avi', '.mpg', '.gif', '.jpg' ]: 130 ## @todo Consider storing these files outside the zip if they are a little largish. 131 self.dprint('TestSet %d: Storing %s...' % (idTestSet, sFile)); 132 oZipFile.write(sSrcFileBase + sFile, sFile, zipfile.ZIP_STORED); 133 else: 134 self.dprint('TestSet %d: Deflating %s...' % (idTestSet, sFile)); 135 oZipFile.write(sSrcFileBase + sFile, sFile, zipfile.ZIP_DEFLATED); 136 137 oZipFile.close(); 125 with zipfile.ZipFile(sZipFileNm + '.tmp', 'w', zipfile.ZIP_DEFLATED, allowZip64 = True) as oZipFile: 126 for sFile in asFiles: 127 sSuff = os.path.splitext(sFile)[1]; 128 if sSuff in [ '.png', '.webm', '.gz', '.bz2', '.zip', '.mov', '.avi', '.mpg', '.gif', '.jpg' ]: 129 ## @todo Consider storing these files outside the zip if they are a little largish. 130 self.dprint('TestSet %d: Storing %s...' % (idTestSet, sFile)); 131 oZipFile.write(sSrcFileBase + sFile, sFile, zipfile.ZIP_STORED); 132 else: 133 self.dprint('TestSet %d: Deflating %s...' % (idTestSet, sFile)); 134 oZipFile.write(sSrcFileBase + sFile, sFile, zipfile.ZIP_DEFLATED); 138 135 139 136 # … … 216 213 # 217 214 fRc = True; 218 for idTestSet in dTestSets:215 for idTestSet, oTestSet in dTestSets.items(): 219 216 try: 220 if self._processTestSet(idTestSet, dTestSets[idTestSet], sCurDir) is not True:217 if self._processTestSet(idTestSet, oTestSet, sCurDir) is not True: 221 218 fRc = False; 222 219 except: -
trunk/src/VBox/ValidationKit/testmanager/batch/vcs_import.py
r93115 r94129 43 43 44 44 # Test Manager imports 45 from testmanager.config import g_k aBugTrackers;45 from testmanager.config import g_kdBugTrackers; 46 46 from testmanager.core.db import TMDatabaseConnection; 47 47 from testmanager.core.vcsrevisions import VcsRevisionData, VcsRevisionLogic; … … 158 158 159 159 # Analyze the raw message looking for bug tracker references. 160 for sBugTrackerKey in g_kaBugTrackers: 161 oBugTracker = g_kaBugTrackers[sBugTrackerKey]; 160 for oBugTracker in g_kdBugTrackers.values(): 162 161 for sTag in oBugTracker.asCommitTags: 163 162 off = sRawMsg.find(sTag); -
trunk/src/VBox/ValidationKit/testmanager/batch/virtual_test_sheriff.py
r93874 r94129 340 340 341 341 if self.oConfig.sLogFile: 342 self.oLogFile = open(self.oConfig.sLogFile, "a"); 342 self.oLogFile = open(self.oConfig.sLogFile, "a"); # pylint: disable=consider-using-with 343 343 self.oLogFile.write('VirtualTestSheriff: $Revision$ \n'); 344 344 … … 518 518 ## @todo maybe check the elapsed time here, it could still be a bad run? 519 519 cOkay += 1; 520 if iFirstOkay > iSet: 521 iFirstOkay = iSet; 520 iFirstOkay = min(iFirstOkay, iSet); 522 521 if iSet > 10: 523 522 break; … … 1030 1029 # 1031 1030 cHits = 0; 1032 for iCpu in dStacks: 1033 asBacktrace = dStacks[iCpu]; 1031 for asBacktrace in dStacks.values(): 1034 1032 for iFrame in xrange(min(3, len(asBacktrace))): 1035 1033 if asBacktrace[iFrame].find('kvm_lock_spinning') >= 0: -
trunk/src/VBox/ValidationKit/testmanager/cgi/logout2.py
r93115 r94129 52 52 oSrvGlue.setHeaderField('Status', '401 Unauthorized to access the document'); 53 53 oSrvGlue.setHeaderField('WWW-authenticate', 'Basic realm="Test Manager"'); 54 if (sUserAgent.startswith('Mozilla/') and sUserAgent.find('AppleWebKit/') > 0) \ 55 or False: 54 if sUserAgent.startswith('Mozilla/') and sUserAgent.find('AppleWebKit/') > 0: 56 55 oSrvGlue.write('<p>Attempting to log out an Apple browser...</p>'); 57 56 else: -
trunk/src/VBox/ValidationKit/testmanager/config.py
r93115 r94129 160 160 161 161 ## The key is the database table 162 g_k aBugTrackers = {162 g_kdBugTrackers = { 163 163 'xtrk': BugTrackerConfig('xtrk', 'xTracker', 'https://linserv.de.oracle.com/vbox/xTracker/index.php?bug=', 164 164 ['bugref:', '@bugref{', 'bugef:', 'bugrf:', ], ), -
trunk/src/VBox/ValidationKit/testmanager/core/build.py
r93115 r94129 739 739 asOsAgnosticArch = []; 740 740 asOsNoArch = []; 741 for i in range(len(oBuildEx.oCat.asOsArches)):742 asParts = oBuildEx.oCat.asOsArches[i].split('.');741 for sOsArch in oBuildEx.oCat.asOsArches: 742 asParts = sOsArch.split('.'); 743 743 if len(asParts) != 2 or not asParts[0] or not asParts[1]: 744 744 raise self._oDb.integrityException('Bad build asOsArches value: %s (idBuild=%s idBuildCategory=%s)' 745 % ( oBuildEx.asOsArches[i], oBuildEx.idBuild, oBuildEx.idBuildCategory));745 % (sOsArch, oBuildEx.idBuild, oBuildEx.idBuildCategory)); 746 746 asOsNoArch.append(asParts[0] + '.noarch'); 747 747 asOsNoArch.append('os-agnostic.' + asParts[1]); -
trunk/src/VBox/ValidationKit/testmanager/core/report.py
r93115 r94129 1222 1222 # 1223 1223 for oSeries in oCollection.aoSeries: 1224 for i in range(len(oSeries.aiRevisions)):1225 oSeries.aoRevInfo.append(self.oCache.getVcsRevInfo(sCurRepository, oSeries.aiRevisions[i]));1224 for iRevision in oSeries.aiRevisions: 1225 oSeries.aoRevInfo.append(self.oCache.getVcsRevInfo(sCurRepository, iRevision)); 1226 1226 aoRet.append(oCollection); 1227 1227 -
trunk/src/VBox/ValidationKit/testmanager/core/restdispatcher.py
r93115 r94129 220 220 if not os.path.exists(os.path.dirname(sFile)): 221 221 os.makedirs(os.path.dirname(sFile), 0o755); 222 oFile = open(sFile, 'ab'); 223 224 # Check the size. 225 fSizeOk = True; 226 if not fIgnoreSizeCheck: 227 oStat = os.fstat(oFile.fileno()); 228 fSizeOk = oStat.st_size / (1024 * 1024) < config.g_kcMbMaxMainLog; 229 230 # Write the text. 231 if fSizeOk: 232 if sys.version_info[0] >= 3: 233 oFile.write(bytes(sText, 'utf-8')); 234 else: 235 oFile.write(sText); 236 237 # Done 238 oFile.close(); 222 223 with open(sFile, 'ab') as oFile: 224 # Check the size. 225 fSizeOk = True; 226 if not fIgnoreSizeCheck: 227 oStat = os.fstat(oFile.fileno()); 228 fSizeOk = oStat.st_size / (1024 * 1024) < config.g_kcMbMaxMainLog; 229 230 # Write the text. 231 if fSizeOk: 232 if sys.version_info[0] >= 3: 233 oFile.write(bytes(sText, 'utf-8')); 234 else: 235 oFile.write(sText); 236 239 237 return fSizeOk; 240 238 -
trunk/src/VBox/ValidationKit/testmanager/core/schedulerbeci.py
r93115 r94129 75 75 # 76 76 cMaxItems = len(oData.aoArgsVariations) * 64; 77 if cMaxItems > 1048576: 78 cMaxItems = 1048576; 77 cMaxItems = min(cMaxItems, 1048576); 79 78 80 79 aoItems = list(); -
trunk/src/VBox/ValidationKit/testmanager/core/testboxcontroller.py
r93115 r94129 327 327 if not os.path.exists(os.path.dirname(sFile)): 328 328 os.makedirs(os.path.dirname(sFile), 0o755); 329 oFile = open(sFile, 'ab'); 330 331 # Check the size. 332 fSizeOk = True; 333 if not fIgnoreSizeCheck: 334 oStat = os.fstat(oFile.fileno()); 335 fSizeOk = oStat.st_size / (1024 * 1024) < config.g_kcMbMaxMainLog; 336 337 # Write the text. 338 if fSizeOk: 339 if sys.version_info[0] >= 3: 340 oFile.write(bytes(sText, 'utf-8')); 341 else: 342 oFile.write(sText); 343 344 # Done 345 oFile.close(); 329 330 with open(sFile, 'ab') as oFile: 331 # Check the size. 332 fSizeOk = True; 333 if not fIgnoreSizeCheck: 334 oStat = os.fstat(oFile.fileno()); 335 fSizeOk = oStat.st_size / (1024 * 1024) < config.g_kcMbMaxMainLog; 336 337 # Write the text. 338 if fSizeOk: 339 if sys.version_info[0] >= 3: 340 oFile.write(bytes(sText, 'utf-8')); 341 else: 342 oFile.write(sText); 343 346 344 return fSizeOk; 347 345 -
trunk/src/VBox/ValidationKit/testmanager/core/testcase.py
r93115 r94129 902 902 dErrors = {}; 903 903 904 for iVar in range(len(self.aoTestCaseArgs)):905 oVar = copy.copy( self.aoTestCaseArgs[iVar]);904 for iVar, oVar in enumerate(self.aoTestCaseArgs): 905 oVar = copy.copy(oVar); 906 906 oVar.idTestCase = self.idTestCase; 907 907 dCurErrors = oVar.validateAndConvert(oDb, ModelDataBase.ksValidateFor_Other); … … 915 915 aoNewValues.append(oVar); 916 916 917 for iVar in range(len(self.aoTestCaseArgs)):918 sArgs = self.aoTestCaseArgs[iVar].sArgs;917 for iVar, oVar in enumerate(self.aoTestCaseArgs): 918 sArgs = oVar.sArgs; 919 919 for iVar2 in range(iVar + 1, len(self.aoTestCaseArgs)): 920 920 if self.aoTestCaseArgs[iVar2].sArgs == sArgs: -
trunk/src/VBox/ValidationKit/testmanager/core/testset.py
r93115 r94129 194 194 sFile1 = os.path.join(config.g_ksFileAreaRootDir, self.sBaseFilename + '-' + sFilename); 195 195 try: 196 oFile = open(sFile1, sMode); 196 oFile = open(sFile1, sMode); # pylint: disable=consider-using-with 197 197 return (oFile, os.fstat(oFile.fileno()).st_size, False); 198 198 except Exception as oXcpt1: … … 200 200 sFile2 = os.path.join(config.g_ksZipFileAreaRootDir, self.sBaseFilename + '.zip'); 201 201 try: 202 oZipFile = zipfile.ZipFile(sFile2, 'r'); 203 oFile = oZipFile.open(sFilename, sMode if sMode != 'rb' else 'r'); 202 oZipFile = zipfile.ZipFile(sFile2, 'r'); # pylint: disable=consider-using-with 203 oFile = oZipFile.open(sFilename, sMode if sMode != 'rb' else 'r'); # pylint: disable=consider-using-with 204 204 cbFile = oZipFile.getinfo(sFilename).file_size; 205 205 return (oFile, cbFile, True); … … 230 230 if not os.path.exists(os.path.dirname(sFile1)): 231 231 os.makedirs(os.path.dirname(sFile1), 0o755); 232 oFile = open(sFile1, sMode); 232 oFile = open(sFile1, sMode); # pylint: disable=consider-using-with 233 233 except Exception as oXcpt1: 234 234 return str(oXcpt1); -
trunk/src/VBox/ValidationKit/testmanager/core/webservergluebase.py
r93115 r94129 138 138 self._oDbgFile = sys.stderr; 139 139 if config.g_ksSrvGlueDebugLogDst is not None and config.g_kfSrvGlueDebug is True: 140 self._oDbgFile = open(config.g_ksSrvGlueDebugLogDst, 'a'); 140 self._oDbgFile = open(config.g_ksSrvGlueDebugLogDst, 'a'); # pylint: disable=consider-using-with 141 141 if config.g_kfSrvGlueCgiDumpArgs: 142 142 self._oDbgFile.write('Arguments: %s\nEnvironment:\n' % (sys.argv,)); … … 303 303 """ 304 304 if self._fHeaderWrittenOut is False: 305 for sKey in self._dHeaderFields:306 self._writeHeader('%s: %s\n' % (sKey, s elf._dHeaderFields[sKey]));305 for sKey, sValue in self._dHeaderFields.items(): 306 self._writeHeader('%s: %s\n' % (sKey, sValue,)); 307 307 self._fHeaderWrittenOut = True; 308 308 self._writeHeader('\n'); # End of header indicator. … … 462 462 463 463 try: 464 oFile = open(sLogFile, 'w'); 465 oFile.write(sError + '\n\n'); 466 if aXcptInfo[0] is not None: 467 oFile.write(' B a c k t r a c e\n'); 468 oFile.write('===================\n'); 469 oFile.write(cgitb.text(aXcptInfo, 5)); 470 oFile.write('\n\n'); 471 472 oFile.write(' D e b u g I n f o\n'); 473 oFile.write('=====================\n\n'); 474 self._fHtmlDebugOutput = False; 475 self.debugDumpStuff(oFile.write); 476 477 oFile.close(); 464 with open(sLogFile, 'w') as oFile: 465 oFile.write(sError + '\n\n'); 466 if aXcptInfo[0] is not None: 467 oFile.write(' B a c k t r a c e\n'); 468 oFile.write('===================\n'); 469 oFile.write(cgitb.text(aXcptInfo, 5)); 470 oFile.write('\n\n'); 471 472 oFile.write(' D e b u g I n f o\n'); 473 oFile.write('=====================\n\n'); 474 self._fHtmlDebugOutput = False; 475 self.debugDumpStuff(oFile.write); 478 476 except: 479 477 fRc = False; -
trunk/src/VBox/ValidationKit/testmanager/db/TestManagerDatabaseInit.pgsql
r93115 r94129 1330 1330 --- The version control tree revision number. 1331 1331 iRevision INTEGER NOT NULL, 1332 --- The bug tracker identifier - see g_k aBugTrackers in config.py.1332 --- The bug tracker identifier - see g_kdBugTrackers in config.py. 1333 1333 sBugTracker CHAR(4) NOT NULL, 1334 1334 --- The bug number in the bug tracker. -
trunk/src/VBox/ValidationKit/testmanager/db/tmdb-r24-vcsbugreferences-1.pgsql
r93115 r94129 37 37 --- The version control tree revision number. 38 38 iRevision INTEGER NOT NULL, 39 --- The bug tracker identifier - see g_k aBugTrackers in config.py.39 --- The bug tracker identifier - see g_kdBugTrackers in config.py. 40 40 sBugTracker CHAR(4) NOT NULL, 41 41 --- The bug number in the bug tracker. -
trunk/src/VBox/ValidationKit/testmanager/webui/wuiadmin.py
r93115 r94129 498 498 # Open and send the dump. 499 499 # 500 oFile = open(sOutFile, 'rb'); 500 oFile = open(sOutFile, 'rb'); # pylint: disable=consider-using-with 501 501 cbFile = os.fstat(oFile.fileno()).st_size; 502 502 -
trunk/src/VBox/ValidationKit/testmanager/webui/wuibase.py
r93115 r94129 238 238 # Provide basic auth log out for browsers that supports it. 239 239 sUserAgent = self._oSrvGlue.getUserAgent(); 240 if (sUserAgent.startswith('Mozilla/') and sUserAgent.find('Firefox') > 0) \ 241 or False: 240 if sUserAgent.startswith('Mozilla/') and sUserAgent.find('Firefox') > 0: 242 241 # Log in as the logout user in the same realm, the browser forgets 243 242 # the old login and the job is done. (see apache sample conf) 244 243 sLogOut = ' (<a href="%s://logout:logout@%s%slogout.py">logout</a>)' \ 245 244 % (self._oSrvGlue.getUrlScheme(), self._oSrvGlue.getUrlNetLoc(), self._oSrvGlue.getUrlBasePath()); 246 elif (sUserAgent.startswith('Mozilla/') and sUserAgent.find('Safari') > 0) \ 247 or False: 245 elif sUserAgent.startswith('Mozilla/') and sUserAgent.find('Safari') > 0: 248 246 # For a 401, causing the browser to forget the old login. Works 249 247 # with safari as well as the two above. Since safari consider the … … 254 252 sLogOut = ' (<a href="logout2.py">logout</a>)' 255 253 elif (sUserAgent.startswith('Mozilla/') and sUserAgent.find('MSIE') > 0) \ 256 or (sUserAgent.startswith('Mozilla/') and sUserAgent.find('Chrome') > 0) \ 257 or False: 254 or (sUserAgent.startswith('Mozilla/') and sUserAgent.find('Chrome') > 0): 258 255 ## There doesn't seem to be any way to make IE really log out 259 256 # without using a cookie and systematically 401 accesses based on … … 315 312 # Load the template. 316 313 # 317 oFile = open(os.path.join(self._oSrvGlue.pathTmWebUI(), self._sTemplate)); 318 sTmpl = oFile.read(); 319 oFile.close(); 314 with open(os.path.join(self._oSrvGlue.pathTmWebUI(), self._sTemplate)) as oFile: 315 sTmpl = oFile.read(); 320 316 321 317 # … … 1236 1232 def dprint(self, sText): 1237 1233 """ Debug printing. """ 1238 if config.g_kfWebUiDebug and True:1234 if config.g_kfWebUiDebug: 1239 1235 self._oSrvGlue.dprint(sText); -
trunk/src/VBox/ValidationKit/testmanager/webui/wuicontentbase.py
r93115 r94129 1115 1115 if len(aiColumns) <= len(self._aiSelectedSortColumns): 1116 1116 aiColumns = list(aiColumns); 1117 aiNegColumns = list([-i for i in aiColumns]); 1117 aiNegColumns = list([-i for i in aiColumns]); # pylint: disable=consider-using-generator 1118 1118 i = 0; 1119 1119 while i + len(aiColumns) <= len(self._aiSelectedSortColumns): -
trunk/src/VBox/ValidationKit/testmanager/webui/wuigraphwiz.py
r93115 r94129 238 238 cMaxPerGraph = self._dParams[WuiMain.ksParamGraphWizMaxPerGraph]; 239 239 aaoRet = []; 240 for iUnit in dUnitSeries: 241 aoUnitSeries = dUnitSeries[iUnit]; 240 for aoUnitSeries in dUnitSeries.values(): 242 241 while len(aoUnitSeries) > cMaxPerGraph: 243 242 aaoRet.append(aoUnitSeries[:cMaxPerGraph]); … … 562 561 if len(oSeries.aoRevInfo) == len(oSeries.aiRevisions): 563 562 asHtmlTooltips = []; 564 for i in range(len(oSeries.aoRevInfo)):563 for i, oRevInfo in enumerate(oSeries.aoRevInfo): 565 564 sPlusMinus = ''; 566 565 if oSeries.acSamples[i] > 1: … … 576 575 oSeries.aiRevisions[i], 577 576 ); 578 oRevInfo = oSeries.aoRevInfo[i];579 577 if oRevInfo.sAuthor is not None: 580 578 sMsg = oRevInfo.sMessage[:80].strip(); … … 630 628 sUnit ); 631 629 632 for i in range(len(oSeries.aiRevisions)):630 for i, iRevision in enumerate(oSeries.aiRevisions): 633 631 sHtml += ' <tr class="%s"><td>r%s</td><td>%s</td><td>+%s</td><td>-%s</td><td>%s</td></tr>\n' \ 634 632 % ( 'tmodd' if i & 1 else 'tmeven', 635 oSeries.aiRevisions[i], oSeries.aiValues[i],633 iRevision, oSeries.aiValues[i], 636 634 oSeries.aiErrorBarAbove[i], oSeries.aiErrorBarBelow[i], 637 635 oSeries.acSamples[i]); -
trunk/src/VBox/ValidationKit/testmanager/webui/wuihlpform.py
r93115 r94129 737 737 # Argument variations. 738 738 aidTestCaseArgs = [] if oMember is None or oMember.aidTestCaseArgs is None else oMember.aidTestCaseArgs; 739 for iVar in range(len(oTestCase.aoTestCaseArgs)): 740 oVar = oTestCase.aoTestCaseArgs[iVar]; 739 for iVar, oVar in enumerate(oTestCase.aoTestCaseArgs): 741 740 if iVar > 0: 742 741 self._add(' <tr class="%s">\n' % ('tmodd' if iTestCase & 1 else 'tmeven',)); -
trunk/src/VBox/ValidationKit/testmanager/webui/wuihlpgraphmatplotlib.py
r93115 r94129 129 129 for i in range(1, len(aoTable)): 130 130 asNames.append(aoTable[i].sName); 131 for j in range(len(aoTable[i].aoValues)):132 fpValue = float( aoTable[i].aoValues[j]);131 for j, oValue in enumerate(aoTable[i].aoValues): 132 fpValue = float(oValue); 133 133 aoSeries[j].append(fpValue); 134 134 if fpValue < fpMin: -
trunk/src/VBox/ValidationKit/testmanager/webui/wuihlpgraphsimple.py
r93115 r94129 83 83 'border="0" cellspacing="0" cellpadding="0">\n' \ 84 84 % (escapeElem(oRow.sName), escapeAttr(str(self.cxMaxBar + 2))); 85 for j in range(len(oRow.aoValues)): 86 oValue = oRow.aoValues[j]; 85 for j, oValue in enumerate(oRow.aoValues): 87 86 cPct = int(float(oValue) * 100 / fpMax); 88 87 cxBar = int(float(oValue) * self.cxMaxBar / fpMax); … … 125 124 sReport += '<div class="tmgraphlegend">\n' \ 126 125 ' <p>Legend:\n'; 127 for j in range(len(aoTable[0].asValues)):126 for j, sValue in enumerate(aoTable[0].asValues): 128 127 sColor = self.kasColors[j % len(self.kasColors)]; 129 sReport += ' <font color="%s">■ %s</font>\n' \ 130 % (sColor, escapeElem(aoTable[0].asValues[j])); 128 sReport += ' <font color="%s">■ %s</font>\n' % (sColor, escapeElem(sValue),); 131 129 sReport += ' </p>\n' \ 132 130 '</div>\n'; -
trunk/src/VBox/ValidationKit/testmanager/webui/wuilogviewer.py
r93115 r94129 150 150 # Figure the end offset. 151 151 offEnd = offFile + self._cbChunk; 152 if offEnd > cbFile: 153 offEnd = cbFile; 152 offEnd = min(offEnd, cbFile); 154 153 155 154 #
Note:
See TracChangeset
for help on using the changeset viewer.