Merge lp:~lool/lava-dispatcher/config into lp:~qzhang/lava-dispatcher/remove-hardcode

Proposed by Loïc Minier
Status: Needs review
Proposed branch: lp:~lool/lava-dispatcher/config
Merge into: lp:~qzhang/lava-dispatcher/remove-hardcode
Diff against target: 173 lines (+38/-62)
4 files modified
lava/actions/deploy.py (+1/-1)
lava/client.py (+6/-6)
lava/config.py (+27/-51)
lava/tests/test_config.py (+4/-4)
To merge this branch: bzr merge lp:~lool/lava-dispatcher/config
Reviewer Review Type Date Requested Status
Spring Zhang Approve
Review via email: mp+52955@code.launchpad.net

Description of the change

Fixes the issues I raised in my review, and implements proposed changes

To post a comment you must log in.
Revision history for this message
Spring Zhang (qzhang) wrote :

Thanks, I will merge it.

review: Approve
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

I think this got into trunk somehow or other.

Unmerged revisions

30. By Loïc Minier

Drop VexpressBoard as the data isn't confirmed for now.

29. By Loïc Minier

No need to instantiate boards anymore.

28. By Loïc Minier

Rename Boards to BOARDS to make it clear it's static.

27. By Loïc Minier

Drop Board.name, and let the client remember the hostname instead; this
avoids duplicating the data in Boards and in each Board.

26. By Loïc Minier

Also rename target to board here.

25. By Loïc Minier

Make uboot_cmds a class property instead of setting them in __init__.

24. By Loïc Minier

Fix testsuite to pass with the config in the trunk branch.

23. By Loïc Minier

Remove useless imports.

22. By Loïc Minier

Fix typo in imports breaking the tests.

21. By Loïc Minier

