Changeset 61269 in vbox
- Timestamp:
- May 28, 2016 9:29:30 PM (9 years ago)
- Location:
- trunk/src/VBox/ValidationKit/testmanager
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testmanager/core/report.py
r61255 r61269 183 183 """ Simpler to return this than muck about with stupid arrays. """ 184 184 def __init__(self, aoRow, oReason): 185 self.idFailureReason = aoRow[0];186 self.cHits = aoRow[1];187 self.tsMin = aoRow[2];188 self.tsMax = aoRow[3];189 self.oReason = oReason; # FailureReasonDataEx185 self.idFailureReason = aoRow[0]; 186 self.cHits = aoRow[1]; 187 self.tsMin = aoRow[2]; 188 self.tsMax = aoRow[3]; 189 self.oReason = oReason; # FailureReasonDataEx 190 190 191 191 class ReportFailureReasonTransient(object): 192 192 """ Details the first or last occurence of a reason. """ 193 def __init__(self, idBuild, iRevision, sRepository, idTestSet, idTestResult, tsDone, oReason, iPeriod, fEnter): 194 self.idBuild = idBuild; # Build ID. 195 self.iRevision = iRevision; # SVN revision for build. 196 self.sRepository = sRepository; # SVN repository for build. 197 self.idTestSet = idTestSet; # Test set. 198 self.idTestResult = idTestResult; # Test result. 199 self.tsDone = tsDone; # When the test set was done. 200 self.oReason = oReason; # FailureReasonDataEx 201 self.iPeriod = iPeriod; # Data set period. 202 self.fEnter = fEnter; # True if enter event, False if leave event. 193 def __init__(self, idBuild, iRevision, sRepository, idTestSet, idTestResult, tsDone, # pylint: disable=R0913 194 oReason, iPeriod, fEnter): 195 self.idBuild = idBuild; # Build ID. 196 self.iRevision = iRevision; # SVN revision for build. 197 self.sRepository = sRepository; # SVN repository for build. 198 self.idTestSet = idTestSet; # Test set. 199 self.idTestResult = idTestResult; # Test result. 200 self.tsDone = tsDone; # When the test set was done. 201 self.oReason = oReason; # FailureReasonDataEx 202 self.iPeriod = iPeriod; # Data set period. 203 self.fEnter = fEnter; # True if enter event, False if leave event. 203 204 204 205 class ReportFailureReasonPeriod(object): 205 206 """ A period in ReportFailureReasonSet. """ 206 207 def __init__(self, oSet, iPeriod, sDesc, tsFrom, tsTo): 207 self.oSet = oSet # Reference to the parent ReportFailureReasonSet. 208 self.iPeriod = iPeriod; 209 self.sDesc = sDesc; 210 self.aoRows = []; # Rows in order the database returned them. 211 self.dById = {}; # Same as aoRows but indexed by idFailureReason. 212 self.cHits = 0; # Total number of hits. 213 self.dFirst = {}; # The reasons seen for the first time (idFailureReason key). 214 self.dLast = {}; # The reasons seen for the last time (idFailureReason key). 215 self.tsStart = tsFrom; 216 self.tsEnd = tsTo; 217 self.tsMin = tsTo; 218 self.tsMax = tsFrom; 208 self.oSet = oSet # Reference to the parent ReportFailureReasonSet. 209 self.iPeriod = iPeriod; 210 self.sDesc = sDesc; 211 self.aoRows = []; # Rows in order the database returned them. 212 self.dById = {}; # Same as aoRows but indexed by idFailureReason. 213 self.cHits = 0; # Total number of hits. 214 self.dFirst = {}; # The reasons seen for the first time (idFailureReason key). 215 self.dLast = {}; # The reasons seen for the last time (idFailureReason key). 216 self.tsStart = tsFrom; 217 self.tsEnd = tsTo; 218 self.tsMin = tsTo; 219 self.tsMax = tsFrom; 220 self.cWithoutReason = 0; # Number of failed test sets without any assigned reason. 219 221 220 222 class ReportFailureReasonSet(object): … … 332 334 ' AND TestSets.tsDone >= ' + sTsFirst + '\n' 333 335 ' AND TestSets.tsDone < ' + sTsNow + '\n' 334 + self.getExtraSubjectWhereExpr());336 + self.getExtraSubjectWhereExpr()); 335 337 self._oDb.execute('SELECT idFailureReason FROM TmpReasons;'); 336 338 … … 346 348 'FROM TmpReasons\n' 347 349 'WHERE TRUE\n' 348 + self.getExtraWhereExprForPeriod(iPeriod).replace('TestSets.', '')349 +'GROUP BY idFailureReason\n');350 + self.getExtraWhereExprForPeriod(iPeriod).replace('TestSets.', '') + 351 'GROUP BY idFailureReason\n'); 350 352 aaoRows = self._oDb.fetchAll() 351 353 … … 374 376 oSet.cHits += oPeriod.cHits; 375 377 376 ## Count how many test sets we've got without any reason associated with them. 377 #self._oDb.execute('SELECT COUNT(idTestSet)\n' 378 # 'FROM TestSets,\n' 379 # ' Test' 380 # 'WHERE TRUE\n' 381 # + self.getExtraWhereExprForPeriod(iPeriod) + 382 # ' AND TestSets.enmStatus <> \'running\'\n' 383 # ' AND TestSets.enmStatus <> \'success\'\n' 384 # 385 # 'WHERE TestResultFailures.idTestResult = TestResults.idTestResult\n' 386 # ' AND TestResultFailures.tsExpire = \'infinity\'::TIMESTAMP\n' 387 # ' AND TestResultFailures.tsEffective >= ' + sTsFirst + '\n' 388 # ' AND TestResults.enmStatus <> \'running\'\n' 389 # ' AND TestResults.enmStatus <> \'success\'\n' 390 # ' AND TestResults.tsCreated >= ' + sTsFirst + '\n' 391 # ' AND TestResults.tsCreated < ' + sTsNow + '\n' 392 # ' AND TestResults.idTestSet = TestSets.idTestSet\n' 393 # ' AND TestSets.tsDone >= ' + sTsFirst + '\n' 394 # ' AND TestSets.tsDone < ' + sTsNow + '\n' 395 # 396 # + self.getExtraWhereExprForPeriod(iPeriod).replace('TestSets.', '') 397 # + 'GROUP BY idFailureReason\n'); 398 #aaoRows = self._oDb.fetchAll() 378 # Count how many test sets we've got without any reason associated with them. 379 self._oDb.execute('SELECT COUNT(TestSets.idTestSet)\n' 380 'FROM TestSets\n' 381 ' LEFT OUTER JOIN TestResultFailures\n' 382 ' ON TestSets.idTestSet = TestResultFailures.idTestSet\n' 383 ' AND TestResultFailures.tsEffective = \'infinity\'::TIMESTAMP\n' 384 'WHERE TestSets.enmStatus <> \'running\'\n' 385 ' AND TestSets.enmStatus <> \'success\'\n' 386 + self.getExtraWhereExprForPeriod(iPeriod) + 387 ' AND TestResultFailures.idTestSet IS NULL\n'); 388 oPeriod.cWithoutReason = self._oDb.fetchOne()[0]; 399 389 400 390 … … 463 453 if aoRow is None: 464 454 return ReportFailureReasonTransient(-1, -1, 'internal-error', -1, -1, 465 self._oDb.getCurrentTimestamp(), oReason, iPeriod );455 self._oDb.getCurrentTimestamp(), oReason, iPeriod, fEnter); 466 456 return ReportFailureReasonTransient(idBuild = aoRow[3], iRevision = aoRow[4], sRepository = aoRow[5], 467 457 idTestSet = aoRow[1], idTestResult = aoRow[0], tsDone = aoRow[2], -
trunk/src/VBox/ValidationKit/testmanager/webui/wuireport.py
r61254 r61269 140 140 sHtml = u'<li>'; 141 141 if oTransient.fEnter: sHtml += 'Since '; 142 else: sHtml += ' Till ';142 else: sHtml += 'Until '; 143 143 sHtml += WuiSvnLinkWithTooltip(oTransient.iRevision, oTransient.sRepository, fBracketed = 'False').toHtml(); 144 144 sHtml += u', %s: ' % (self.formatTsShort(oTransient.tsDone),); … … 189 189 190 190 # 191 # Check if most of the stuff is without any assign reason, if so, skip 192 # that part of the graph so it doesn't offset the interesting bits. 193 # 194 fIncludeWithoutReason = True; 195 for oPeriod in reversed(oSet.aoPeriods): 196 if oPeriod.cWithoutReason > oSet.cMaxRowHits * 4: 197 fIncludeWithoutReason = False; 198 sHtml += '<p>Warning: Many failures without assigned reason!</p>\n'; 199 break; 200 201 # 191 202 # Graph. 192 203 # … … 194 205 aidSorted = sorted(oSet.dReasons, key = lambda idReason: oSet.dTotals[idReason], reverse = True); 195 206 else: 196 aidSorted = sorted(oSet.dReasons, 197 key = lambda idReason: '%s / %s' % (oSet.dReasons[idReason].oCategory.sShort, 198 oSet.dReasons[idReason].sShort,)); 199 207 aidSorted = sorted(oSet.dReasons, key = lambda idReason: '%s / %s' % ( oSet.dReasons[idReason].oCategory.sShort, 208 oSet.dReasons[idReason].sShort, )); 200 209 asNames = []; 201 210 for idReason in aidSorted: 202 211 oReason = oSet.dReasons[idReason]; 203 212 asNames.append('%s / %s' % (oReason.oCategory.sShort, oReason.sShort,) ) 213 if fIncludeWithoutReason: 214 asNames.append('No reason'); 215 204 216 oTable = WuiHlpGraphDataTable('Period', asNames); 205 217 218 cMax = oSet.cMaxRowHits; 206 219 for iPeriod, oPeriod in enumerate(reversed(oSet.aoPeriods)): 207 220 aiValues = []; 221 208 222 for idReason in aidSorted: 209 223 oRow = oPeriod.dById.get(idReason, None); 210 224 iValue = oRow.cHits if oRow is not None else 0; 211 225 aiValues.append(iValue); 226 227 if fIncludeWithoutReason: 228 aiValues.append(oPeriod.cWithoutReason); 229 if oPeriod.cWithoutReason > cMax: 230 cMax = oPeriod.cWithoutReason; 231 212 232 oTable.addRow(oPeriod.sDesc, aiValues); 213 233 214 234 oGraph = WuiHlpBarGraph('failure-reason', oTable, self._oDisp); 215 oGraph.setRangeMax(max( oSet.cMaxRowHits+ 1, 3));235 oGraph.setRangeMax(max(cMax + 1, 3)); 216 236 sHtml += oGraph.renderGraph(); 217 237
Note:
See TracChangeset
for help on using the changeset viewer.