[llvm-commits] [zorg] r172310 - in /zorg/trunk/zorg/buildbot: builders/ClangBuilder.py builders/KLEEBuilder.py commands/DejaGNUCommand.py commands/__init__.py

David Blaikie dblaikie at gmail.com
Sat Jan 12 00:14:35 PST 2013


Author: dblaikie
Date: Sat Jan 12 02:14:35 2013
New Revision: 172310

URL: http://llvm.org/viewvc/llvm-project?rev=172310&view=rev
Log:
Add a new & improved DejaGNUCommand

* Uses a LogObserver to monitor logs interactively
* Creates full log files for any test file that fails
* Renders all DejaGNUresult types in the rollup rather than pass/fail/warn

This doesn't support the suppressions used to run the old GDB and GCC test
suites on MacOS. I've left the old version in the form of
SuppressionDejaGNUCommand in my previous commit.

Added:
    zorg/trunk/zorg/buildbot/commands/DejaGNUCommand.py
Modified:
    zorg/trunk/zorg/buildbot/builders/ClangBuilder.py
    zorg/trunk/zorg/buildbot/builders/KLEEBuilder.py
    zorg/trunk/zorg/buildbot/commands/__init__.py

Modified: zorg/trunk/zorg/buildbot/builders/ClangBuilder.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/ClangBuilder.py?rev=172310&r1=172309&r2=172310&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/builders/ClangBuilder.py (original)
+++ zorg/trunk/zorg/buildbot/builders/ClangBuilder.py Sat Jan 12 02:14:35 2013
@@ -9,6 +9,7 @@
 from buildbot.steps.transfer import FileDownload
 from zorg.buildbot.Artifacts import GetCompilerArtifacts, uploadArtifacts
 from zorg.buildbot.builders.Util import getConfigArgs
+from zorg.buildbot.commands import DejaGNUCommand
 from zorg.buildbot.commands import SuppressionDejaGNUCommand
 from zorg.buildbot.commands.BatchFileDownload import BatchFileDownload
 from zorg.buildbot.commands.ClangTestCommand import ClangTestCommand
@@ -581,7 +582,7 @@
                                           command=['make', WithProperties('-j%s' % jobs)],
                                           haltOnFailure=True,
                                           workdir='clang-tests/build'))
