VirtualBox

Changeset 61940 in vbox for trunk


Ignore:
Timestamp:
Jun 29, 2016 5:03:08 PM (8 years ago)
Author:
vboxsync
Message:

grr, unicode.

File:
1 edited

Legend:

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

    r61932 r61940  
    109109    def noteReason(self, tReason):
    110110        """ Notes down a possible reason. """
    111         self.oSheriff.dprint('noteReason: %s -> %s' % (self.tReason, tReason,));
     111        self.oSheriff.dprint(u'noteReason: %s -> %s' % (self.tReason, tReason,));
    112112        self.tReason = tReason;
    113113        return True;
     
    115115    def noteReasonForId(self, tReason, idTestResult, sComment = None):
    116116        """ Notes down a possible reason for a specific test result. """
    117         self.oSheriff.dprint('noteReasonForId: %u: %s -> %s%s'
     117        self.oSheriff.dprint(u'noteReasonForId: %u: %s -> %s%s'
    118118                             % (idTestResult, self.dReasonForResultId.get(idTestResult, None), tReason,
    119                                 (' (%s)' % (sComment,)) if sComment is not None else ''));
     119                                (u' (%s)' % (sComment,)) if sComment is not None else ''));
    120120        self.dReasonForResultId[idTestResult] = tReason;
    121121        if sComment is not None:
     
    163163                self.sMainLog = oFile.read(min(self.kcbMaxLogRead, oSizeOrError)).decode('utf-8', 'replace');
    164164            except Exception as oXcpt:
    165                 self.oSheriff.vprint('Error reading main log file: %s' % (oXcpt,))
     165                self.oSheriff.vprint(u'Error reading main log file: %s' % (oXcpt,))
    166166                self.sMainLog = '';
    167167        else:
    168             self.oSheriff.vprint('Error opening main log file: %s' % (oSizeOrError,));
     168            self.oSheriff.vprint(u'Error opening main log file: %s' % (oSizeOrError,));
    169169        return self.sMainLog;
    170170
     
    181181                sContent = oFile.read(min(self.kcbMaxLogRead, oSizeOrError)).decode('utf-8', 'replace');
    182182            except Exception as oXcpt:
    183                 self.oSheriff.vprint('Error reading the "%s" log file: %s' % (oFile.sFile, oXcpt,))
     183                self.oSheriff.vprint(u'Error reading the "%s" log file: %s' % (oFile.sFile, oXcpt,))
    184184        else:
    185             self.oSheriff.vprint('Error opening the "%s" log file: %s' % (oFile.sFile, oSizeOrError,));
     185            self.oSheriff.vprint(u'Error opening the "%s" log file: %s' % (oFile.sFile, oSizeOrError,));
    186186        return sContent;
    187187
     
    196196            abImageFile = oFile.read();
    197197        except Exception as oXcpt:
    198             self.oSheriff.vprint('Error reading the "%s" image file: %s' % (oFile.sFile, oXcpt,))
     198            self.oSheriff.vprint(u'Error reading the "%s" image file: %s' % (oFile.sFile, oXcpt,))
    199199        else:
    200200            try:
    201201                oImage = Image.open(StringIO.StringIO(abImageFile));
    202202            except Exception as oXcpt:
    203                 self.oSheriff.vprint('Error opening the "%s" image bytes using PIL.Image.open: %s' % (oFile.sFile, oXcpt,))
     203                self.oSheriff.vprint(u'Error opening the "%s" image bytes using PIL.Image.open: %s' % (oFile.sFile, oXcpt,))
    204204            else:
    205205                try:
     
    207207                    oHash.update(oImage.tostring());
    208208                except Exception as oXcpt:
    209                     self.oSheriff.vprint('Error hashing the uncompressed image bytes for "%s": %s' % (oFile.sFile, oXcpt,))
     209                    self.oSheriff.vprint(u'Error hashing the uncompressed image bytes for "%s": %s' % (oFile.sFile, oXcpt,))
    210210                else:
    211211                    return oHash.hexdigest();
     
    279279        print 'error: %s' % (sText,);
    280280        if self.oLogFile is not None:
    281             self.oLogFile.write('error: %s\n' % (sText,));
     281            self.oLogFile.write(u'error: %s\n' % (sText,));
    282282        return 1;
    283283
     
    290290                print 'debug: %s' % (sText, );
    291291            if self.oLogFile is not None:
    292                 self.oLogFile.write('debug: %s\n' % (sText,));
     292                self.oLogFile.write(u'debug: %s\n' % (sText,));
    293293        return 0;
    294294
     
    300300            print 'info: %s' % (sText,);
    301301        if self.oLogFile is not None:
    302             self.oLogFile.write('info: %s\n' % (sText,));
     302            self.oLogFile.write(u'info: %s\n' % (sText,));
    303303        return 0;
    304304
     
    312312                oFailureReason = self.oFailureReasonLogic.cachedLookupByNameAndCategory(tReason[1], tReason[0]);
    313313                if oFailureReason is None:
    314                     rcExit = self.eprint('Failured to find failure reason "%s" in category "%s" in the database!'
     314                    rcExit = self.eprint(u'Failed to find failure reason "%s" in category "%s" in the database!'
    315315                                         % (tReason[1], tReason[0],));
    316316
     
    319319            oLogin = UserAccountLogic(self.oDb).tryFetchAccountByLoginName(VirtualTestSheriff.ksLoginName);
    320320            if oLogin is None:
    321                 rcExit = self.eprint('Cannot find my user account "%s"!' % (VirtualTestSheriff.ksLoginName,));
     321                rcExit = self.eprint(u'Cannot find my user account "%s"!' % (VirtualTestSheriff.ksLoginName,));
    322322        return rcExit;
    323323
     
    352352                continue;
    353353            if not oTestBox.fEnabled:
    354                 self.dprint('badTestBoxManagement: Skipping test box #%u (%s) as it has been disabled already.'
     354                self.dprint(u'badTestBoxManagement: Skipping test box #%u (%s) as it has been disabled already.'
    355355                            % ( idTestBox, oTestBox.sName, ));
    356356                continue;
    357357            if oTestBox.enmPendingCmd != TestBoxData.ksTestBoxCmd_None:
    358                 self.dprint('badTestBoxManagement: Skipping test box #%u (%s) as it has a command pending: %s'
     358                self.dprint(u'badTestBoxManagement: Skipping test box #%u (%s) as it has a command pending: %s'
    359359                            % ( idTestBox, oTestBox.sName, oTestBox.enmPendingCmd));
    360360                continue;
     
    380380            if iFirstOkay >= 2 and cBad > 2:
    381381                if oTestBoxLogic.hasTestBoxRecentlyBeenRebooted(idTestBox, cHoursBack = cHoursBack, tsNow = tsNow):
    382                     self.vprint('Disabling testbox #%u (%s) - iFirstOkay=%u cBad=%u cOkay=%u'
     382                    self.vprint(u'Disabling testbox #%u (%s) - iFirstOkay=%u cBad=%u cOkay=%u'
    383383                                % ( idTestBox, oTestBox.sName, iFirstOkay, cBad, cOkay));
    384384                    if self.oConfig.fRealRun is True:
     
    388388                                                                  % (iFirstOkay, cBad, cOkay),);
    389389                        except Exception as oXcpt:
    390                             rcExit = self.eprint('Error disabling testbox #%u (%u): %s\n' % (idTestBox, oTestBox.sName, oXcpt,));
     390                            rcExit = self.eprint(u'Error disabling testbox #%u (%u): %s\n' % (idTestBox, oTestBox.sName, oXcpt,));
    391391                else:
    392                     self.vprint('Rebooting testbox #%u (%s) - iFirstOkay=%u cBad=%u cOkay=%u'
     392                    self.vprint(u'Rebooting testbox #%u (%s) - iFirstOkay=%u cBad=%u cOkay=%u'
    393393                                % ( idTestBox, oTestBox.sName, iFirstOkay, cBad, cOkay));
    394394                    if self.oConfig.fRealRun is True:
     
    398398                                                                 % (iFirstOkay, cBad, cOkay),);
    399399                        except Exception as oXcpt:
    400                             rcExit = self.eprint('Error rebooting testbox #%u (%u): %s\n' % (idTestBox, oTestBox.sName, oXcpt,));
     400                            rcExit = self.eprint(u'Error rebooting testbox #%u (%u): %s\n' % (idTestBox, oTestBox.sName, oXcpt,));
    401401            else:
    402                 self.dprint('badTestBoxManagement: #%u (%s) looks ok:  iFirstOkay=%u cBad=%u cOkay=%u'
     402                self.dprint(u'badTestBoxManagement: #%u (%s) looks ok:  iFirstOkay=%u cBad=%u cOkay=%u'
    403403                            % ( idTestBox, oTestBox.sName, iFirstOkay, cBad, cOkay));
    404404        return rcExit;
     
    458458                    dReasonForResultId[idKey] = tReason;
    459459            if len(dReasonForResultId) == 0:
    460                 self.vprint('TODO: Closing %s without a real reason, only %s.' % (oCaseFile.sName, oCaseFile.dReasonForResultId));
     460                self.vprint(u'TODO: Closing %s without a real reason, only %s.'
     461                            % (oCaseFile.sName, oCaseFile.dReasonForResultId));
    461462                return False;
    462463
     
    465466            fSingleReason = True;
    466467            if len(dReasonForResultId) == 1 and dReasonForResultId.keys()[0] != oCaseFile.oTestSet.idTestResult:
    467                 self.dprint('Promoting single reason to whole set: %s' % (atValues[0],));
     468                self.dprint(u'Promoting single reason to whole set: %s' % (atValues[0],));
    468469            elif len(dReasonForResultId) > 1 and len(atValues) == atValues.count(atValues[0]):
    469                 self.dprint('Merged %d reasons to a single one: %s' % (len(atValues), atValues[0]));
     470                self.dprint(u'Merged %d reasons to a single one: %s' % (len(atValues), atValues[0]));
    470471            else:
    471472                fSingleReason = False;
     
    477478            dReasonForResultId = { oCaseFile.oTestSet.idTestResult: oCaseFile.tReason, };
    478479        else:
    479             self.vprint('Closing %s without a reason - this should not happen!' % (oCaseFile.sName,));
     480            self.vprint(u'Closing %s without a reason - this should not happen!' % (oCaseFile.sName,));
    480481            return False;
    481482
    482         self.vprint('Closing %s with following reason%s: %s'
     483        self.vprint(u'Closing %s with following reason%s: %s'
    483484                    % ( oCaseFile.sName, 's' if dReasonForResultId > 0 else '', dReasonForResultId, ));
    484485
     
    503504                        self.oTestResultFailureLogic.addEntry(oAdd, self.uidSelf, fCommit = True);
    504505                    except Exception as oXcpt:
    505                         self.eprint('caseClosed: Exception "%s" while adding reason %s for %s'
     506                        self.eprint(u'caseClosed: Exception "%s" while adding reason %s for %s'
    506507                                    % (oXcpt, oAdd, oCaseFile.sLongName,));
    507508            else:
    508                 self.eprint('caseClosed: Cannot locate failure reason: %s / %s' % ( tReason[0], tReason[1],));
     509                self.eprint(u'caseClosed: Cannot locate failure reason: %s / %s' % ( tReason[0], tReason[1],));
    509510        return True;
    510511
     
    627628                        oCaseFile.noteReasonForId(tReason, oFailedResult.idTestResult);
    628629                    else:
    629                         self.dprint('Unit test failure "%s" not found in %s;' % (sKey, self.asUnitTestReasons));
     630                        self.dprint(u'Unit test failure "%s" not found in %s;' % (sKey, self.asUnitTestReasons));
    630631                        tReason = ( self.ksUnitTestCategory, self.ksUnitTestAddNew );
    631632                        oCaseFile.noteReasonForId(tReason, oFailedResult.idTestResult, sComment = sKey);
    632633                    cRelevantOnes += 1
    633634            else:
    634                 self.vprint('Internal error: expected oParent to NOT be None for %s' % (oFailedResult,));
     635                self.vprint(u'Internal error: expected oParent to NOT be None for %s' % (oFailedResult,));
    635636
    636637        #
     
    692693                            len(sVgaText)   if sVgaText is not None else 0,
    693694                            len(sInfoText)  if sInfoText is not None else 0, ));
    694             #self.dprint('main.log<<<\n%s\n<<<\n' % (sResultLog,));
    695             #self.dprint('vbox.log<<<\n%s\n<<<\n' % (sVMLog,));
    696             #self.dprint('krnl.log<<<\n%s\n<<<\n' % (sKrnlLog,));
    697             #self.dprint('vgatext.txt<<<\n%s\n<<<\n' % (sVgaText,));
    698             #self.dprint('info.txt<<<\n%s\n<<<\n' % (sInfoText,));
     695            #self.dprint(u'main.log<<<\n%s\n<<<\n' % (sResultLog,));
     696            #self.dprint(u'vbox.log<<<\n%s\n<<<\n' % (sVMLog,));
     697            #self.dprint(u'krnl.log<<<\n%s\n<<<\n' % (sKrnlLog,));
     698            #self.dprint(u'vgatext.txt<<<\n%s\n<<<\n' % (sVgaText,));
     699            #self.dprint(u'info.txt<<<\n%s\n<<<\n' % (sInfoText,));
    699700
    700701            # TODO: more
     
    715716                    tReason = ( self.ksBsodCategory, sKey.lower() );
    716717                else:
    717                     self.dprint('BSOD "%s" not found in %s;' % (sKey, self.asBsodReasons));
     718                    self.dprint(u'BSOD "%s" not found in %s;' % (sKey, self.asBsodReasons));
    718719                    tReason = ( self.ksBsodCategory, self.ksBsodAddNew );
    719720                return oCaseFile.noteReasonForId(tReason, oFailedResult.idTestResult, sComment = sDetails.strip());
     
    795796                if sScreenHash is not None:
    796797                    sScreenHash = sScreenHash.lower();
    797                     self.vprint('%s  %s' % ( sScreenHash, oFile.sFile,));
     798                    self.vprint(u'%s  %s' % ( sScreenHash, oFile.sFile,));
    798799        if sVMLog is not None and investigateLogSet() is True:
    799800            return True;
     
    866867        #
    867868        for oFailedResult in aoFailedResults:
    868             self.dprint('Looking at test result #%u - %s' % (oFailedResult.idTestResult, oFailedResult.getFullName(),));
     869            self.dprint(u'Looking at test result #%u - %s' % (oFailedResult.idTestResult, oFailedResult.getFullName(),));
    869870            sResultLog = TestSetData.extractLogSectionElapsed(sMainLog, oFailedResult.tsCreated, oFailedResult.tsElapsed);
    870871            if oFailedResult.sName == 'Installing VirtualBox':
     
    880881                oCaseFile.noteReasonForId(self.ktHarmless, oFailedResult.idTestResult);
    881882            else:
    882                 self.vprint('TODO: Cannot place idTestResult=%u - %s' % (oFailedResult.idTestResult, oFailedResult.sName,));
    883                 self.dprint('%s + %s <<\n%s\n<<' % (oFailedResult.tsCreated, oFailedResult.tsElapsed, sResultLog,));
     883                self.vprint(u'TODO: Cannot place idTestResult=%u - %s' % (oFailedResult.idTestResult, oFailedResult.sName,));
     884                self.dprint(u'%s + %s <<\n%s\n<<' % (oFailedResult.tsCreated, oFailedResult.tsElapsed, sResultLog,));
    884885
    885886        #
     
    890891
    891892        if len(oCaseFile.dReasonForResultId) > 0:
    892             self.vprint('TODO: Got %u out of %u - close, but no cigar. :-/'
     893            self.vprint(u'TODO: Got %u out of %u - close, but no cigar. :-/'
    893894                        % (len(oCaseFile.dReasonForResultId), len(aoFailedResults)));
    894895        else:
    895             self.vprint('XXX: Could not figure out anything at all! :-(');
     896            self.vprint(u'XXX: Could not figure out anything at all! :-(');
    896897        return False;
    897898
     
    907908        aoTestSets = self.oTestSetLogic.fetchFailedSetsWithoutReason(cHoursBack = self.oConfig.cHoursBack, tsNow = self.tsNow);
    908909        for oTestSet in aoTestSets:
    909             self.dprint('');
    910             self.dprint('reasoningFailures: Checking out test set #%u, status %s'  % ( oTestSet.idTestSet, oTestSet.enmStatus,))
     910            self.dprint(u'');
     911            self.dprint(u'reasoningFailures: Checking out test set #%u, status %s'  % ( oTestSet.idTestSet, oTestSet.enmStatus,))
    911912
    912913            #
     
    922923
    923924            if oTestSet.enmStatus == TestSetData.ksTestStatus_BadTestBox:
    924                 self.dprint('investigateBadTestBox is taking over %s.' % (oCaseFile.sLongName,));
     925                self.dprint(u'investigateBadTestBox is taking over %s.' % (oCaseFile.sLongName,));
    925926                fRc = self.investigateBadTestBox(oCaseFile);
    926927            elif oCaseFile.isVBoxUnitTest():
    927                 self.dprint('investigateVBoxUnitTest is taking over %s.' % (oCaseFile.sLongName,));
     928                self.dprint(u'investigateVBoxUnitTest is taking over %s.' % (oCaseFile.sLongName,));
    928929                fRc = self.investigateVBoxUnitTest(oCaseFile);
    929930            elif oCaseFile.isVBoxInstallTest():
    930                 self.dprint('investigateVBoxVMTest is taking over %s.' % (oCaseFile.sLongName,));
     931                self.dprint(u'investigateVBoxVMTest is taking over %s.' % (oCaseFile.sLongName,));
    931932                fRc = self.investigateVBoxVMTest(oCaseFile, fSingleVM = True);
    932933            elif oCaseFile.isVBoxSmokeTest():
    933                 self.dprint('investigateVBoxVMTest is taking over %s.' % (oCaseFile.sLongName,));
     934                self.dprint(u'investigateVBoxVMTest is taking over %s.' % (oCaseFile.sLongName,));
    934935                fRc = self.investigateVBoxVMTest(oCaseFile, fSingleVM = False);
    935936            else:
    936                 self.vprint('reasoningFailures: Unable to classify test set: %s' % (oCaseFile.sLongName,));
     937                self.vprint(u'reasoningFailures: Unable to classify test set: %s' % (oCaseFile.sLongName,));
    937938                fRc = False;
    938939            cGot += fRc is True;
    939         self.vprint('reasoningFailures: Got %u out of %u' % (cGot, len(aoTestSets), ));
     940        self.vprint(u'reasoningFailures: Got %u out of %u' % (cGot, len(aoTestSets), ));
    940941        return 0;
    941942
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