[pypy-svn] r76865 - in pypy/build/bot2/pypybuildbot: . test

antocuni at codespeak.net antocuni at codespeak.net
Sat Sep 4 12:48:30 CEST 2010


Author: antocuni
Date: Sat Sep  4 12:48:29 2010
New Revision: 76865

Modified:
   pypy/build/bot2/pypybuildbot/builds.py
   pypy/build/bot2/pypybuildbot/summary.py
   pypy/build/bot2/pypybuildbot/test/test_summary.py
Log:
add two properties to the build status of own tests and app-level tests:

  - a summary of test result (i.e., the number of passed/failed/etc tests)

  - the description of the test (to distinguish e.g. own and applevel tests)

The idea is to use these infos to build an index revision->test status, and
show it on the nightly build page



Modified: pypy/build/bot2/pypybuildbot/builds.py
==============================================================================
--- pypy/build/bot2/pypybuildbot/builds.py	(original)
+++ pypy/build/bot2/pypybuildbot/builds.py	Sat Sep  4 12:48:29 2010
@@ -54,6 +54,19 @@
                         [self.translationTarget] + targetArgs)
         #self.command = ['cp', '/tmp/pypy-c', '.']
 
+
+class TestRunnerCmd(ShellCmd):
+
+    def commandComplete(self, cmd):
+        from pypybuildbot.summary import RevisionOutcomeSet
+        pytestLog = cmd.logs['pytestLog']
+        outcome = RevisionOutcomeSet(None)
+        outcome.populate(pytestLog)
+        summary = outcome.get_summary()
+        build_status = self.build.build_status
+        build_status.setProperty('test_summary', summary, "TestRunnerCmd")
+        build_status.setProperty('test_description', self.description, "TestRunnerCmd")
+
 # ________________________________________________________________
 
 def setup_steps(platform, factory, workdir=None):
@@ -72,6 +85,7 @@
                                workdir=workdir))
 
 
+
 class Own(factory.BuildFactory):
 
     def __init__(self, platform='linux', cherrypick='', extra_cfgs=[]):
@@ -79,7 +93,7 @@
 
         setup_steps(platform, self)
 
-        self.addStep(ShellCmd(
+        self.addStep(TestRunnerCmd(
             description="pytest",
             command=["python", "testrunner/runner.py",
                      "--logfile=testrun.log",
@@ -109,7 +123,7 @@
         if app_tests:
             if app_tests == True:
                 app_tests = []
-            self.addStep(ShellCmd(
+            self.addStep(TestRunnerCmd(
                 description="app-level (-A) test",
                 command=["python", "testrunner/runner.py",
                          "--logfile=pytest-A.log",

Modified: pypy/build/bot2/pypybuildbot/summary.py
==============================================================================
--- pypy/build/bot2/pypybuildbot/summary.py	(original)
+++ pypy/build/bot2/pypybuildbot/summary.py	Sat Sep  4 12:48:29 2010
@@ -23,6 +23,16 @@
         return "%dm" % mins
     return "%dh%d" % (mins/60, mins%60)
 
+class OutcomeSummary(object):
+    def __init__(self, p, F, s, x):
+        self.p = p # passed
+        self.F = F # failed
+        self.s = s # skipped
+        self.x = x # xfailed
+
+    def __str__(self):
+        return '%d, %d F, %d s, %d x' % (self.p, self.F, self.s, self.x)
+
 class RevisionOutcomeSet(object):
 
     def __init__(self, rev, key=None, run_info=None):
@@ -35,6 +45,12 @@
         self.longreprs = {}
         self._run_info = run_info
 
+    def get_summary(self):
+        return OutcomeSummary(self.numpassed,
+                              len(self.failed),
+                              len(self.skipped),
+                              self.numxfailed)
+
     def populate_one(self, name, shortrepr, longrepr=None):
         if shortrepr == '!':
             namekey = [name, '']

Modified: pypy/build/bot2/pypybuildbot/test/test_summary.py
==============================================================================
--- pypy/build/bot2/pypybuildbot/test/test_summary.py	(original)
+++ pypy/build/bot2/pypybuildbot/test/test_summary.py	Sat Sep  4 12:48:29 2010
@@ -46,6 +46,29 @@
         key_namekey = rev_outcome_set.get_key_namekey(("a.c", "test_four"))
         assert key_namekey == (('foo', 40), ("a.c", "test_four"))
 
+    def test_get_summary(self):
+        rev_outcome_set = summary.RevisionOutcomeSet(None)
+
+        log = StringIO(""". a/b.py:test_one
+F a/b.py:test_two
+F a/b.py:test_three
+s a/c.py:test_four
+s a/c.py:test_five
+s a/c.py:test_six
+x a/c.py:test_seven
+x a/c.py:test_eight
+x a/c.py:test_nine
+x a/c.py:test_ten
+""")
+        
+        rev_outcome_set.populate(log)
+        sum = rev_outcome_set.get_summary()
+        assert sum.p == 1
+        assert sum.F == 2
+        assert sum.s == 3
+        assert sum.x == 4
+        assert str(sum) == '1, 2 F, 3 s, 4 x'
+
     def test_populate_from_empty(self):
         rev_outcome_set = summary.RevisionOutcomeSet(0)
         log = StringIO("")



More information about the Pypy-commit mailing list