Drop unused function.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lava/actions/deploy.py'
2--- lava/actions/deploy.py 2011-03-07 17:58:46 +0000
3+++ lava/actions/deploy.py 2011-03-11 00:48:58 +0000
4@@ -3,7 +3,7 @@
5
6 class cmd_deploy_linaro_image(BaseAction):
7 def run(self, hwpack, rootfs):
8- print "deploying on %s" % self.client.target.name
9+ print "deploying on %s" % self.client.hostname
10 print " hwpack: %s" % hwpack
11 print " rootfs: %s" % rootfs
12 print "Booting master image"
13
14=== modified file 'lava/client.py'
15--- lava/client.py 2011-03-07 17:58:46 +0000
16+++ lava/client.py 2011-03-11 00:48:58 +0000
17@@ -1,9 +1,8 @@
18 import pexpect
19 import sys
20 import time
21-from lava.config import Board, BeagleBoard, PandaBoard
22-from lava.config import Mx51ekvBoard, VexpressBoard
23-from lava.config import Boards, LAVA_SERVER_IP
24+
25+from lava.config import BOARDS, LAVA_SERVER_IP
26
27 class LavaClient:
28 def __init__(self, hostname):
29@@ -11,8 +10,9 @@
30 self.proc = pexpect.spawn(cmd, timeout=300, logfile=sys.stdout)
31 #serial can be slow, races do funny things if you don't increase delay
32 self.proc.delaybeforesend=1
33- #This is temporary, eventually this should come from the db
34- self.target = Boards[hostname]
35+ self.hostname = hostname
36+ # will eventually come from the database
37+ self.board = BOARDS[hostname]
38
39 def in_master_shell(self):
40 """ Check that we are in a shell on the master image
41@@ -53,7 +53,7 @@
42 except:
43 self.hard_reboot()
44 self.enter_uboot()
45- uboot_cmds = self.target.uboot_cmds
46+ uboot_cmds = self.board.uboot_cmds
47 self.proc.sendline(uboot_cmds[0])
48 for line in range(1, len(uboot_cmds)):
49 self.proc.expect("#")
50
51=== modified file 'lava/config.py'
52--- lava/config.py 2011-03-07 17:58:46 +0000
53+++ lava/config.py 2011-03-11 00:48:58 +0000
54@@ -6,67 +6,43 @@
55 """
56
57 class Board(object):
58- def __init__(self, name):
59- self.name = name
60-
61- def change_uboot_cmds(self, uboot_cmds):
62- self.uboot_cmds = uboot_cmds
63+ pass
64
65 class BeagleBoard(Board):
66- def __init__(self, name):
67- Board.__init__(self, name)
68- self.uboot_cmds = ["mmc init",
69- "setenv bootcmd 'fatload mmc 0:3 0x80000000 uImage; fatload mmc " \
70- "0:3 0x81600000 uInitrd; bootm 0x80000000 0x81600000'",
71- "setenv bootargs ' console=tty0 console=ttyO2,115200n8 " \
72- "root=LABEL=testrootfs rootwait ro earlyprintk fixrtc nocompcache "\
73- "vram=12M omapfb.debug=y omapfb.mode=dvi:1280x720MR-16@60'",
74- "boot"]
75+ uboot_cmds = ["mmc init",
76+ "setenv bootcmd 'fatload mmc 0:3 0x80000000 uImage; fatload mmc "
77+ "0:3 0x81600000 uInitrd; bootm 0x80000000 0x81600000'",
78+ "setenv bootargs ' console=tty0 console=ttyO2,115200n8 "
79+ "root=LABEL=testrootfs rootwait ro earlyprintk fixrtc nocompcache "
80+ "vram=12M omapfb.debug=y omapfb.mode=dvi:1280x720MR-16@60'",
81+ "boot"]
82
83 class PandaBoard(Board):
84- def __init__(self, name):
85- Board.__init__(self, name)
86- self.uboot_cmds = ["mmc init",
87- "setenv bootcmd 'fatload mmc 0:5 0x80200000 uImage; fatload mmc " \
88- "0:5 0x81600000 uInitrd; bootm 0x80200000 0x81600000'",
89- "setenv bootargs ' console=tty0 console=ttyO2,115200n8 " \
90- "root=LABEL=testrootfs rootwait ro earlyprintk fixrtc nocompcache "\
91- "vram=32M omapfb.vram=0:8M mem=463M ip=none'",
92- "boot"]
93+ uboot_cmds = ["mmc init",
94+ "setenv bootcmd 'fatload mmc 0:5 0x80200000 uImage; fatload mmc "
95+ "0:5 0x81600000 uInitrd; bootm 0x80200000 0x81600000'",
96+ "setenv bootargs ' console=tty0 console=ttyO2,115200n8 "
97+ "root=LABEL=testrootfs rootwait ro earlyprintk fixrtc nocompcache "
98+ "vram=32M omapfb.vram=0:8M mem=463M ip=none'",
99+ "boot"]
100
101 class Mx51evkBoard(Board):
102- def __init__(self, name):
103- Board.__init__(self, name)
104- self.uboot_cmds = ["mmc init",
105- "setenv bootcmd 'fatload mmc 0:5 0x90800000 uImage; fatload mmc " \
106- "0:5 0x90800000 uInitrd; bootm 0x90000000 0x90800000'",
107- "setenv bootargs ' console=tty0 console=ttymxc0,115200n8 " \
108- "root=LABEL=testrootfs rootwait ro'",
109- "boot"]
110-
111-class VexpressBoard(Board):
112- def __init__(self, name):
113- Board.__init__(self, name)
114- #vexpress board uboot cmds is not exact here, please check if a board
115- #is available
116- self.uboot_cmds = ["mmc init",
117- "setenv bootcmd 'fatload mmc 0:5 0x80000000 uImage; fatload mmc " \
118- "0:5 0x81600000 uInitrd; bootm 0x80000000 0x81600000'",
119- "setenv bootargs ' console=tty0 console=ttyO2,115200n8 " \
120- "root=LABEL=testrootfs rootwait ro earlyprintk fixrtc nocompcache "\
121- "vram=12M omapfb.debug=y omapfb.mode=dvi:1280x720MR-16@60'",
122- "boot"]
123+ uboot_cmds = ["mmc init",
124+ "setenv bootcmd 'fatload mmc 0:5 0x90800000 uImage; fatload mmc "
125+ "0:5 0x90800000 uInitrd; bootm 0x90000000 0x90800000'",
126+ "setenv bootargs ' console=tty0 console=ttymxc0,115200n8 "
127+ "root=LABEL=testrootfs rootwait ro'",
128+ "boot"]
129
130 #Here, it still needs to maintain a map from boardid to board, for there is only
131 #boardid in jobfile.json
132-Boards = {
133- "panda01": PandaBoard("panda01"),
134- "panda02": PandaBoard("panda02"),
135- "beagle01": BeagleBoard("beagle01"),
136- "vexpress01": VexpressBoard("vexpress01"),
137- "vexpress02": VexpressBoard("vexpress02"),
138- "bbg01": Mx51evkBoard("bbg01"),
139+BOARDS = {
140+ "panda01": PandaBoard,
141+ "panda02": PandaBoard,
142+ "beagle01": BeagleBoard,
143+ "bbg01": Mx51evkBoard,
144 }
145
146 #Main LAVA server IP in the boards farm
147 LAVA_SERVER_IP = "192.168.1.10"
148+
149
150=== modified file 'lava/tests/test_config.py'
151--- lava/tests/test_config.py 2011-03-07 17:58:46 +0000
152+++ lava/tests/test_config.py 2011-03-11 00:48:58 +0000
153@@ -1,9 +1,9 @@
154 from unittest import TestCase
155-from lava.config import Board, BeagleBoard, PandaBoard, Mx51ekvBoard
156-from lava.config import Boards, LAVA_SERVER_IP
157+
158+from lava.config import BOARDS, LAVA_SERVER_IP
159
160 class TestConfigData(TestCase):
161- def test_beaglexm01_uboot_cmds(self):
162+ def test_beagle01_uboot_cmds(self):
163 expected = [
164 "mmc init",
165 "setenv bootcmd 'fatload mmc 0:3 0x80000000 uImage; fatload mmc "
166@@ -13,7 +13,7 @@
167 "nocompcache vram=12M omapfb.debug=y "
168 "omapfb.mode=dvi:1280x720MR-16@60'",
169 "boot"]
170- brd = Boards["beaglexm01"]
171+ brd = BOARDS["beagle01"]
172 uboot_cmds = brd.uboot_cmds
173 self.assertEquals(expected, uboot_cmds)
174

Subscribers

People subscribed via source and target branches

to all changes: