[Buildbot-commits] buildbot/buildbot/steps shell.py,1.25,1.26

Brian Warner warner at users.sourceforge.net
Tue May 27 00:52:31 UTC 2008


Update of /cvsroot/buildbot/buildbot/buildbot/steps
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11485/buildbot/steps

Modified Files:
	shell.py 
Log Message:
[project @ #228:perl-module-tests.patch]
Patch by Neil Hemingway <nhemingway at googlemail.com> to add a PerlModuleTest step

Original author: dustin at v.igoro.us
Date: 2008-05-27 00:05:57+00:00

Index: shell.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/steps/shell.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- shell.py	27 May 2008 00:52:21 -0000	1.25
+++ shell.py	27 May 2008 00:52:29 -0000	1.26
@@ -363,3 +363,56 @@
     descriptionDone = ["test"]
     command = ["make", "test"]
 
+class PerlModuleTest(Test):
+    command=["prove", "--lib", "lib", "-r", "t"]
+    total = 0
+
+    def evaluateCommand(self, cmd):
+        lines = self.getLog('stdio').readlines()
+
+        re_test_result = re.compile("^(All tests successful)|(\d+)/(\d+) subtests failed|Files=\d+, Tests=(\d+),")
+
+        mos = map(lambda line: re_test_result.search(line), lines)
+        test_result_lines = [mo.groups() for mo in mos if mo]
+
+        if not test_result_lines:
+            return cmd.rc
+
+        test_result_line = test_result_lines[0]
+
+        success = test_result_line[0]
+
+        if success:
+            failed = 0
+
+            test_totals_line = test_result_lines[1]
+            total_str = test_totals_line[3]
+
+            rc = SUCCESS
+        else:
+            failed_str = test_result_line[1]
+            failed = int(failed_str)
+
+            total_str = test_result_line[2]
+
+            rc = FAILURE
+
+        total = int(total_str)
+        passed = total - failed
+
+        self.total, self.failed, self.passed = total, failed, passed
+
+        self.setProperty('tests-total', total, "PerlModuleTest")
+        self.setProperty('tests-failed', failed, "PerlModuleTest")
+        self.setProperty('tests-passed', passed, "PerlModuleTest")
+
+        self.warnings = failed
+
+        return rc
+
+    def getText(self, cmd, results):
+        if self.total:
+            return [ "%d failed, %d passed" % (self.failed, self.passed) ]
+        else:
+            return [ "no results" ]
+





More information about the Commits mailing list