Commit 255b8ab4 authored by Andrey Smirnov's avatar Andrey Smirnov Committed by Thomas Petazzoni
Browse files

testing/infra/emulator: allow to specify pexpect timeout

Some commands take more than 5 seconds to complete under QEMU, so add
provisions to allow individual unit-test to specify different duration
to avoid false negative test failures.
Signed-off-by: default avatarAndrey Smirnov <>
Reviewed-by: default avatarRicardo Martincoski <>
Tested-by: default avatarRicardo Martincoski <>
Signed-off-by: default avatarThomas Petazzoni <>
parent 5a8484de
......@@ -89,11 +89,11 @@ class Emulator(object):
raise SystemError("Cannot login")"dmesg -n 1")
# Run the given 'cmd' on the target
# Run the given 'cmd' with a 'timeout' on the target
# return a tuple (output, exit_code)
def run(self, cmd):
def run(self, cmd, timeout=-1):
self.qemu.expect("# ")
self.qemu.expect("# ", timeout=timeout)
# Remove double carriage return from qemu stdout so str.splitlines()
# works as expected.
output = self.qemu.before.replace("\r\r", "\r").splitlines()[1:]
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment