VirtualBox

Ignore:
Timestamp:
Jun 3, 2016 2:22:30 AM (9 years ago)
Author:
vboxsync
Message:

vsheriff: Some progress.

Location:
trunk/src/VBox/ValidationKit/testmanager/core
Files:
3 edited

Legend:

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

    r61286 r61424  
    219219            aoRows.append(FailureReasonDataEx().initFromDbRowEx(aoRow, self.oCategoryLogic, self.oUserAccountLogic));
    220220        return aoRows
     221
     222
     223    def fetchForSheriffByNamedCategory(self, sFailureCategory):
     224        """
     225        Fetches the short names of the reasons in the named category.
     226
     227        Returns array of strings.
     228        Raises exception on error.
     229        """
     230        self._oDb.execute('SELECT   FailureReasons.sShort\n'
     231                          'FROM     FailureReasons,\n'
     232                          '         FailureCategories\n'
     233                          'WHERE    FailureReasons.tsExpire          = \'infinity\'::TIMESTAMP\n'
     234                          '     AND FailureReasons.idFailureCategory = FailureCategories.idFailureCategory\n'
     235                          '     AND FailureCategories.sShort         = %s\n'
     236                          'ORDER BY FailureReasons.sShort ASC\n'
     237                          , ( sFailureCategory,));
     238        return [aoRow[0] for aoRow in self._oDb.fetchAll()];
     239
    221240
    222241    def fetchForCombo(self, sFirstEntry = 'Select a failure reason', tsEffective = None):
  • trunk/src/VBox/ValidationKit/testmanager/core/testresults.py

    r61284 r61424  
    199199        cChildErrors = 0;
    200200        for oChild in self.aoChildren:
    201             cChanges += oChild.deepCountErrorContributers();
    202             cChildErrors += oChild.cErrors;
     201            if oChild.cErrors > 0:
     202                cChildErrors += oChild.cErrors;
     203                cChanges     += oChild.deepCountErrorContributers();
    203204
    204205        # Did we contribute as well?
    205         if self.cErrors != cChildErrors:
    206             assert self.cErrors >= cChildErrors;
     206        if self.cErrors > cChildErrors:
    207207            cChanges += 1;
    208208        return cChanges;
     209
     210    def getListOfFailures(self):
     211        """
     212        Get a list of test results insances actually contributing to cErrors.
     213
     214        Returns a list of TestResultDataEx insance from this tree. (shared!)
     215        """
     216        # Check each child (if any).
     217        aoRet = [];
     218        cChildErrors = 0;
     219        for oChild in self.aoChildren:
     220            if oChild.cErrors > 0:
     221                cChildErrors += oChild.cErrors;
     222                aoRet.extend(oChild.getListOfFailures());
     223
     224        # Did we contribute as well?
     225        if self.cErrors > cChildErrors:
     226            aoRet.append(self);
     227
     228        return aoRet;
     229
     230    def getFullName(self):
     231        """ Constructs the full name of this test result. """
     232        if self.oParent is None:
     233            return self.sName;
     234        return self.oParent.getFullName() + ' / ' + self.sName;
     235
    209236
    210237
     
    351378    ksParam_idStrKind           = 'TestResultFile_idStrKind';
    352379    ksParam_idStrMime           = 'TestResultFile_idStrMime';
     380
     381    ## @name Kind of files.
     382    ## @{
     383    ksKind_LogReleaseVm         = 'log/release/vm';
     384    ksKind_LogDebugVm           = 'log/debug/vm';
     385    ksKind_LogReleaseSvc        = 'log/release/svc';
     386    ksKind_LogRebugSvc          = 'log/debug/svc';
     387    ksKind_LogReleaseClient     = 'log/release/client';
     388    ksKind_LogDebugClient       = 'log/debug/client';
     389    ksKind_LogInstaller         = 'log/installer';
     390    ksKind_LogUninstaller       = 'log/uninstaller';
     391    ksKind_LogGuestKernel       = 'log/guest/kernel';
     392    ksKind_CrashReportVm        = 'crash/report/vm';
     393    ksKind_CrashDumpVm          = 'crash/dump/vm';
     394    ksKind_CrashReportSvc       = 'crash/report/svc';
     395    ksKind_CrashDumpSvc         = 'crash/dump/svc';
     396    ksKind_CrashReportClient    = 'crash/report/client';
     397    ksKind_CrashDumpClient      = 'crash/dump/client';
     398    ksKind_MiscOther            = 'misc/other';
     399    ksKind_ScreenshotFailure    = 'screenshot/failure';
     400    ksKind_ScreenshotSuccesss   = 'screenshot/success';
     401    #kSkind_ScreenCaptureFailure = 'screencapture/failure';
     402    ## @}
    353403
    354404    def __init__(self):
  • trunk/src/VBox/ValidationKit/testmanager/core/testset.py

    r61327 r61424  
    3838from common                         import utils;
    3939from testmanager                    import config;
     40from testmanager.core               import db;
    4041from testmanager.core.base          import ModelDataBase, ModelDataBaseTestCase, ModelLogicBase,  \
    4142                                           TMExceptionBase, TMTooManyRows, TMRowNotFound;
     
    229230        return oFile;
    230231
     232    @staticmethod
     233    def findLogOffsetForTimestamp(sLogContent, tsTimestamp, offStart = 0, fAfter = False):
     234        """
     235        Log parsing utility function for finding the offset for the given timestamp.
     236
     237        We ASSUME the log lines are prefixed with UTC timestamps on the format
     238        '09:43:55.789353'.
     239
     240        Return index into the sLogContent string, 0 if not found.
     241        """
     242        # Turn tsTimestamp into a string compatible with what we expect to find in the log.
     243        oTsZulu   = db.dbTimestampToZuluDatetime(tsTimestamp);
     244        sWantedTs = oTsZulu.strftime('%H:%M:%S.%f');
     245        assert len(sWantedTs) == 15;
     246
     247        # Now loop thru the string, line by line.
     248        offRet  = offStart;
     249        off     = offStart;
     250        while True:
     251            sThisTs = sLogContent[off : off + 15];
     252            if    len(sThisTs) >= 15 \
     253              and sThisTs[2]  == ':' \
     254              and sThisTs[5]  == ':' \
     255              and sThisTs[8]  == '.' \
     256              and sThisTs[14] in '0123456789':
     257                if sThisTs < sWantedTs:
     258                    offRet = off;
     259                elif sThisTs == sWantedTs:
     260                    if not fAfter:
     261                        return off;
     262                    offRet = off;
     263                else:
     264                    if fAfter:
     265                        offRet = off;
     266                    break;
     267
     268            # next line.
     269            off = sLogContent.find('\n', off);
     270            if off < 0:
     271                if fAfter:
     272                    offRet = len(sLogContent);
     273                break;
     274            off += 1;
     275
     276        return offRet;
     277
     278    @staticmethod
     279    def extractLogSection(sLogContent, tsStart, tsLast):
     280        """
     281        Returns log section from tsStart to tsLast (or all if we cannot make sense of it).
     282        """
     283        offStart = TestSetData.findLogOffsetForTimestamp(sLogContent, tsStart);
     284        offEnd   = TestSetData.findLogOffsetForTimestamp(sLogContent, tsLast, offStart, fAfter = True);
     285        return sLogContent[offStart : offEnd];
     286
     287    @staticmethod
     288    def extractLogSectionElapsed(sLogContent, tsStart, tsElapsed):
     289        """
     290        Returns log section from tsStart and tsElapsed forward (or all if we cannot make sense of it).
     291        """
     292        tsStart = db.dbTimestampToZuluDatetime(tsStart);
     293        tsLast  = tsStart + tsElapsed;
     294        return TestSetData.extractLogSection(sLogContent, tsStart, tsLast);
     295
    231296
    232297
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