Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Side by Side Diff: third_party/buildbot_8_4p1/buildbot/test/unit/test_status_builder_cache.py

Issue 9703108: Switch to the good LRU implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 # This file is part of Buildbot. Buildbot is free software: you can
2 # redistribute it and/or modify it under the terms of the GNU General Public
3 # License as published by the Free Software Foundation, version 2.
4 #
5 # This program is distributed in the hope that it will be useful, but WITHOUT
6 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
7 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
8 # details.
9 #
10 # You should have received a copy of the GNU General Public License along with
11 # this program; if not, write to the Free Software Foundation, Inc., 51
12 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
13 #
14 # Copyright Buildbot Team Members
15
16 import os
17 from mock import Mock
18 from twisted.trial import unittest
19 from buildbot.status import builder, master
20
21 class TestBuildStatus(unittest.TestCase):
22
23 # that buildstep.BuildStepStatus is never instantiated here should tell you
24 # that these classes are not well isolated!
25
26 def setupBuilder(self, buildername, category=None):
27 b = builder.BuilderStatus(buildername=buildername, category=category)
28 # Ackwardly, Status sets this member variable.
cmp 2012/03/16 21:57:08 Ackwardly -> Awkwardly
szager 2012/03/16 22:02:24 Done.
29 b.basedir = os.path.abspath(self.mktemp())
30 os.mkdir(b.basedir)
31 # Otherwise, builder.nextBuildNumber is not defined.
32 b.determineNextBuildNumber()
33 # Must initialize these fields before pickling.
34 b.currentBigState = 'idle'
35 b.status = 'idle'
36 return b
37
38 def setupStatus(self, b):
39 m = Mock()
40 m.buildbotURL = 'http://buildbot:8010/'
41 m.basedir = '/basedir'
42 s = master.Status(m)
43 b.status = s
44 return s
45
46 def testBuildCache(self):
47 b = self.setupBuilder('builder_1')
48 builds = []
49 for i in xrange(5):
50 build = b.newBuild()
51 build.setProperty('propkey', 'propval%d' % i, 'test')
52 builds.append(build)
53 build.buildStarted(build)
54 build.buildFinished()
55 for build in builds:
56 build2 = b.getBuild(build.number)
57 self.assertTrue(build2)
58 self.assertEqual(build2.number, build.number)
59 self.assertEqual(build.getProperty('propkey'),
60 'propval%d' % build.number)
cmp 2012/03/16 21:57:08 can you add a test to verify that the cache's hits
szager 2012/03/16 22:02:24 Done.
OLDNEW
« no previous file with comments | « third_party/buildbot_8_4p1/buildbot/status/builder.py ('k') | third_party/buildbot_8_4p1/buildbot/util/lru.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698