VirtualBox

Changeset 65317 in vbox


Ignore:
Timestamp:
Jan 16, 2017 11:37:48 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
112891
Message:

vsheriff: Extended the bad-testbox handling to include failure reason 'Host/Driver not unloading'.

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

Legend:

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

    r65306 r65317  
    328328        return 0;
    329329
     330    def getFailureReason(self, tReason):
     331        """ Gets the failure reason object for tReason. """
     332        return self.oFailureReasonLogic.cachedLookupByNameAndCategory(tReason[1], tReason[0]);
    330333
    331334    def selfCheck(self):
     
    335338            if sAttr.startswith('ktReason_'):
    336339                tReason = getattr(self.__class__, sAttr);
    337                 oFailureReason = self.oFailureReasonLogic.cachedLookupByNameAndCategory(tReason[1], tReason[0]);
     340                oFailureReason = self.getFailureReason(tReason);
    338341                if oFailureReason is None:
    339342                    rcExit = self.eprint(u'Failed to find failure reason "%s" in category "%s" in the database!'
     
    366369
    367370        #
     371        # Generate a list of failures reasons we consider bad-testbox behavior.
     372        #
     373        aidFailureReasons = [
     374            self.getFailureReason(self.ktReason_Host_DriverNotUnloading).idFailureReason,
     375        ];
     376
     377        #
    368378        # Get list of bad test boxes for given period and check them out individually.
    369379        #
    370         aidBadTestBoxes = self.oTestSetLogic.fetchBadTestBoxIds(cHoursBack = cHoursBack, tsNow = tsNow);
     380        aidBadTestBoxes = self.oTestSetLogic.fetchBadTestBoxIds(cHoursBack = cHoursBack, tsNow = tsNow,
     381                                                                aidFailureReasons = aidFailureReasons);
    371382        for idTestBox in aidBadTestBoxes:
    372383            # Skip if the testbox is already disabled or has a pending reboot command.
     
    394405                    cBad += 1;
    395406                else:
    396                     ## @todo maybe check the elapsed time here, it could still be a bad run.
    397                     cOkay += 1;
    398                     if iFirstOkay > iSet:
    399                         iFirstOkay = iSet;
     407                    # Check for bad failure reasons.
     408                    oFailure = None;
     409                    if oSet.enmStatus in TestSetData.kasBadTestStatuses:
     410                        oFailure = self.oTestResultFailureLogic.getById(oSet.idTestResult);
     411                    if oFailure is not None and oFailure.idFailureReason in aidFailureReasons:
     412                        cBad += 1;
     413                    else:
     414                        # This is an okay test result then.
     415                        ## @todo maybe check the elapsed time here, it could still be a bad run?
     416                        cOkay += 1;
     417                        if iFirstOkay > iSet:
     418                            iFirstOkay = iSet;
    400419                if iSet > 10:
    401420                    break;
     
    522541        #
    523542        for idTestResult, tReason in dReasonForResultId.items():
    524             oFailureReason = self.oFailureReasonLogic.cachedLookupByNameAndCategory(tReason[1], tReason[0]);
     543            oFailureReason = self.getFailureReason(tReason);
    525544            if oFailureReason is not None:
    526545                sComment = 'Set by $Revision$' # Handy for reverting later.
     
    641660        an uninstall first and will be seeing similar issues to the uninstall.
    642661        """
     662        _ = fInstall;
     663
    643664        atSimple = self.katSimpleInstallUninstallMainLogReasons;
    644665        if oCaseFile.oTestBox.sOs in self.kdatSimpleInstallUninstallMainLogReasonsPerOs:
     
    11381159                self.uidSelf = self.oLogin.uid;
    11391160
     1161        #
    11401162        # Do the stuff.
     1163        #
    11411164        if rcExit == 0:
    11421165            rcExit  = self.selfCheck();
     
    11461169            if rcExit == 0:
    11471170                rcExit = rcExit2;
     1171            # Redo the bad testbox management after failure reasons have been assigned (got timing issues).
     1172            if rcExit == 0:
     1173                rcExit = self.badTestBoxManagement();
    11481174
    11491175        # Cleanup.
  • trunk/src/VBox/ValidationKit/testmanager/core/testset.py

    r62484 r65317  
    742742    #
    743743
    744     def fetchBadTestBoxIds(self, cHoursBack = 2, tsNow = None):
     744    def fetchBadTestBoxIds(self, cHoursBack = 2, tsNow = None, aidFailureReasons = None):
    745745        """
    746746        Fetches a list of test box IDs which returned bad-testbox statuses in the
     
    749749        if tsNow is None:
    750750            tsNow = self._oDb.getCurrentTimestamp();
    751         self._oDb.execute('SELECT DISTINCT idTestBox\n'
    752                           'FROM   TestSets\n'
    753                           'WHERE  TestSets.enmStatus = \'bad-testbox\'\n'
    754                           '   AND tsDone           <= %s\n'
    755                           '   AND tsDone            > (%s - interval \'%s hours\')\n'
    756                           , ( tsNow, tsNow, cHoursBack,));
     751        if aidFailureReasons is None:
     752            aidFailureReasons = [ -1, ];
     753        self._oDb.execute('(SELECT idTestBox\n'
     754                          ' FROM   TestSets\n'
     755                          ' WHERE  TestSets.enmStatus = \'bad-testbox\'\n'
     756                          '    AND tsDone           <= %s\n'
     757                          '    AND tsDone            > (%s - interval \'%s hours\')\n'
     758                          ') UNION (\n'
     759                          ' SELECT TestSets.idTestBox\n'
     760                          '   FROM TestSets,\n'
     761                          '        TestResultFailures\n'
     762                          '  WHERE TestSets.tsDone                   <= %s\n'
     763                          '    AND TestSets.tsDone                   >  (%s - interval \'%s hours\')\n'
     764                          '    AND TestSets.enmStatus                >= \'failure\'::TestStatus_T\n'
     765                          '    AND TestSets.idTestSet                 = TestResultFailures.idTestSet\n'
     766                          '    AND TestResultFailures.tsExpire        = \'infinity\'::TIMESTAMP\n'
     767                          '    AND TestResultFailures.idFailureReason IN ('
     768                          + ', '.join([str(i) for i in aidFailureReasons]) + ')\n'
     769                          ')\n'
     770                          , ( tsNow, tsNow, cHoursBack,
     771                              tsNow, tsNow, cHoursBack, ));
    757772        return [aoRow[0] for aoRow in self._oDb.fetchAll()];
    758773
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