vbox的更動 61940 路徑 trunk/src/VBox/ValidationKit
- 時間撮記:
- 2016-6-29 下午05:03:08 (8 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/ValidationKit/testmanager/batch/virtual_test_sheriff.py
r61932 r61940 109 109 def noteReason(self, tReason): 110 110 """ 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,)); 112 112 self.tReason = tReason; 113 113 return True; … … 115 115 def noteReasonForId(self, tReason, idTestResult, sComment = None): 116 116 """ 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' 118 118 % (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 '')); 120 120 self.dReasonForResultId[idTestResult] = tReason; 121 121 if sComment is not None: … … 163 163 self.sMainLog = oFile.read(min(self.kcbMaxLogRead, oSizeOrError)).decode('utf-8', 'replace'); 164 164 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,)) 166 166 self.sMainLog = ''; 167 167 else: 168 self.oSheriff.vprint( 'Error opening main log file: %s' % (oSizeOrError,));168 self.oSheriff.vprint(u'Error opening main log file: %s' % (oSizeOrError,)); 169 169 return self.sMainLog; 170 170 … … 181 181 sContent = oFile.read(min(self.kcbMaxLogRead, oSizeOrError)).decode('utf-8', 'replace'); 182 182 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,)) 184 184 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,)); 186 186 return sContent; 187 187 … … 196 196 abImageFile = oFile.read(); 197 197 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,)) 199 199 else: 200 200 try: 201 201 oImage = Image.open(StringIO.StringIO(abImageFile)); 202 202 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,)) 204 204 else: 205 205 try: … … 207 207 oHash.update(oImage.tostring()); 208 208 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,)) 210 210 else: 211 211 return oHash.hexdigest(); … … 279 279 print 'error: %s' % (sText,); 280 280 if self.oLogFile is not None: 281 self.oLogFile.write( 'error: %s\n' % (sText,));281 self.oLogFile.write(u'error: %s\n' % (sText,)); 282 282 return 1; 283 283 … … 290 290 print 'debug: %s' % (sText, ); 291 291 if self.oLogFile is not None: 292 self.oLogFile.write( 'debug: %s\n' % (sText,));292 self.oLogFile.write(u'debug: %s\n' % (sText,)); 293 293 return 0; 294 294 … … 300 300 print 'info: %s' % (sText,); 301 301 if self.oLogFile is not None: 302 self.oLogFile.write( 'info: %s\n' % (sText,));302 self.oLogFile.write(u'info: %s\n' % (sText,)); 303 303 return 0; 304 304 … … 312 312 oFailureReason = self.oFailureReasonLogic.cachedLookupByNameAndCategory(tReason[1], tReason[0]); 313 313 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!' 315 315 % (tReason[1], tReason[0],)); 316 316 … … 319 319 oLogin = UserAccountLogic(self.oDb).tryFetchAccountByLoginName(VirtualTestSheriff.ksLoginName); 320 320 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,)); 322 322 return rcExit; 323 323 … … 352 352 continue; 353 353 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.' 355 355 % ( idTestBox, oTestBox.sName, )); 356 356 continue; 357 357 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' 359 359 % ( idTestBox, oTestBox.sName, oTestBox.enmPendingCmd)); 360 360 continue; … … 380 380 if iFirstOkay >= 2 and cBad > 2: 381 381 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' 383 383 % ( idTestBox, oTestBox.sName, iFirstOkay, cBad, cOkay)); 384 384 if self.oConfig.fRealRun is True: … … 388 388 % (iFirstOkay, cBad, cOkay),); 389 389 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,)); 391 391 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' 393 393 % ( idTestBox, oTestBox.sName, iFirstOkay, cBad, cOkay)); 394 394 if self.oConfig.fRealRun is True: … … 398 398 % (iFirstOkay, cBad, cOkay),); 399 399 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,)); 401 401 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' 403 403 % ( idTestBox, oTestBox.sName, iFirstOkay, cBad, cOkay)); 404 404 return rcExit; … … 458 458 dReasonForResultId[idKey] = tReason; 459 459 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)); 461 462 return False; 462 463 … … 465 466 fSingleReason = True; 466 467 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],)); 468 469 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])); 470 471 else: 471 472 fSingleReason = False; … … 477 478 dReasonForResultId = { oCaseFile.oTestSet.idTestResult: oCaseFile.tReason, }; 478 479 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,)); 480 481 return False; 481 482 482 self.vprint( 'Closing %s with following reason%s: %s'483 self.vprint(u'Closing %s with following reason%s: %s' 483 484 % ( oCaseFile.sName, 's' if dReasonForResultId > 0 else '', dReasonForResultId, )); 484 485 … … 503 504 self.oTestResultFailureLogic.addEntry(oAdd, self.uidSelf, fCommit = True); 504 505 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' 506 507 % (oXcpt, oAdd, oCaseFile.sLongName,)); 507 508 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],)); 509 510 return True; 510 511 … … 627 628 oCaseFile.noteReasonForId(tReason, oFailedResult.idTestResult); 628 629 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)); 630 631 tReason = ( self.ksUnitTestCategory, self.ksUnitTestAddNew ); 631 632 oCaseFile.noteReasonForId(tReason, oFailedResult.idTestResult, sComment = sKey); 632 633 cRelevantOnes += 1 633 634 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,)); 635 636 636 637 # … … 692 693 len(sVgaText) if sVgaText is not None else 0, 693 694 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,)); 699 700 700 701 # TODO: more … … 715 716 tReason = ( self.ksBsodCategory, sKey.lower() ); 716 717 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)); 718 719 tReason = ( self.ksBsodCategory, self.ksBsodAddNew ); 719 720 return oCaseFile.noteReasonForId(tReason, oFailedResult.idTestResult, sComment = sDetails.strip()); … … 795 796 if sScreenHash is not None: 796 797 sScreenHash = sScreenHash.lower(); 797 self.vprint( '%s %s' % ( sScreenHash, oFile.sFile,));798 self.vprint(u'%s %s' % ( sScreenHash, oFile.sFile,)); 798 799 if sVMLog is not None and investigateLogSet() is True: 799 800 return True; … … 866 867 # 867 868 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(),)); 869 870 sResultLog = TestSetData.extractLogSectionElapsed(sMainLog, oFailedResult.tsCreated, oFailedResult.tsElapsed); 870 871 if oFailedResult.sName == 'Installing VirtualBox': … … 880 881 oCaseFile.noteReasonForId(self.ktHarmless, oFailedResult.idTestResult); 881 882 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,)); 884 885 885 886 # … … 890 891 891 892 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. :-/' 893 894 % (len(oCaseFile.dReasonForResultId), len(aoFailedResults))); 894 895 else: 895 self.vprint( 'XXX: Could not figure out anything at all! :-(');896 self.vprint(u'XXX: Could not figure out anything at all! :-('); 896 897 return False; 897 898 … … 907 908 aoTestSets = self.oTestSetLogic.fetchFailedSetsWithoutReason(cHoursBack = self.oConfig.cHoursBack, tsNow = self.tsNow); 908 909 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,)) 911 912 912 913 # … … 922 923 923 924 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,)); 925 926 fRc = self.investigateBadTestBox(oCaseFile); 926 927 elif oCaseFile.isVBoxUnitTest(): 927 self.dprint( 'investigateVBoxUnitTest is taking over %s.' % (oCaseFile.sLongName,));928 self.dprint(u'investigateVBoxUnitTest is taking over %s.' % (oCaseFile.sLongName,)); 928 929 fRc = self.investigateVBoxUnitTest(oCaseFile); 929 930 elif oCaseFile.isVBoxInstallTest(): 930 self.dprint( 'investigateVBoxVMTest is taking over %s.' % (oCaseFile.sLongName,));931 self.dprint(u'investigateVBoxVMTest is taking over %s.' % (oCaseFile.sLongName,)); 931 932 fRc = self.investigateVBoxVMTest(oCaseFile, fSingleVM = True); 932 933 elif oCaseFile.isVBoxSmokeTest(): 933 self.dprint( 'investigateVBoxVMTest is taking over %s.' % (oCaseFile.sLongName,));934 self.dprint(u'investigateVBoxVMTest is taking over %s.' % (oCaseFile.sLongName,)); 934 935 fRc = self.investigateVBoxVMTest(oCaseFile, fSingleVM = False); 935 936 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,)); 937 938 fRc = False; 938 939 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), )); 940 941 return 0; 941 942
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器