rImportantStdOutLines = rImportantStdOutLines, rImportantStdErrLines = rImportantStdErrLines, bGetDetailsHTML = dxConfig["bSaveReport"], fApplicationRunningCallback = fApplicationRunningHandler, fExceptionDetectedCallback = fExceptionDetectedHandler, fApplicationExitCallback = fApplicationExitHandler, ); oBugId.fWait(); if oBugId.oBugReport: print "* A bug was detected in the application."; print; print " Id: %s" % oBugId.oBugReport.sId; print " Description: %s" % oBugId.oBugReport.sBugDescription; print " Location: %s" % oBugId.oBugReport.sBugLocation; if oBugId.oBugReport.sBugSourceLocation: print " Source: %s" % oBugId.oBugReport.sBugSourceLocation; print " Security impact: %s" % oBugId.oBugReport.sSecurityImpact; if dxConfig["bSaveReport"]: sReportFileName = "%s @ %s.html" % (oBugId.oBugReport.sId, oBugId.oBugReport.sBugLocation); eWriteDataToFileResult = FileSystem.feWriteDataToFile( oBugId.oBugReport.sDetailsHTML, FileSystem.fsLocalPath(FileSystem.fsTranslateToValidName(sReportFileName)), fbRetryOnFailure = lambda: False, ); if eWriteDataToFileResult: print " Bug report: Cannot be saved (%s)" % repr(eWriteDataToFileResult); else: print " Bug report: %s (%d bytes)" % (sReportFileName, len(oBugId.oBugReport.sDetailsHTML)); else: print "* The application has terminated without crashing.";
oBugId.fWait(); if oBugId.oBugReport: print "+ A bug was detected in the application."; print; print " Id: %s" % oBugId.oBugReport.sId; print " Description: %s" % oBugId.oBugReport.sBugDescription; print " Location: %s" % oBugId.oBugReport.sBugLocation; if oBugId.oBugReport.sBugSourceLocation: print " Source: %s" % oBugId.oBugReport.sBugSourceLocation; print " Security impact: %s" % oBugId.oBugReport.sSecurityImpact; print " Run time: %s seconds" % (long(oBugId.fnApplicationRunTime() * 1000) / 1000.0); if dxConfig["bSaveReport"]: # We'd like a report file name base on the BugId, but the later may contain characters that are not valid in a file name sDesiredReportFileName = "%s @ %s.html" % (oBugId.oBugReport.sId, oBugId.oBugReport.sBugLocation); # Thus, we need to translate these characters to create a valid filename that looks very similar to the BugId sValidReportFileName = FileSystem.fsTranslateToValidName(sDesiredReportFileName, bUnicode = dxConfig["bUseUnicodeReportFileNames"]); eWriteDataToFileResult = FileSystem.feWriteDataToFile( oBugId.oBugReport.sDetailsHTML, FileSystem.fsLocalPath(sValidReportFileName), fbRetryOnFailure = lambda: False, ); if eWriteDataToFileResult: print " Bug report: Cannot be saved (%s)" % repr(eWriteDataToFileResult); else: print " Bug report: %s (%d bytes)" % (sValidReportFileName, len(oBugId.oBugReport.sDetailsHTML)); else: print "- The application has terminated without crashing."; print " Run time: %s seconds" % (long(oBugId.fnApplicationRunTime() * 1000) / 1000.0); if dxConfig["bShowLincenseAndDonationInfo"]: print;
def fFinishedHandler(oTest, oBugReport): global bFailed, oOutputLock; try: if not bFailed: oOutputLock and oOutputLock.acquire(); oTest.bHasOutputLock = True; if oTest.sExpectedBugTypeId: if not oBugReport: print "- Failed test: %s" % " ".join([dsBinaries_by_sISA[oTest.sISA]] + oTest.asCommandLineArguments); print " Expected: %s" % oTest.sExpectedBugTypeId; print " Got nothing"; bFailed = True; elif not oTest.sExpectedBugTypeId == oBugReport.sBugTypeId: print "- Failed test: %s" % " ".join([dsBinaries_by_sISA[oTest.sISA]] + oTest.asCommandLineArguments); print " Expected: %s" % oTest.sExpectedBugTypeId; print " Reported: %s @ %s" % (oBugReport.sId, oBugReport.sBugLocation); print " %s" % (oBugReport.sBugDescription); bFailed = True; else: print "+ %s" % oTest; elif oBugReport: print "- Failed test: %s" % " ".join([dsBinaries_by_sISA[oTest.sISA]] + oTest.asCommandLineArguments); print " Expected no report"; print " Reported: %s @ %s" % (oBugReport.sId, oBugReport.sBugLocation); print " %s" % (oBugReport.sBugDescription); bFailed = True; else: print "+ %s" % oTest; oOutputLock and oOutputLock.release(); oTest.bHasOutputLock = False; if bSaveTestReports and oBugReport: # We'd like a report file name base on the BugId, but the later may contain characters that are not valid in a file name sDesiredReportFileName = "%s @ %s.html" % (oBugReport.sId, oBugReport.sBugLocation); # Thus, we need to translate these characters to create a valid filename that looks very similar to the BugId sValidReportFileName = FileSystem.fsTranslateToValidName(sDesiredReportFileName, bUnicode = dxConfig["bUseUnicodeReportFilenames"]); ebCreateFolderResult = FileSystem.febCreateFolder( sReportsFolderName, oTest.asCommandLineArguments[0], # Type of crash fbRetryOnFailure = lambda: False, ); if not isinstance(ebCreateFolderResult, bool): oOutputLock and oOutputLock.acquire(); oTest.bHasOutputLock = True; print "- Failed test: %s" % " ".join([dsBinaries_by_sISA[oTest.sISA]] + oTest.asCommandLineArguments); print " Bug report cannot be saved becasue the folder %s\%s cannot be created (%s)" % \ (sReportsFolderName, oTest.asCommandLineArguments[0], repr(eCreateFolderResult)); oOutputLock and oOutputLock.release(); oTest.bHasOutputLock = False; bFailed = True; return; eWriteDataToFileResult = FileSystem.feWriteDataToFile( oBugReport.sDetailsHTML, sReportsFolderName, oTest.asCommandLineArguments[0], # Type of crash sValidReportFileName, fbRetryOnFailure = lambda: False, ); if eWriteDataToFileResult: oOutputLock and oOutputLock.acquire(); oTest.bHasOutputLock = True; print "- Failed test: %s" % " ".join([dsBinaries_by_sISA[oTest.sISA]] + oTest.asCommandLineArguments); print " Bug report cannot be saved (%s)" % repr(eWriteDataToFileResult); oOutputLock and oOutputLock.release(); oTest.bHasOutputLock = False; bFailed = True; return; finally: oTest.fFinished(); oTest.bHandlingResult = False;