[PATCH] D43098: [analyzer] [tests] [NFC] Remove a fragile tightly-coupled component emulating parser output
George Karpenkov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 9 10:41:40 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rC324759: [analyzer] [tests] [NFC] Remove a fragile tightly-coupled component emulating… (authored by george.karpenkov, committed by ).
Herald added a subscriber: cfe-commits.
Repository:
rC Clang
https://reviews.llvm.org/D43098
Files:
utils/analyzer/CmpRuns.py
utils/analyzer/SATestBuild.py
Index: utils/analyzer/SATestBuild.py
===================================================================
--- utils/analyzer/SATestBuild.py
+++ utils/analyzer/SATestBuild.py
@@ -566,7 +566,8 @@
RefDir, NewDir))
PatchedSourceDirPath = os.path.join(Dir, PatchedSourceDirName)
- Opts = CmpRuns.CmpOptions(rootA="", rootB=PatchedSourceDirPath)
+ Opts, Args = CmpRuns.generate_option_parser().parse_args(
+ ["", PatchedSourceDirPath])
# Scan the results, delete empty plist files.
NumDiffs, ReportsInRef, ReportsInNew = \
CmpRuns.dumpScanBuildResultsDiff(RefDir, NewDir, Opts, False)
Index: utils/analyzer/CmpRuns.py
===================================================================
--- utils/analyzer/CmpRuns.py
+++ utils/analyzer/CmpRuns.py
@@ -102,20 +102,6 @@
return self._data
-class CmpOptions:
- """
- Fake output of option parser with manually constructed options.
- """
-
- def __init__(self, verboseLog=None, rootA="", rootB=""):
- self.rootA = rootA
- self.rootB = rootB
- self.verboseLog = verboseLog
- self.relative_path_histogram = False
- self.relative_log_path_histogram = False
- self.absolute_path_histogram = False
-
-
class AnalysisReport:
def __init__(self, run, files):
self.run = run
@@ -322,9 +308,7 @@
return foundDiffs, len(resultsA.diagnostics), len(resultsB.diagnostics)
-
-def main():
- from optparse import OptionParser
+def generate_option_parser():
parser = OptionParser("usage: %prog [options] [dir A] [dir B]")
parser.add_option("", "--rootA", dest="rootA",
help="Prefix to ignore on source files for directory A",
@@ -334,24 +318,29 @@
action="store", type=str, default="")
parser.add_option("", "--verbose-log", dest="verboseLog",
help="Write additional information to LOG \
- [default=None]",
+ [default=None]",
action="store", type=str, default=None,
metavar="LOG")
parser.add_option("--relative-path-differences-histogram",
action="store_true", dest="relative_path_histogram",
default=False,
help="Show histogram of relative paths differences. \
- Requires matplotlib")
+ Requires matplotlib")
parser.add_option("--relative-log-path-differences-histogram",
action="store_true", dest="relative_log_path_histogram",
default=False,
help="Show histogram of log relative paths differences. \
- Requires matplotlib")
+ Requires matplotlib")
parser.add_option("--absolute-path-differences-histogram",
action="store_true", dest="absolute_path_histogram",
default=False,
help="Show histogram of absolute paths differences. \
- Requires matplotlib")
+ Requires matplotlib")
+ return parser
+
+
+def main():
+ parser = generate_option_parser()
(opts, args) = parser.parse_args()
if len(args) != 2:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43098.133649.patch
Type: text/x-patch
Size: 3376 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180209/7e1b9353/attachment.bin>
More information about the cfe-commits
mailing list