=== modified file 'lava_dispatcher/actions/lava-test.py'
@@ -71,7 +71,7 @@
try:
client.run_shell_command(
'chroot /mnt/root lava-test help',
- response="list-test", timeout=10)
+ response="list-test", timeout=60)
except:
tb = traceback.format_exc()
client.sio.write(tb)
=== modified file 'lava_dispatcher/client.py'
@@ -103,7 +103,7 @@
self.in_master_shell()
except:
raise
- self.proc.sendline('export PS1="rc=$(echo \$?) $PS1"')
+ self.proc.sendline('export PS1="$PS1 [rc=$(echo \$?)]: "')
self.proc.expect(self.master_str)
def boot_linaro_image(self):
@@ -130,7 +130,7 @@
# Details: system PS1 is set in /etc/bash.bashrc and user PS1 is set in
# /root/.bashrc, it is
# "${debian_chroot:+($debian_chroot)}\u@\h:\w\$ "
- self.proc.sendline('export PS1="rc=$(echo \$?) $PS1"')
+ self.proc.sendline('export PS1="$PS1 rc=$(echo \$?) "')
self.proc.expect(self.tester_str)
def enter_uboot(self):
@@ -153,6 +153,16 @@
self.empty_pexpect_buffer()
# return return-code if captured, else return None
self.proc.sendline(cmd)
+ start_time = time.time()
+ if response:
+ self.proc.expect(response, timeout=timeout)
+ elapsed_time = int(time.time()-start_time)
+ # if reponse is master/tester string, make rc expect timeout to be
+ # 2 sec, else make it consume remained timeout
+ if response in [self.master_str, self.tester_str]:
+ timeout = 2
+ else:
+ timeout = int(timeout-elapsed_time)
#verify return value of last command, match one number at least
#PS1 setting is in boot_linaro_image or boot_master_image
pattern1 = "rc=(\d+\d?\d?)"
@@ -162,8 +172,6 @@
rc = int(self.proc.match.groups()[0])
else:
rc = None
- if response:
- self.proc.expect(response, timeout=2)
return rc
def run_cmd_master(self, cmd, timeout=-1):