diff options
| author | George Karpenkov <ekarpenkov@apple.com> | 2018-02-13 23:36:01 +0000 |
|---|---|---|
| committer | George Karpenkov <ekarpenkov@apple.com> | 2018-02-13 23:36:01 +0000 |
| commit | b7120c944b90ae41c52f7a1e6bc363497a329e30 (patch) | |
| tree | 6b2a4a294af13dc6b920675810508b36e28ddcb8 /clang/utils/analyzer/CmpRuns.py | |
| parent | 6358064d02aba4c65b651364a10357ba8d74b3c1 (diff) | |
| download | bcm5719-llvm-b7120c944b90ae41c52f7a1e6bc363497a329e30.tar.gz bcm5719-llvm-b7120c944b90ae41c52f7a1e6bc363497a329e30.zip | |
[analyzer] [tests] Update CmpRuns to write to stdout correctly in multithreaded environment
llvm-svn: 325070
Diffstat (limited to 'clang/utils/analyzer/CmpRuns.py')
| -rwxr-xr-x | clang/utils/analyzer/CmpRuns.py | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/clang/utils/analyzer/CmpRuns.py b/clang/utils/analyzer/CmpRuns.py index 8ffc872bd86..918e9a9f79b 100755 --- a/clang/utils/analyzer/CmpRuns.py +++ b/clang/utils/analyzer/CmpRuns.py @@ -26,6 +26,7 @@ Usage: """ +import sys import os import plistlib from math import log @@ -264,7 +265,8 @@ def compareResults(A, B, opts): return res -def dumpScanBuildResultsDiff(dirA, dirB, opts, deleteEmpty=True): +def dumpScanBuildResultsDiff(dirA, dirB, opts, deleteEmpty=True, + Stdout=sys.stdout): # Load the run results. resultsA = loadResults(dirA, opts, opts.rootA, deleteEmpty) resultsB = loadResults(dirB, opts, opts.rootB, deleteEmpty) @@ -282,30 +284,30 @@ def dumpScanBuildResultsDiff(dirA, dirB, opts, deleteEmpty=True): for res in diff: a, b = res if a is None: - print "ADDED: %r" % b.getReadableName() + Stdout.write("ADDED: %r\n" % b.getReadableName()) foundDiffs += 1 totalAdded += 1 if auxLog: - print >>auxLog, ("('ADDED', %r, %r)" % (b.getReadableName(), - b.getReport())) + auxLog.write("('ADDED', %r, %r)\n" % (b.getReadableName(), + b.getReport())) elif b is None: - print "REMOVED: %r" % a.getReadableName() + Stdout.write("REMOVED: %r\n" % a.getReadableName()) foundDiffs += 1 totalRemoved += 1 if auxLog: - print >>auxLog, ("('REMOVED', %r, %r)" % (a.getReadableName(), - a.getReport())) + auxLog.write("('REMOVED', %r, %r)\n" % (a.getReadableName(), + a.getReport())) else: pass TotalReports = len(resultsB.diagnostics) - print "TOTAL REPORTS: %r" % TotalReports - print "TOTAL DIFFERENCES: %r" % foundDiffs - print "TOTAL ADDED: %r" % totalAdded - print "TOTAL REMOVED: %r" % totalRemoved + Stdout.write("TOTAL REPORTS: %r\n" % TotalReports) + Stdout.write("TOTAL ADDED: %r\n" % totalAdded) + Stdout.write("TOTAL REMOVED: %r\n" % totalRemoved) if auxLog: - print >>auxLog, "('TOTAL NEW REPORTS', %r)" % TotalReports - print >>auxLog, "('TOTAL DIFFERENCES', %r)" % foundDiffs + auxLog.write("('TOTAL NEW REPORTS', %r)\n" % TotalReports) + auxLog.write("('TOTAL DIFFERENCES', %r)\n" % foundDiffs) + auxLog.close() return foundDiffs, len(resultsA.diagnostics), len(resultsB.diagnostics) |

