Author: Matti Picus <matti.pi...@gmail.com>
Branch: 
Changeset: r1062:2416342c7b7b
Date: 2018-04-13 10:55 +0300
http://bitbucket.org/pypy/buildbot/changeset/2416342c7b7b/

Log:    test, fix for displaying more than one builder, add link to all
        RPython builders

diff --git a/bot2/pypybuildbot/summary.py b/bot2/pypybuildbot/summary.py
--- a/bot2/pypybuildbot/summary.py
+++ b/bot2/pypybuildbot/summary.py
@@ -324,7 +324,7 @@
     def __init__(self, status):
         self.sections = []
         self.cur_cat_branch=None
-        self.fixed_builder = False
+        self.n_builders = 0
         self.status = status
 
     def make_longrepr_url_for(self, outcome_set, namekey):
@@ -347,7 +347,7 @@
             builder = cachekey[0]
             anchors.append('  ')
             timing = ""
-            if self.fixed_builder and info['elapsed'] is not None:
+            if self.n_builders == 1 and info['elapsed'] is not None:
                 timing = " in %s" % show_elapsed(info['elapsed'])
             if info['times'][1] is not None:
                 day = time.localtime(info['times'][1])[:3]
@@ -396,7 +396,7 @@
         self.sections.append(html.h2(cat_anchor," ",branch_anchor, " ", extra))
 
     def _builder_anchor(self, builder):
-        if self.fixed_builder:
+        if self.n_builders > 0:
             url = self.status.getURLForThing(self.status.getBuilder(builder))
             cls = "builder"
         else:
@@ -409,7 +409,7 @@
         return outcome_set.map.values()[0].key
 
     def _label(self, outcome_set):
-        if self.fixed_builder:
+        if self.n_builders > 0:
             # (rev, buildNumber)
             buildNumber = self._builder_num(outcome_set)[1]
             return (outcome_set.revision, buildNumber)
@@ -419,7 +419,7 @@
 
     def _label_for_sorting(self, outcome_set):
         encodedrev = encode_rev_for_ordering(outcome_set.revision)
-        if self.fixed_builder:
+        if self.n_builders > 0:
             # (rev, buildNumber)
             buildNumber = self._builder_num(outcome_set)[1]
             return (encodedrev, buildNumber)
@@ -429,7 +429,7 @@
 
     def _label_anchor(self, outcome_set, revsize):
         rev = outcome_set.revision
-        if self.fixed_builder:
+        if self.n_builders > 0:
             pick = "builder=%s&builds=%d" % self._builder_num(outcome_set)
         else:
             pick = "recentrev=%s" % rev
@@ -738,7 +738,7 @@
         test_rev = make_test(only_recentrevs)
         test_branch = make_test(only_branches)
         test_builder = make_test(only_builder)
-        fixed_builder = bool(only_builder)
+        n_builders = len(only_builder) if only_builder else 0
         prune_old = not (only_builds or only_recentrevs or
                          only_builder or only_branches)
 
@@ -781,7 +781,7 @@
                 else:
                     rev = got_rev
                     buildNumber = build.getNumber()
-                    if fixed_builder:
+                    if n_builders > 0:
                         builds = runs.setdefault((buildNumber, rev), {})
                     else:
                         builds = runs.setdefault(rev, {})
@@ -858,8 +858,7 @@
         only_builder = request.args.get('builder', None)
         only_builds = None
         if only_builder is not None:
-            only_builder = only_builder[-1:] # pick exactly one
-            page.fixed_builder = True
+            page.n_builders = len(only_builder)
             build_select = request.args.get('builds', None)
             if build_select is not None:
                 only_builds = self._parse_builds(build_select)
diff --git a/bot2/pypybuildbot/test/test_summary.py 
b/bot2/pypybuildbot/test/test_summary.py
--- a/bot2/pypybuildbot/test/test_summary.py
+++ b/bot2/pypybuildbot/test/test_summary.py
@@ -687,6 +687,45 @@
 
         assert 'TEST1' in out
 
+    def test_many_builders_query_builder(self):
+        builder0 = status_builder.BuilderStatus('builder0', None, self.master, 
'')
+        builder1 = status_builder.BuilderStatus('builder1', None, self.master, 
'')
+        add_builds(builder0, [('60000', "F TEST1\n. b"),
+                             ('60000', ". a\n. b"),
+                             ('60001', "F TEST1\n. b")])
+        add_builds(builder1, [('60000', "F TEST1\n. b"),
+                             ('60000', ". a\n. b"),
+                             ('60001', "F TEST1\n. b")])
+
+        s = summary.Summary()
+        res = witness_cat_branch(s)
+        req = FakeRequest([builder0, builder1])
+        req.args={'builder': ['builder0', 'builder1']}
+        out = s.body(req)
+        cat_branch = res()
+
+        runs = cat_branch[(None, METABRANCH)][0]
+        assert sorted(runs.keys()) == [(0, '60000'), (1, '60000'), (2, 
'60001')]
+        outcome = runs[(0, '60000')]['builder0']
+        assert outcome.revision == '60000'
+        assert outcome.key == ('builder0', 0)
+        outcome = runs[(1, '60000')]['builder0']
+        assert outcome.revision == '60000'
+        assert outcome.key == ('builder0', 1)
+        outcome = runs[(2, '60001')]['builder0']
+        assert outcome.revision == '60001'
+        assert outcome.key == ('builder0', 2)
+
+        runs = []
+        for m in re.finditer(r'builder=(\w+)&amp;builds=(\d+)', out):
+            runs.append((m.group(1), int(m.group(2))))
+
+        assert runs == [('builder1', 0),
+                        ('builder1', 1),
+                        ('builder1', 2)]
+
+        assert 'TEST1' in out
+
 
     def test_many_builds_query_builder_builds(self):
         builder = status_builder.BuilderStatus('builder0', None, self.master, 
'')
diff --git a/bot2/pypybuildbot/util.py b/bot2/pypybuildbot/util.py
--- a/bot2/pypybuildbot/util.py
+++ b/bot2/pypybuildbot/util.py
@@ -1,6 +1,6 @@
 import os
 import socket
-from buildbot.buildslave.base import log
+from twisted.python import log
 
 def we_are_debugging():
     return socket.gethostname() != 'baroquesoftware'
diff --git a/master/templates/layout.html b/master/templates/layout.html
--- a/master/templates/layout.html
+++ b/master/templates/layout.html
@@ -30,6 +30,7 @@
         - <a href="{{ path_to_root }}summary?branch=py3.5">Summary (py3.5)</a>
         - <a href="{{ path_to_root }}summary?branch=py3.6">Summary (py3.6)</a>
         - <a href="{{ path_to_root }}summary">Summary</a>
+        - <a href="{{ path_to_root 
}}summary?builder=rpython-linux-x86-32&builder=rpython-linux-x86-64&builder=rpython-win-x86-32">RPython</a>
         - <a href="{{ path_to_root }}nightly/">Nightly builds</a>
         <!-- end of PyPy specific items -->
 
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to