Merge lp:~pwlars/lava-dispatcher/add-uboot-support into lp:lava-dispatcher

Proposed by Paul Larson
Status: Merged
Merged at revision: 3
Proposed branch: lp:~pwlars/lava-dispatcher/add-uboot-support
Merge into: lp:lava-dispatcher
Diff against target: 79 lines (+53/-1)
1 file modified
lava/client.py (+53/-1)
To merge this branch: bzr merge lp:~pwlars/lava-dispatcher/add-uboot-support
Reviewer Review Type Date Requested Status
Linaro Validation Team Pending
Review via email: mp+47319@code.launchpad.net

Description of the change

This adds support for booting to test images, and other necessary
pieces for that, such as detecting and dealing with uboot.

To post a comment you must log in.
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Just two comments. I don't think we should default to beagle in the initializer. It makes it possible to omit this argument (or worse, develop on beagle all the time) and produce buggy code by accident. I would also create constants for names like beagle to make sure a simple typo will not be something hard to chase and debug. Right now it's not needed but I suspect this wil come back.

Thanks Paul
ZK

Revision history for this message
Paul Larson (pwlars) wrote :

> Just two comments. I don't think we should default to beagle in the
> initializer. It makes it possible to omit this argument (or worse, develop on
> beagle all the time) and produce buggy code by accident.
Yeah, for some things it's a reasonable default since we have a wide variety of boards that correspond to this hwpack. In this case though, it could be a bad assumption. I'll make it explicit.

> I would also create
> constants for names like beagle to make sure a simple typo will not be
> something hard to chase and debug. Right now it's not needed but I suspect
> this wil come back.
I'm not sure if I see how this would help. If I understand what you're getting at, in either case the failure would be pretty much the same - trying to reference an entry in the dict that does not exist, and getting nothing back to send to uboot?

Will check this in for now, and we can deal with that later if needed.

4. By Paul Larson

Make board type mandatory.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lava/client.py'
2--- lava/client.py 2011-01-21 22:46:55 +0000
3+++ lava/client.py 2011-01-26 19:48:26 +0000
4@@ -1,9 +1,30 @@
5 import pexpect
6
7+BOARDS = {
8+ "beagle":["mmc init",
9+ "setenv bootcmd 'fatload mmc 0:3 0x80000000 uImage; fatload mmc" \
10+ "0:3 0x81600000 uInitrd; bootm 0x80000000 0x81600000'",
11+ "setenv bootargs ' console=tty0 console=ttyO2,115200n8 " \
12+ "root=LABEL=testrootfs rootwait ro earlyprintk fixrtc nocompcache " \
13+ "vram=12M omapfb.debug=y omapfb.mode=dvi:1280x720MR-16@60'",
14+ "boot"],
15+ "panda":["mmc init",
16+ "setenv bootcmd 'fatload mmc 0:1 0x80200000 uImage; fatload mmc " \
17+ "0:1 0x81600000 uInitrd; bootm 0x80200000 0x81600000'",
18+ "setenv bootargs ' console=tty0 console=ttyO2,115200n8 " \
19+ "root=LABEL=testrootfs rootwait ro earlyprintk fixrtc nocompcache " \
20+ "vram=32M omapfb.vram=0:8M mem=463M ip=none'",
21+ "boot"]
22+}
23+
24 class SerialClient:
25- def __init__(self, hostname):
26+ def __init__(self, hostname, board_type):
27 cmd = "console %s" % hostname
28 self.proc = pexpect.spawn(cmd, timeout=300)
29+ #serial can be slow, races do funny things if ou don't increase delay
30+ self.proc.delaybeforesend=1
31+ #This is temporary, eventually I think this should be looked up
32+ self.board_type = board_type
33
34 def in_master_shell(self):
35 """ Check that we are in a shell on the master image
36@@ -13,6 +34,14 @@
37 if id == 1:
38 raise OperationFailed
39
40+ def in_test_shell(self):
41+ """ Check that we are in a shell on the test image
42+ """
43+ self.proc.sendline("")
44+ id = self.proc.expect(['root@localhost:', pexpect.TIMEOUT])
45+ if id == 1:
46+ raise OperationFailed
47+
48 def boot_master_image(self):
49 """ reboot the system, and check that we are in a master shell
50 """
51@@ -26,6 +55,29 @@
52 except:
53 raise
54
55+ def boot_test_image(self):
56+ """ Reboot the system to the test image
57+ """
58+ self.soft_reboot()
59+ try:
60+ self.enter_uboot()
61+ except:
62+ self.hard_reboot()
63+ self.enter_uboot()
64+ uboot_cmds = BOARDS[self.board_type]
65+ self.proc.sendline(uboot_cmds[0])
66+ for line in range(1, len(uboot_cmds)):
67+ self.proc.expect("#")
68+ self.proc.sendline(uboot_cmds[line])
69+ try:
70+ self.in_test_shell()
71+ except:
72+ raise
73+
74+ def enter_uboot(self):
75+ id = self.proc.expect("Hit any key to stop autoboot")
76+ self.proc.sendline("")
77+
78 def soft_reboot(self):
79 self.proc.sendline("reboot")
80

Subscribers

People subscribed via source and target branches