Merge lp:~qzhang/lava-dispatcher/fix-874594 into lp:lava-dispatcher

Proposed by Spring Zhang
Status: Merged
Merged at revision: 153
Proposed branch: lp:~qzhang/lava-dispatcher/fix-874594
Merge into: lp:lava-dispatcher
Diff against target: 155 lines (+22/-12)
6 files modified
lava_dispatcher/__init__.py (+2/-0)
lava_dispatcher/actions/android_deploy.py (+1/-1)
lava_dispatcher/actions/boot_control.py (+3/-3)
lava_dispatcher/actions/lava-test.py (+4/-1)
lava_dispatcher/client.py (+9/-6)
lava_dispatcher/connection.py (+3/-1)
To merge this branch: bzr merge lp:~qzhang/lava-dispatcher/fix-874594
Reviewer Review Type Date Requested Status
Yongqin Liu Approve
Spring Zhang (community) Needs Resubmitting
Review via email: mp+80303@code.launchpad.net

Description of the change

1. fix 874594
2. Add default timeout to in_test_shell() to 10s
3. Delete LavaAndroidClient.in_test_shell for its duplication
4. Add timeout protection for more pexpect.expect()
5. Adjust general LavaClient timeout to 20mins
6. add boot_linaro_image action if not in test image

To post a comment you must log in.
Revision history for this message
Yongqin Liu (liuyq0307) wrote :

Thanks, all seems ok except the "6. add boot_linaro_image action if not in test image" one.
I guess we execute "client.in_test_shell()" at a assumption that already boot_linaro_image,
if we do this in the test action, do we need to check "in_test_shell" again?

And for test action of android, I think it should be client.boot_linaro_android_image.

review: Needs Fixing
157. By Spring Zhang

fix boot_linaro_android_image in android test cases

Revision history for this message
Spring Zhang (qzhang) wrote :

> Thanks, all seems ok except the "6. add boot_linaro_image action if not in
> test image" one.
> I guess we execute "client.in_test_shell()" at a assumption that already
> boot_linaro_image,
> if we do this in the test action, do we need to check "in_test_shell" again?
I'd like to make sure again, assuming if some test cases run ordinally, one test case may make system no response, before the next case, it's better to make sure the system still alive, or do the action to boot to test image.

>
> And for test action of android, I think it should be
> client.boot_linaro_android_image.
Good catch, fixed, thanks.

review: Needs Resubmitting
Revision history for this message
Spring Zhang (qzhang) wrote :

I have finished the test in normal image, Yongqin, if you are available it's better to have a try on Android image.

Revision history for this message
Yongqin Liu (liuyq0307) wrote :

I think it's better do this after the merge https://code.launchpad.net/~mwhudson/lava-dispatcher/eliminate-old-android-tests/+merge/80522. mwhudson submitted. because that merge will delete some files we modified here. after that we only need to review and commit the useful files.

158. By Spring Zhang

merge with mainline

Revision history for this message
Spring Zhang (qzhang) wrote :

tested with mainline merged and pass

review: Needs Resubmitting
Revision history for this message
Yongqin Liu (liuyq0307) wrote :

looks ok except the problem on page http://pastebin.ubuntu.com/720486/.
after that fixing, the test with android can run and submit result.

But not test the timeout things.

review: Needs Fixing
159. By Spring Zhang

fix grammar error

160. By Spring Zhang

Merge Yongqin's fix to Android part

Revision history for this message
Spring Zhang (qzhang) wrote :

Thanks for the android test

Revision history for this message
Yongqin Liu (liuyq0307) wrote :

