VirtualBox

Changeset 61269 in vbox


Ignore:
Timestamp:
May 28, 2016 9:29:30 PM (9 years ago)
Author:
vboxsync
Message:

reports: count testsets without reasons assigned.

Location:
trunk/src/VBox/ValidationKit/testmanager
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testmanager/core/report.py

    r61255 r61269  
    183183    """ Simpler to return this than muck about with stupid arrays. """
    184184    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; # FailureReasonDataEx
     185        self.idFailureReason    = aoRow[0];
     186        self.cHits              = aoRow[1];
     187        self.tsMin              = aoRow[2];
     188        self.tsMax              = aoRow[3];
     189        self.oReason            = oReason; # FailureReasonDataEx
    190190
    191191class ReportFailureReasonTransient(object):
    192192    """ 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.
    203204
    204205class ReportFailureReasonPeriod(object):
    205206    """ A period in ReportFailureReasonSet. """
    206207    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.
    219221
    220222class ReportFailureReasonSet(object):
     
    332334                          '     AND TestSets.tsDone                >= ' + sTsFirst + '\n'
    333335                          '     AND TestSets.tsDone                <  ' + sTsNow + '\n'
    334                         + self.getExtraSubjectWhereExpr());
     336                          + self.getExtraSubjectWhereExpr());
    335337        self._oDb.execute('SELECT idFailureReason FROM TmpReasons;');
    336338
     
    346348                              'FROM     TmpReasons\n'
    347349                              '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');
    350352            aaoRows = self._oDb.fetchAll()
    351353
     
    374376            oSet.cHits += oPeriod.cHits;
    375377
    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];
    399389
    400390
     
    463453        if aoRow is None:
    464454            return ReportFailureReasonTransient(-1, -1, 'internal-error', -1, -1,
    465                                                 self._oDb.getCurrentTimestamp(), oReason, iPeriod);
     455                                                self._oDb.getCurrentTimestamp(), oReason, iPeriod, fEnter);
    466456        return ReportFailureReasonTransient(idBuild = aoRow[3], iRevision = aoRow[4], sRepository = aoRow[5],
    467457                                            idTestSet = aoRow[1], idTestResult = aoRow[0], tsDone = aoRow[2],
  • trunk/src/VBox/ValidationKit/testmanager/webui/wuireport.py

    r61254 r61269  
    140140        sHtml = u'<li>';
    141141        if oTransient.fEnter:   sHtml += 'Since ';
    142         else:                   sHtml += 'Till ';
     142        else:                   sHtml += 'Until ';
    143143        sHtml += WuiSvnLinkWithTooltip(oTransient.iRevision, oTransient.sRepository, fBracketed = 'False').toHtml();
    144144        sHtml += u', %s: ' % (self.formatTsShort(oTransient.tsDone),);
     
    189189
    190190        #
     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        #
    191202        # Graph.
    192203        #
     
    194205            aidSorted = sorted(oSet.dReasons, key = lambda idReason: oSet.dTotals[idReason], reverse = True);
    195206        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, ));
    200209        asNames = [];
    201210        for idReason in aidSorted:
    202211            oReason = oSet.dReasons[idReason];
    203212            asNames.append('%s / %s' % (oReason.oCategory.sShort, oReason.sShort,) )
     213        if fIncludeWithoutReason:
     214            asNames.append('No reason');
     215
    204216        oTable = WuiHlpGraphDataTable('Period', asNames);
    205217
     218        cMax = oSet.cMaxRowHits;
    206219        for iPeriod, oPeriod in enumerate(reversed(oSet.aoPeriods)):
    207220            aiValues = [];
     221
    208222            for idReason in aidSorted:
    209223                oRow = oPeriod.dById.get(idReason, None);
    210224                iValue = oRow.cHits if oRow is not None else 0;
    211225                aiValues.append(iValue);
     226
     227            if fIncludeWithoutReason:
     228                aiValues.append(oPeriod.cWithoutReason);
     229                if oPeriod.cWithoutReason > cMax:
     230                    cMax = oPeriod.cWithoutReason;
     231
    212232            oTable.addRow(oPeriod.sDesc, aiValues);
    213233
    214234        oGraph = WuiHlpBarGraph('failure-reason', oTable, self._oDisp);
    215         oGraph.setRangeMax(max(oSet.cMaxRowHits + 1, 3));
     235        oGraph.setRangeMax(max(cMax + 1, 3));
    216236        sHtml += oGraph.renderGraph();
    217237
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette