[pypy-svn] r50892 - pypy/build/buildbot

exarkun at codespeak.net exarkun at codespeak.net
Tue Jan 22 23:09:34 CET 2008


Author: exarkun
Date: Tue Jan 22 23:09:33 2008
New Revision: 50892

Modified:
   pypy/build/buildbot/pypy_status.py
Log:
a little hack to make testing easier; also omit builders with absolutely no results

Modified: pypy/build/buildbot/pypy_status.py
==============================================================================
--- pypy/build/buildbot/pypy_status.py	(original)
+++ pypy/build/buildbot/pypy_status.py	Tue Jan 22 23:09:33 2008
@@ -8,6 +8,82 @@
 from buildbot.interfaces import LOG_CHANNEL_STDOUT
 from buildbot.status.web.base import ICurrentBox, HtmlResource, map_branches, build_get_class
 
+def body(self, request):
+    status = self.getStatus(request)
+    builderNames = status.getBuilderNames()
+    failedTests = {}
+    anyBuildResults = Set()
+
+    buildNumbers = range(self.oldBuildCount - 1, -1, -1)
+
+    for name in builderNames:
+        recentFailures = Set()
+        builder = status.getBuilder(name)
+        recentBuilds = builder.generateFinishedBuilds(
+            branches=[None], num_builds=self.oldBuildCount)
+        for build in recentBuilds:
+            recentFailures.update(self.getLog(build, 'failed').splitlines())
+
+    for builderName in builderNames:
+        builder = status.getBuilder(builderName)
+        recentBuilds = builder.generateFinishedBuilds(
+            branches=[None], num_builds=self.oldBuildCount)
+        for buildNumber, build in enumerate(recentBuilds):
+            passed = self.getLog(build, 'passed').splitlines()
+            failed = self.getLog(build, 'failed').splitlines()
+            skipped = self.getLog(build, 'skipped').splitlines()
+            if passed or failed or skipped:
+                anyBuildResults.add(builderName)
+            results = dict.fromkeys(
+                passed,
+                tags.span(style="background-color: green;")['P'])
+            results.update(
+                dict.fromkeys(
+                    failed,
+                    tags.span(style="background-color: red;")['F']))
+            results.update(
+                dict.fromkeys(
+                    skipped,
+                    tags.span(style="background-color: yellow;")['S']))
+
+            for testName in recentFailures:
+                key = (builderName, buildNumber, testName)
+                failedTests[key] = results.get(
+                    testName,
+                    tags.span(style="background-color: cyan;")['?'])
+
+    testResultsTable = tags.table()
+    heading = tags.tr()
+    for buildNumber in buildNumbers:
+        heading[tags.td()[buildNumber]]
+    heading[tags.td()["<- How many builds ago"]]
+    testResultsTable[heading]
+
+    builderNames = [
+        name for name in builderNames if name in anyBuildResults]
+
+    for testName in recentFailures:
+        row = tags.tr()
+        for buildNumber in buildNumbers:
+            result = []
+            for builderName in builderNames:
+                key = (builderName, buildNumber, testName)
+                result.append(failedTests[key])
+            row[tags.td()[result]]
+        row[tags.td()[testName]]
+        testResultsTable[row]
+
+    legend = tags.div[
+        tags.div()["P - Passed"],
+        tags.div()["F - Failed"],
+        tags.div()["S - Skipped"],
+        tags.div()["? - No result available"]]
+
+    return flatten(tags.div()[
+        legend,
+        testResultsTable])
+
+
 class RecentlyFailingTests(HtmlResource):
     oldBuildCount = 10
 
@@ -21,68 +97,10 @@
         return ''
 
     def body(self, request):
-        status = self.getStatus(request)
-        builderNames = status.getBuilderNames()
-	failedTests = {}
-
-	buildNumbers = range(self.oldBuildCount - 1, -1, -1)
-
-        for name in builderNames:
-            recentFailures = Set()
-            builder = status.getBuilder(name)
-            recentBuilds = builder.generateFinishedBuilds(
-                branches=[None], num_builds=self.oldBuildCount)
-            for build in recentBuilds:
-                print build
-                recentFailures.update(self.getLog(build, 'failed').splitlines())
-
-        for builderName in builderNames:
-            builder = status.getBuilder(builderName)
-            recentBuilds = builder.generateFinishedBuilds(
-                branches=[None], num_builds=self.oldBuildCount)
-            for buildNumber, build in enumerate(recentBuilds):
-                results = dict.fromkeys(
-                    self.getLog(build, 'passed').splitlines(),
-                    tags.span(style="background-color: green;")['P'])
-                results.update(
-                    dict.fromkeys(
-                        self.getLog(build, 'failed').splitlines(),
-                        tags.span(style="background-color: red;")['F']))
-                results.update(
-                    dict.fromkeys(
-                        self.getLog(build, 'skipped').splitlines(),
-                        tags.span(style="background-color: yellow;")['S']))
-
-                for testName in recentFailures:
-                    key = (builderName, buildNumber, testName)
-                    failedTests[key] = results.get(
-                        testName,
-                        tags.span(style="background-color: cyan;")['?'])
-
-        testResultsTable = tags.table()
-        heading = tags.tr()
-        for buildNumber in buildNumbers:
-            heading[tags.td()[buildNumber]]
-        heading[tags.td()["<- How many builds ago"]]
-        testResultsTable[heading]
-
-        for testName in recentFailures:
-            row = tags.tr()
-            for buildNumber in buildNumbers:
-                result = []
-                for builderName in builderNames:
-                    key = (builderName, buildNumber, testName)
-                    result.append(failedTests[key])
-                row[tags.td()[result]]
-            row[tags.td()[testName]]
-            testResultsTable[row]
-
-        legend = tags.div[
-            tags.div()["P - Passed"],
-            tags.div()["F - Failed"],
-            tags.div()["S - Skipped"],
-            tags.div()["? - No result available"]]
-
-        return flatten(tags.div()[
-            legend,
-            testResultsTable])
+        # Avoid having to restart the master to manually exercise each code
+        # change by putting all the interesting logic into a free function
+        # and reloading the module before each call to it.  Yea, this is
+        # retarded, but this isn't real software anyway.
+        import pypy_status
+        reload(pypy_status)
+        return body(self, request)



More information about the Pypy-commit mailing list