[llvm-commits] [zorg] r78339 - in /zorg/trunk: README.txt zorg/buildbot/commands/AnalyzerCompareCommand.py zorg/buildbot/commands/__init__.py
Daniel Dunbar
daniel at zuster.org
Thu Aug 6 14:29:26 PDT 2009
Author: ddunbar
Date: Thu Aug 6 16:29:26 2009
New Revision: 78339
URL: http://llvm.org/viewvc/llvm-project?rev=78339&view=rev
Log:
Buildbot command for use with clang/utils/analyzer/CmpRun, for
comparing two static analyzer runs.
Added:
zorg/trunk/zorg/buildbot/commands/AnalyzerCompareCommand.py
Modified:
zorg/trunk/README.txt
zorg/trunk/zorg/buildbot/commands/__init__.py
Modified: zorg/trunk/README.txt
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/README.txt?rev=78339&r1=78338&r2=78339&view=diff
==============================================================================
--- zorg/trunk/README.txt (original)
+++ zorg/trunk/README.txt Thu Aug 6 16:29:26 2009
@@ -8,7 +8,8 @@
the license agreement found in LICENSE.txt.
Zorg consists of several pieces:
- 1. A general database utilities for storing test results, with accompanying utilities.
+ 1. A general database utilities for storing test results, with
+ accompanying utilities.
2. A web app for submitting and querying test results.
@@ -21,3 +22,4 @@
Zorg is primarily implemented in Python, and has the following layout:
$ROOT/buildbot/ - Buildbot configurations.
$ROOT/zorg/ - The root zorg Python module.
+ $ROOT/zorg/buildbot/ - Reusable components for buildbot configurations.
Added: zorg/trunk/zorg/buildbot/commands/AnalyzerCompareCommand.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/commands/AnalyzerCompareCommand.py?rev=78339&view=auto
==============================================================================
--- zorg/trunk/zorg/buildbot/commands/AnalyzerCompareCommand.py (added)
+++ zorg/trunk/zorg/buildbot/commands/AnalyzerCompareCommand.py Thu Aug 6 16:29:26 2009
@@ -0,0 +1,108 @@
+import sys
+
+from buildbot.steps import shell
+from buildbot.status import builder
+from buildbot.process import buildstep
+
+class AnalyzerCompareCommand(shell.ShellCommand):
+ """Command suitable for displaying a comparison of two static analyzer
+ runs, as output by the clang 'utils/analyzer/CmpRun' tool."""
+
+ class Observer(buildstep.LogLineObserver):
+ def __init__(self):
+ buildstep.LogLineObserver.__init__(self)
+
+ # Counts of various reports.
+ self.num_reports = None
+ self.num_added = 0
+ self.num_removed = 0
+ self.num_changed = 0
+
+ # Reports to notify the user about; a list of tuples of (title,
+ # name, html-report).
+ self.reports = []
+
+ # Lines we couldn't parse.
+ self.invalid_lines = []
+
+ # Make sure we get all the data.
+ self.setMaxLineLength(sys.maxint)
+
+ def outLineReceived(self, line):
+ """This is called once with each line of the test log."""
+
+ # Ignore empty lines.
+ line = line.strip()
+ if not line:
+ return
+
+ # Everything else should be eval()able.
+ try:
+ data = eval(line)
+ key = data[0]
+ except:
+ self.invalid_lines.append(line)
+ return
+
+ # FIXME: Improve error checking.
+ if key == 'ADDED':
+ _,name,report = data
+ self.num_added += 1
+ self.reports.append(('added', str(name), str(report)))
+ elif key == 'REMOVED':
+ _,name,report = data
+ self.num_removed += 1
+ self.reports.append(('removed', str(name), str(report)))
+ elif key == 'CHANGED':
+ _,name,old_name,report,old_report = data
+ self.num_removed += 1
+ self.reports.append(('modified', str(name), str(report)))
+ elif key == 'TOTAL':
+ if self.num_reports is not None:
+ self.invalid_lines.append(line)
+ return
+
+ _,count = data
+ self.num_reports = count
+ else:
+ self.invalid_lines.append(line)
+
+ def __init__(self, **kwargs):
+ shell.ShellCommand.__init__(self, **kwargs)
+ self.observer = AnalyzerCompareCommand.Observer()
+ self.addLogObserver('comparison-data', self.observer)
+
+ def getText(self, cmd, results):
+ basic_info = self.describe(True)
+
+ added = self.observer.num_added
+ removed = self.observer.num_removed
+ changed = self.observer.num_changed
+ total = self.observer.num_reports
+
+ if total is not None:
+ basic_info.append('%d reports' % total)
+ for name,count in (("added", self.observer.num_added),
+ ("removed", self.observer.num_removed),
+ ("changed", self.observer.num_changed)):
+ if count:
+ basic_info.append('%d %s' % (count, name))
+
+ return basic_info
+
+ def createSummary(self, log):
+ # Add the "interesting" reports.
+ for title,name,data in self.observer.reports:
+ self.addHTMLLog("%s:%s" % (title, os.path.basename(name)), data)
+
+ def evaluateCommand(self, cmd):
+ # Always fail if the command itself failed.
+ if cmd.rc != 0:
+ return FAILURE
+
+ # Warn about added reports.
+ if self.observer.num_added:
+ return WARNINGS
+
+ return SUCCESS
+
Modified: zorg/trunk/zorg/buildbot/commands/__init__.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/commands/__init__.py?rev=78339&r1=78338&r2=78339&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/commands/__init__.py (original)
+++ zorg/trunk/zorg/buildbot/commands/__init__.py Thu Aug 6 16:29:26 2009
@@ -1,3 +1,4 @@
+import AnalyzerCompareCommand
import ClangTestCommand
import DejaGNUCommand
import GTestCommand
More information about the llvm-commits
mailing list