forgot to change to approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lava_dispatcher/__init__.py'
2--- lava_dispatcher/__init__.py 2011-10-27 02:32:02 +0000
3+++ lava_dispatcher/__init__.py 2011-10-27 09:14:23 +0000
4@@ -25,6 +25,7 @@
5 from uuid import uuid1
6 import base64
7 import pexpect
8+import logging
9
10 from lava_dispatcher.actions import get_all_cmds
11 from lava_dispatcher.config import get_config, get_device_config
12@@ -87,6 +88,7 @@
13 status = 'pass'
14 finally:
15 err_msg = ""
16+ logging.info("Action %s finished." % cmd['command'])
17 if status == 'fail':
18 err_msg = "Lava failed at action %s with error: %s\n" %\
19 (cmd['command'], err)
20
21=== modified file 'lava_dispatcher/actions/android_deploy.py'
22--- lava_dispatcher/actions/android_deploy.py 2011-10-20 18:24:55 +0000
23+++ lava_dispatcher/actions/android_deploy.py 2011-10-27 09:14:23 +0000
24@@ -38,7 +38,7 @@
25 logging.info(" boot: %s" % boot)
26 logging.info(" system: %s" % system)
27 logging.info(" data: %s" % data)
28- logging.info("Booting master image")
29+ logging.info("Boot master image")
30 client.boot_master_image()
31
32 logging.info("Waiting for network to come up...")
33
34=== modified file 'lava_dispatcher/actions/boot_control.py'
35--- lava_dispatcher/actions/boot_control.py 2011-10-26 02:59:28 +0000
36+++ lava_dispatcher/actions/boot_control.py 2011-10-27 09:14:23 +0000
37@@ -34,8 +34,8 @@
38 client.proc.sendline("")
39 try:
40 client.boot_linaro_android_image()
41- except:
42- logging.exception("boot_linaro_android_image failed")
43+ except Exception as e:
44+ logging.exception("boot_linaro_android_image failed: %s" % e)
45 raise CriticalError("Failed to boot test image.")
46
47 class cmd_boot_linaro_image(BaseAction):
48@@ -61,5 +61,5 @@
49 """
50 def run(self):
51 client = self.client
52- logging.info("Boot Master image")
53+ logging.info("Boot master image")
54 client.boot_master_image()
55
56=== modified file 'lava_dispatcher/actions/lava-test.py'
57--- lava_dispatcher/actions/lava-test.py 2011-10-26 02:59:28 +0000
58+++ lava_dispatcher/actions/lava-test.py 2011-10-27 09:14:23 +0000
59@@ -91,7 +91,10 @@
60 logging.info("Executing lava_test_run %s command" % test_name)
61 #Make sure in test image now
62 client = self.client
63- client.in_test_shell()
64+ try:
65+ client.in_test_shell()
66+ except:
67+ client.boot_linaro_image()
68 client.run_cmd_tester('mkdir -p %s' % self.context.lava_result_dir)
69 client.export_display()
70 bundle_name = test_name + "-" + datetime.now().strftime("%H%M%S")
71
72=== modified file 'lava_dispatcher/client.py'
73--- lava_dispatcher/client.py 2011-10-27 01:09:17 +0000
74+++ lava_dispatcher/client.py 2011-10-27 09:14:23 +0000
75@@ -99,15 +99,18 @@
76 timeout=timeout)
77 if id == 1:
78 raise OperationFailed
79+ logging.info("System is in master image now")
80
81- def in_test_shell(self):
82+ def in_test_shell(self, timeout=10):
83 """
84 Check that we are in a shell on the test image
85 """
86 self.proc.sendline("")
87- match_id = self.proc.expect([self.tester_str, pexpect.TIMEOUT])
88+ match_id = self.proc.expect([self.tester_str, pexpect.TIMEOUT],
89+ timeout=timeout)
90 if match_id == 1:
91 raise OperationFailed
92+ logging.info("System is in test image now")
93
94 def boot_master_image(self):
95 """
96@@ -122,20 +125,20 @@
97 self.proc.hard_reboot()
98 self.in_master_shell(300)
99 self.proc.sendline('export PS1="$PS1 [rc=$(echo \$?)]: "')
100- self.proc.expect(self.master_str)
101+ self.proc.expect(self.master_str, timeout=10)
102
103 def boot_linaro_image(self):
104 """
105 Reboot the system to the test image
106 """
107 self.proc._boot(self.boot_cmds)
108- self.in_test_shell()
109+ self.in_test_shell(300)
110 # set PS1 to include return value of last command
111 # Details: system PS1 is set in /etc/bash.bashrc and user PS1 is set in
112 # /root/.bashrc, it is
113 # "${debian_chroot:+($debian_chroot)}\u@\h:\w\$ "
114 self.proc.sendline('export PS1="$PS1 [rc=$(echo \$?)]: "')
115- self.proc.expect(self.tester_str)
116+ self.proc.expect(self.tester_str, timeout=10)
117
118 def run_shell_command(self, cmd, response=None, timeout=-1):
119 self.empty_pexpect_buffer()
120@@ -228,7 +231,7 @@
121
122 def boot_linaro_android_image(self):
123 """Reboot the system to the test android image."""
124- self._boot(string_to_list(self.config.get('boot_cmds_android')))
125+ self.proc._boot(string_to_list(self.config.get('boot_cmds_android')))
126 self.in_test_shell()
127 self.proc.sendline("export PS1=\"root@linaro: \"")
128
129
130=== modified file 'lava_dispatcher/connection.py'
131--- lava_dispatcher/connection.py 2011-10-26 03:24:05 +0000
132+++ lava_dispatcher/connection.py 2011-10-27 09:14:23 +0000
133@@ -66,6 +66,7 @@
134 def soft_reboot(self):
135 self.proc.sendline("reboot")
136 # set soft reboot timeout 120s, or do a hard reset
137+ logging.info("Rebooting the system")
138 id = self.proc.expect(
139 ['Will now restart', pexpect.TIMEOUT], timeout=120)
140 if id != 0:
141@@ -79,12 +80,13 @@
142
143 def _make_connection(self, sio):
144 cmd = "conmux-console %s" % self.device_option("hostname")
145- proc = pexpect.spawn(cmd, timeout=3600, logfile=sio)
146+ proc = pexpect.spawn(cmd, timeout=1200, logfile=sio)
147 #serial can be slow, races do funny things if you don't increase delay
148 proc.delaybeforesend=1
149 return proc
150
151 def hard_reboot(self):
152+ logging.info("Perform hard reset on the system")
153 self.proc.send("~$")
154 self.proc.sendline("hardreset")
155 # XXX Workaround for snowball

Subscribers

People subscribed via source and target branches