VirtualBox

Ignore:
Timestamp:
Aug 5, 2019 11:06:37 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
132569
Message:

vsheriff: Better detect VM process SIGSEGVs. [3rd try]

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testmanager/batch/virtual_test_sheriff.py

    r80125 r80128  
    4040
    4141# Standard python imports
     42import hashlib;
     43import os;
     44import re;
     45import smtplib;
     46import subprocess;
    4247import sys;
    43 import os;
    44 import hashlib;
    45 import subprocess;
    46 import smtplib
    47 from email.mime.multipart import MIMEMultipart
    48 from email.mime.text import MIMEText
    49 from email.utils import COMMASPACE
     48from email.mime.multipart   import MIMEMultipart;
     49from email.mime.text        import MIMEText;
     50from email.utils            import COMMASPACE;
    5051
    5152if sys.version_info[0] >= 3:
     
    6162
    6263# Test Manager imports
     64from common                                 import utils;
    6365from testmanager.core.db                    import TMDatabaseConnection;
    6466from testmanager.core.build                 import BuildDataEx;
     
    98100        self.oTestCase      = oTestCase;    # TestCaseDataEx
    99101        self.sMainLog       = '';           # The main log file.  Empty string if not accessible.
     102        self.sSvcLog        = '';           # The VBoxSVC log file.  Empty string if not accessible.
    100103
    101104        # Generate a case file name.
     
    238241            self.oSheriff.vprint(u'Error opening the "%s" log file: %s' % (oFile.sFile, oSizeOrError,));
    239242        return sContent;
     243
     244    def getSvcLog(self):
     245        """
     246        Tries to read the VBoxSVC log file as it typically not associated with a failing test result.
     247        Note! Returns the first VBoxSVC log file we find.
     248        """
     249        if not self.sSvcLog:
     250            asSvcLogFiles = self.oTree.getListOfLogFilesByKind(TestResultFileData.ksKind_LogReleaseSvc);
     251            if asSvcLogFiles:
     252                self.sSvcLog = self.getLogFile(asSvcLogFiles[0]);
     253        return self.sSvcLog;
    240254
    241255    def getScreenshotSha256(self, oFile):
     
    10181032        ( True,  ktReason_OSInstall_Sata_no_BM,                     'PCHS=14128/14134/8224' ),
    10191033        ( True,  ktReason_Host_DoubleFreeHeap,                      'double free or corruption' ),
    1020         ( False, ktReason_Unknown_VM_Start_Error,                   'VMSetError: ' ),
     1034        #( False, ktReason_Unknown_VM_Start_Error,                   'VMSetError: ' ), - false positives for stuff like:
     1035        #           "VMSetError: VD: Backend 'VBoxIsoMaker' does not support async I/O"
    10211036        ( False, ktReason_Unknown_VM_Start_Error,                   'error: failed to open session for' ),
    10221037        ( False, ktReason_Unknown_VM_Runtime_Error,                 'Console: VM runtime error: fatal=true' ),
     
    10961111    ];
    10971112
    1098     ## Things we search a VBoxSVC log for to figure out why something went bust.
    1099     katSimpleSvcLogReasons = [
    1100         # ( Whether to stop on hit, reason tuple, needle text. )
    1101         ( False, ktReason_Unknown_VM_Crash,                         ') exited normally: -1073741819 (0xc0000005)' ),
    1102         ( False, ktReason_Unknown_VM_Crash,                         ') was signalled: 11 (0xb)' ),
    1103     ];
     1113
     1114    def scanLog(self, asLogs, atNeedles, oCaseFile, idTestResult):
     1115        """
     1116        Scans for atNeedles in sLog.
     1117
     1118        Returns True if a stop-on-hit neelde was found.
     1119        Returns None if a no-stop reason was found.
     1120        Returns False if no hit.
     1121        """
     1122        fRet = False;
     1123        for fStopOnHit, tReason, oNeedle in atNeedles:
     1124            fMatch = False;
     1125            if utils.isString(oNeedle):
     1126                for sLog in asLogs:
     1127                    if sLog:
     1128                        fMatch |= sLog.find(oNeedle) > 0;
     1129            else:
     1130                for sLog in asLogs:
     1131                    if sLog:
     1132                        fMatch |= oNeedle.search(sLog) is not None;
     1133            if fMatch:
     1134                oCaseFile.noteReasonForId(tReason, idTestResult);
     1135                if fStopOnHit:
     1136                    return True;
     1137                fRet = None;
     1138        return fRet;
    11041139
    11051140
     
    11131148            Investigates the current set of VM related logs.
    11141149            """
    1115             self.dprint('investigateLogSet: log lengths: result %u, VM %u, kernel %u, vga text %u, info text %u, hard %u, SVC %u'
     1150            self.dprint('investigateLogSet: log lengths: result %u, VM %u, kernel %u, vga text %u, info text %u, hard %u'
    11161151                        % ( len(sResultLog if sResultLog else ''),
    11171152                            len(sVMLog     if sVMLog else ''),
     
    11191154                            len(sVgaText   if sVgaText else ''),
    11201155                            len(sInfoText  if sInfoText else ''),
    1121                             len(sNtHardLog if sNtHardLog else ''),
    1122                             len(sSvcLog    if sSvcLog else ''), ));
     1156                            len(sNtHardLog if sNtHardLog else ''),));
    11231157
    11241158            #self.dprint(u'main.log<<<\n%s\n<<<\n' % (sResultLog,));
     
    11501184                return oCaseFile.noteReasonForId(tReason, oFailedResult.idTestResult, sComment = sDetails.strip());
    11511185
     1186            fFoundSomething = False;
     1187
    11521188            #
    11531189            # Look for linux panic.
    11541190            #
    11551191            if sKrnlLog is not None:
    1156                 for fStopOnHit, tReason, sNeedle in self.katSimpleKernelLogReasons:
    1157                     if sKrnlLog.find(sNeedle) > 0:
    1158                         oCaseFile.noteReasonForId(tReason, oFailedResult.idTestResult);
    1159                         if fStopOnHit:
    1160                             return True;
    1161                         fFoundSomething = True;
     1192                fRet = self.scanLog([sKrnlLog,], self.katSimpleKernelLogReasons, oCaseFile, oFailedResult.idTestResult);
     1193                if fRet is True:
     1194                    return fRet;
     1195                fFoundSomething |= fRet is None;
    11621196
    11631197            #
    11641198            # Loop thru the simple stuff.
    11651199            #
    1166             fFoundSomething = False;
    1167             for fStopOnHit, tReason, sNeedle in self.katSimpleMainAndVmLogReasons:
    1168                 if sResultLog.find(sNeedle) > 0 or (sVMLog is not None and sVMLog.find(sNeedle) > 0):
    1169                     oCaseFile.noteReasonForId(tReason, oFailedResult.idTestResult);
    1170                     if fStopOnHit:
    1171                         return True;
    1172                     fFoundSomething = True;
     1200            fRet = self.scanLog([sResultLog, sVMLog], self.katSimpleMainAndVmLogReasons, oCaseFile, oFailedResult.idTestResult);
     1201            if fRet is True:
     1202                return fRet;
     1203            fFoundSomething |= fRet is None;
    11731204
    11741205            # Continue with vga text.
    11751206            if sVgaText:
    1176                 for fStopOnHit, tReason, sNeedle in self.katSimpleVgaTextReasons:
    1177                     if sVgaText.find(sNeedle) > 0:
    1178                         oCaseFile.noteReasonForId(tReason, oFailedResult.idTestResult);
    1179                         if fStopOnHit:
    1180                             return True;
    1181                         fFoundSomething = True;
    1182             _ = sInfoText;
     1207                fRet = self.scanLog([sVgaText,], self.katSimpleVgaTextReasons, oCaseFile, oFailedResult.idTestResult);
     1208                if fRet is True:
     1209                    return fRet;
     1210                fFoundSomething |= fRet is None;
    11831211
    11841212            # Continue with screen hashes.
     
    11931221            # Check VBoxHardening.log.
    11941222            if sNtHardLog is not None:
    1195                 for fStopOnHit, tReason, sNeedle in self.katSimpleVBoxHardeningLogReasons:
    1196                     if sNtHardLog.find(sNeedle) > 0:
    1197                         oCaseFile.noteReasonForId(tReason, oFailedResult.idTestResult);
    1198                         if fStopOnHit:
    1199                             return True;
    1200                         fFoundSomething = True;
    1201 
    1202             # Check VBoxSVC.log.
    1203             if sSvcLog is not None:
    1204                 for fStopOnHit, tReason, sNeedle in self.katSimpleSvcLogReasons:
    1205                     if sSvcLog.find(sNeedle) > 0:
    1206                         oCaseFile.noteReasonForId(tReason, oFailedResult.idTestResult);
    1207                         if fStopOnHit:
    1208                             return True;
    1209                         fFoundSomething = True;
     1223                fRet = self.scanLog([sNtHardLog,], self.katSimpleVBoxHardeningLogReasons, oCaseFile, oFailedResult.idTestResult);
     1224                if fRet is True:
     1225                    return fRet;
     1226                fFoundSomething |= fRet is None;
    12101227
    12111228            #
     
    12551272        sVgaText    = None;
    12561273        sInfoText   = None;
    1257         sSvcLog     = None;
    12581274        for oFile in oFailedResult.aoFiles:
    12591275            if oFile.sKind == TestResultFileData.ksKind_LogReleaseVm:
     
    12681284                    sScreenHash = None;
    12691285                    sNtHardLog  = None;
    1270                     sSvcLog     = None;
    12711286                    sVMLog      = oCaseFile.getLogFile(oFile);
    12721287                else:
     
    12781293            elif oFile.sKind == TestResultFileData.ksKind_InfoCollection:
    12791294                sInfoText = oCaseFile.getLogFile(oFile);
    1280             elif oFile.sKind == TestResultFileData.ksKind_LogReleaseSvc:
    1281                 sSvcLog   = oCaseFile.getLogFile(oFile);
    12821295            elif oFile.sKind == TestResultFileData.ksKind_ScreenshotFailure:
    12831296                sScreenHash = oCaseFile.getScreenshotSha256(oFile);
     
    12931306
    12941307        return None;
     1308
     1309    ## Things we search a VBoxSVC log for to figure out why something went bust.
     1310    katSimpleSvcLogReasons = [
     1311        # ( Whether to stop on hit, reason tuple, needle text. )
     1312        ( False, ktReason_Unknown_VM_Crash, re.compile(r'Reaper.* exited normally: -1073741819 \(0xc0000005\)') ),
     1313        ( False, ktReason_Unknown_VM_Crash, re.compile(r'Reaper.* was signalled: 11 \(0xb\)') ),
     1314    ];
     1315
     1316    def investigateSvcLogForVMRun(self, oCaseFile, sSvcLog):
     1317        """
     1318        Check the VBoxSVC log for a single VM run.
     1319        """
     1320        if sSvcLog:
     1321            fRet = self.scanLog([sSvcLog,], self.katSimpleSvcLogReasons, oCaseFile, oCaseFile.oTree.idTestResult);
     1322            if fRet is True or fRet is None:
     1323                return True;
     1324        return False;
    12951325
    12961326
     
    14011431                self.vprint(u'TODO: Cannot place idTestResult=%u - %s' % (oFailedResult.idTestResult, oFailedResult.sName,));
    14021432                self.dprint(u'%s + %s <<\n%s\n<<' % (oFailedResult.tsCreated, oFailedResult.tsElapsed, sResultLog,));
     1433
     1434        #
     1435        # Check VBoxSVC.log for VM crashes if inconclusive on single VM runs.
     1436        #
     1437        if fSingleVM and len(oCaseFile.dReasonForResultId) < len(aoFailedResults):
     1438            self.dprint(u'Got %u out of %u - checking VBoxSVC.log...'
     1439                        % (len(oCaseFile.dReasonForResultId), len(aoFailedResults)));
     1440            if self.investigateSvcLogForVMRun(oCaseFile, oCaseFile.getSvcLog()):
     1441                return self.caseClosed(oCaseFile);
    14031442
    14041443        #
  • trunk/src/VBox/ValidationKit/testmanager/core/testresults.py

    r79919 r80128  
    220220        Get a list of test results instances actually contributing to cErrors.
    221221
    222         Returns a list of TestResultDataEx instance from this tree. (shared!)
     222        Returns a list of TestResultDataEx instances from this tree. (shared!)
    223223        """
    224224        # Check each child (if any).
     
    233233        if self.cErrors > cChildErrors:
    234234            aoRet.append(self);
     235
     236        return aoRet;
     237
     238    def getListOfLogFilesByKind(self, asKinds):
     239        """
     240        Get a list of test results instances actually contributing to cErrors.
     241
     242        Returns a list of TestResultFileDataEx instances from this tree. (shared!)
     243        """
     244        aoRet = [];
     245
     246        # Check the children first.
     247        for oChild in self.aoChildren:
     248            aoRet.extend(oChild.getListOfLogFilesByKind(asKinds));
     249
     250        # Check our own files next.
     251        for oFile in self.aoFiles:
     252            if oFile.sKind in asKinds:
     253                aoRet.append(oFile);
    235254
    236255        return aoRet;
     
    402421    ksKind_LogDebugVm           = 'log/debug/vm';
    403422    ksKind_LogReleaseSvc        = 'log/release/svc';
    404     ksKind_LogRebugSvc          = 'log/debug/svc';
     423    ksKind_LogDebugSvc          = 'log/debug/svc';
    405424    ksKind_LogReleaseClient     = 'log/release/client';
    406425    ksKind_LogDebugClient       = 'log/debug/client';
     
    427446        ksKind_LogDebugVm,
    428447        ksKind_LogReleaseSvc,
    429         ksKind_LogRebugSvc,
     448        ksKind_LogDebugSvc,
    430449        ksKind_LogReleaseClient,
    431450        ksKind_LogDebugClient,
Note: See TracChangeset for help on using the changeset viewer.

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