VirtualBox

Changeset 61445 in vbox


Ignore:
Timestamp:
Jun 3, 2016 1:27:26 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
107765
Message:

virtual_test_sheriff.py: Basic unit test investigation.

File:
1 edited

Legend:

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

    r61441 r61445  
    219219        self.oLogFile                = None;
    220220        self.asBsodReasons           = [];
     221        self.asUnitTestReasons       = [];
    221222
    222223        oParser = OptionParser();
     
    391392
    392393    ## BSOD category.
    393     ksBsodCategory    = 'BSOD';
     394    ksBsodCategory      = 'BSOD';
    394395    ## Special reason indicating that the flesh and blood sheriff has work to do.
    395     ksBsodAddNew      = 'Add new BSOD';
     396    ksBsodAddNew        = 'Add new BSOD';
     397
     398    ## Unit test category.
     399    ksUnitTestCategory  = 'Unit';
     400    ## Special reason indicating that the flesh and blood sheriff has work to do.
     401    ksUnitTestAddNew    = 'Add new';
    396402
    397403    ## Used for indica that we shouldn't report anything for this test result ID and
     
    553559        Checks out a VBox unittest problem.
    554560        """
    555         _ = oCaseFile;
    556 
    557         #
    558         # As a first step we'll just fish out what failed here and report
    559         # the unit test case name as the "reason".  This can mostly be done
    560         # using the TestResultDataEx bits, however in case it timed out and
    561         # got killed we have to fish the test timing out from the logs.
    562         #
    563 
    564         #
    565         # Report lone failures on the testcase, multiple failures must be
    566         # reported directly on the failing test (will fix the test result
    567         # listing to collect all of them).
    568         #
     561
     562        #
     563        # Process simple test case failures first, using their name as reason.
     564        # We do the reason management just like for BSODs.
     565        #
     566        cRelevantOnes = 0;
     567        aoFailedResults = oCaseFile.oTree.getListOfFailures();
     568        for oFailedResult in aoFailedResults:
     569            if oFailedResult is oCaseFile.oTree:
     570                cRelevantOnes += 1
     571            if oFailedResult.sName == 'Installing VirtualBox':
     572                self.vprint('TODO: Installation failure');
     573                cRelevantOnes += 1
     574            elif oFailedResult.sName == 'Uninstalling VirtualBox':
     575                self.vprint('TODO: Uninstallation failure');
     576                cRelevantOnes += 1
     577            elif oFailedResult.oParent is not None:
     578                # Get the 2nd level node because that's where we'll find the unit test name.
     579                o2ndLevel = oFailedResult;
     580                while o2ndLevel.oParent.oParent is not None:
     581                    o2ndLevel = o2ndLevel.oParent;
     582
     583                # Only report a failure once.
     584                if o2ndLevel.idTestResult not in oCaseFile.dReasonForResultId:
     585                    sKey = o2ndLevel.sName;
     586                    if sKey.startswith('testcase/'):
     587                        sKey = sKey[9:];
     588                    if sKey in self.asUnitTestReasons:
     589                        tReason = ( self.ksUnitTestCategory, sKey );
     590                        oCaseFile.noteReasonForId(tReason, oFailedResult.idTestResult);
     591                    else:
     592                        self.dprint('Unit test failure "%s" not found in %s;' % (sKey, self.asUnitTestReasons));
     593                        tReason = ( self.ksUnitTestCategory, self.ksUnitTestAddNew );
     594                        oCaseFile.noteReasonForId(tReason, oFailedResult.idTestResult, sComment = sKey);
     595                    cRelevantOnes += 1
     596            else:
     597                self.vprint('Internal error: expected oParent to NOT be None for %s' % (oFailedResult,));
     598
     599        #
     600        # If we've caught all the relevant ones by now, report the result.
     601        #
     602        if len(oCaseFile.dReasonForResultId) >= cRelevantOnes:
     603            return self.caseClosed(oCaseFile);
    569604        return False;
    570605
     
    613648                try:    sKey = '0x%08X' % (int(sKey, 16),);
    614649                except: pass;
    615                 if sKey in self.asBsodReasons or sKey.lower() in self.asBsodReasons:
     650                if sKey in self.asBsodReasons:
    616651                    tReason = ( self.ksBsodCategory, sKey );
     652                elif sKey.lower() in self.asBsodReasons: # just in case.
     653                    tReason = ( self.ksBsodCategory, sKey.lower() );
    617654                else:
    618655                    self.dprint('BSOD "%s" not found in %s;' % (sKey, self.asBsodReasons));
     
    819856        self.oTestResultFailureLogic = TestResultFailureLogic(self.oDb);
    820857        self.asBsodReasons           = self.oFailureReasonLogic.fetchForSheriffByNamedCategory(self.ksBsodCategory);
     858        self.asUnitTestReasons       = self.oFailureReasonLogic.fetchForSheriffByNamedCategory(self.ksUnitTestCategory);
    821859
    822860        # Get a fix on our 'now' before we do anything..
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