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

Subscribers

People subscribed via source and target branches