-    f.addStep(SuppressionDejaGNUCommand.SuppressionDejaGNUCommand(
+    f.addStep(DejaGNUCommand.DejaGNUCommand(
             name='gdb-75-check',
             command=['make', '-k', WithProperties('-j%s' % jobs), 'check'] + make_vars,
             workdir='clang-tests/build',

Modified: zorg/trunk/zorg/buildbot/builders/KLEEBuilder.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/KLEEBuilder.py?rev=172310&r1=172309&r2=172310&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/builders/KLEEBuilder.py (original)
+++ zorg/trunk/zorg/buildbot/builders/KLEEBuilder.py Sat Jan 12 02:14:35 2013
@@ -13,7 +13,7 @@
 import LLVMBuilder
 from Util import getConfigArgs
 
-from zorg.buildbot.commands.SuppressionDejaGNUCommand import SuppressionDejaGNUCommand
+from zorg.buildbot.commands.DejaGNUCommand import DejaGNUCommand
 
 def getKLEEBuildFactory(triple, jobs='%(jobs)d', llvm_branch='trunk',
                         config_name='Release+Asserts', clean=True, llvmgccdir=None,
@@ -73,7 +73,7 @@
                                           workdir='klee'))
 
     # Test.
-    f.addStep(SuppressionDejaGNUCommand(name="test",
+    f.addStep(DejaGNUCommand(name="test",
                              command=['nice', '-n', '10',
                                       'make', 'check'],
                              haltOnFailure=True, description="test klee",

Added: zorg/trunk/zorg/buildbot/commands/DejaGNUCommand.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/commands/DejaGNUCommand.py?rev=172310&view=auto
==============================================================================
--- zorg/trunk/zorg/buildbot/commands/DejaGNUCommand.py (added)
+++ zorg/trunk/zorg/buildbot/commands/DejaGNUCommand.py Sat Jan 12 02:14:35 2013
@@ -0,0 +1,72 @@
+import re
+import urllib
+import buildbot
+import buildbot.status.builder
+from buildbot.status.results import FAILURE, SUCCESS
+import buildbot.steps.shell
+from buildbot.process.buildstep import LogLineObserver
+from buildbot.steps.shell import Test
+
+class DejaGNULogObserver(LogLineObserver):
+    kStartLineRE = re.compile(r'Running .*/(.*/.*\.exp) \.\.\.');
+    kFinishLineRE = re.compile(r'testcase .*/(.*/.*\.exp) completed in .* seconds');
+    kTestStateLineRE = re.compile(r'(FAIL|PASS|XFAIL|XPASS|KFAIL|KPASS|UNRESOLVED|UNTESTED|UNSUPPORTED): .*')
+    failingCodes = set(['FAIL', 'XPASS', 'KPASS', 'UNRESOLVED'])
+    def __init__(self):
+        LogLineObserver.__init__(self)
+        self.resultCounts = {}
+        self.currentLines = ''
+        self.currentFailed = False
+        self.anyFailed = False
+    def outLineReceived(self, line):
+        if len(self.currentLines):
+            self.currentLines += '\n' + line
+            m = self.kTestStateLineRE.search(line)
+            if m:
+                resultCode, = m.groups()
+                if resultCode in self.failingCodes:
+                    self.hasFailed = True
+                    self.currentFailed = True
+                    self.anyFailed = True
+                if not resultCode in self.resultCounts:
+                    self.resultCounts[resultCode] = 0
+                self.resultCounts[resultCode] += 1
+            m = self.kFinishLineRE.match(line)
+            if m:
+                name, = m.groups()
+                if self.currentFailed:
+                    self.step.addCompleteLog(name.replace('/', '__'), self.currentLines)
+                self.currentLines = ''
+        else:
+            m = self.kStartLineRE.match(line)
+            if m:
+                self.currentLines = line
+                self.currentFailed = False
+
+class DejaGNUCommand(Test):
+    resultNames = {'FAIL':'unexpected failures',
+                   'PASS':'expected passes',
+                   'XFAIL':'expected failures',
+                   'XPASS':'unexpected passes',
+                   'KFAIL':'known failures',
+                   'KPASS':'unknown passes',
+                   'UNRESOLVED':'unresolved testcases',
+                   'UNTESTED':'untested testcases',
+                   'UNSUPPORTED':'unsupported tests'}
+
+    def __init__(self, ignore=[], flaky=[], max_logs=20,
+                 *args, **kwargs):
+        Test.__init__(self, *args, **kwargs)
+        self.logObserver = DejaGNULogObserver()
+        self.addLogObserver('gdb.log', self.logObserver)
+
+    def evaluateCommand(self, cmd):
+        if self.logObserver.anyFailed:
+            return FAILURE
+        return SUCCESS
+
+    def describe(self, done=False):
+        description = Test.describe(self, done)
+        for name, count in self.logObserver.resultCounts.iteritems():
+            description.append('{0} {1}'.format(count, self.resultNames[name]))
+        return description

Modified: zorg/trunk/zorg/buildbot/commands/__init__.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/commands/__init__.py?rev=172310&r1=172309&r2=172310&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/commands/__init__.py (original)
+++ zorg/trunk/zorg/buildbot/commands/__init__.py Sat Jan 12 02:14:35 2013
@@ -3,6 +3,7 @@
 import ClangTestCommand
 import LitTestCommand
 import SuppressionDejaGNUCommand
+import DejaGNUCommand
 import GTestCommand
 
 __all__ = []





More information about the llvm-commits mailing list