Merge lp:~bigkevmcd/offspring/offspring-master-armhf into lp:offspring

Proposed by Kevin McDermott
Status: Merged
Approved by: Cody A.W. Somerville
Approved revision: 123
Merged at revision: 122
Proposed branch: lp:~bigkevmcd/offspring/offspring-master-armhf
Merge into: lp:offspring
Diff against target: 71 lines (+37/-2)
2 files modified
lib/offspring/master/master.py (+1/-0)
lib/offspring/master/tests/test_master.py (+36/-2)
To merge this branch: bzr merge lp:~bigkevmcd/offspring/offspring-master-armhf
Reviewer Review Type Date Requested Status
Cody A.W. Somerville Approve
Review via email: mp+95409@code.launchpad.net

Description of the change

This adds support for building armhf projects on armv7l builders.

To post a comment you must log in.
Revision history for this message
Cody A.W. Somerville (cody-somerville) :
review: Approve
Revision history for this message
Cody A.W. Somerville (cody-somerville) wrote :

Food for future thought: Is there a way we can more generically test the arch to machine_type relation in dispatch code? Having a test per arch seems of dubious value.

Revision history for this message
Kevin McDermott (bigkevmcd) wrote :

Yip...we could split the project.arch -> builder arch lookup out into something like get_builder_arches_for_project, and then test that we can translate for the various project.arch values that they get translated to something appropriate.

It's called refactoring ;-)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/offspring/master/master.py'
2--- lib/offspring/master/master.py 2011-11-17 11:58:02 +0000
3+++ lib/offspring/master/master.py 2012-03-01 16:50:23 +0000
4@@ -157,6 +157,7 @@
5 u"lpia": [u"i386", u"i686", u"x86_64"],
6 u"amd64": [u"x86_64"],
7 u"armel": [u"armv7l"],
8+ u"armhf": [u"armv7l"],
9 }
10 build_requests = self.db_store.find(BuildRequest).order_by(
11 Desc(BuildRequest.score))
12
13=== modified file 'lib/offspring/master/tests/test_master.py'
14--- lib/offspring/master/tests/test_master.py 2011-11-30 11:42:08 +0000
15+++ lib/offspring/master/tests/test_master.py 2012-03-01 16:50:23 +0000
16@@ -26,7 +26,7 @@
17 return LexbuilderMaster(self.config, self.db_store,
18 mailer=self.mailer.mail)
19
20- def create_builder(self, current_state=Slave.STATE_IDLE):
21+ def create_builder(self, current_state=Slave.STATE_IDLE, arch=None):
22 """
23 Create and add a Lexbuilder to the store.
24 """
25@@ -36,7 +36,7 @@
26 builder.current_state = current_state
27 builder.is_active = True
28 builder.is_okay = True
29- builder.machine_type = self.project.arch
30+ builder.machine_type = arch or self.project.arch
31 self.db_store.add(builder)
32 return builder
33
34@@ -322,3 +322,37 @@
35 {"name": self.project.name, "priority": self.project.priority,
36 "builder": builder.name},
37 log_file.getvalue())
38+
39+ def test_dispatch_to_armhf_builder(self):
40+ """
41+ If a project requires an armhf build, we should dispatch to armv7l
42+ builders.
43+ """
44+ log_file = self.capture_logging(log_level=logging.DEBUG)
45+ builder1 = self.create_builder(arch=u"armv7l")
46+ builder2 = self.create_builder(arch=u"i386")
47+ self.project.arch = u"armhf"
48+
49+ build_request = self.create_build_request()
50+ build_result = BuildResult(build_request, builder1)
51+ build_result.name = u"20111115-testing"
52+ self.db_store.add(build_result)
53+
54+ builder1.current_job_id = build_result.id
55+
56+ builder_mock = self.mocker.patch(builder1)
57+ builder_mock.build(ANY)
58+ self.mocker.result(builder1.current_job)
59+
60+ master = self.get_master()
61+ self.mocker.replay()
62+
63+ master.dispatchBuilds()
64+
65+ self.assertEqual(
66+ "Starting up offspring master\n"
67+ "Project %(name)s needs building (priority: %(priority)d).\n"
68+ "%(name)s has been dispatched to %(builder)s\n" % {
69+ "name": self.project.name, "priority": self.project.priority,
70+ "builder": builder1.name},
71+ log_file.getvalue())

Subscribers

People subscribed via source and target branches