aboutsummaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
authorGravatar Andrey Smirnov <andrew.smirnov@gmail.com>2017-07-11 19:40:04 -0700
committerGravatar Thomas Petazzoni <thomas.petazzoni@free-electrons.com>2017-07-22 22:37:06 +0200
commit255b8ab406cf6ce114b4d2c2e2c0dba6e4402f38 (patch)
treec1b9a22a577fd5638ffbc33d3127efc73f913106 /support
parent5a8484dec291cedc3bbf239921f5dc8467b9e657 (diff)
downloadbuildroot-255b8ab406cf6ce114b4d2c2e2c0dba6e4402f38.tar.gz
buildroot-255b8ab406cf6ce114b4d2c2e2c0dba6e4402f38.tar.bz2
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: Andrey Smirnov <andrew.smirnov@gmail.com> Reviewed-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> Tested-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'support')
-rw-r--r--support/testing/infra/emulator.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/support/testing/infra/emulator.py b/support/testing/infra/emulator.py
index a39d59b881..9b079cbf23 100644
--- a/support/testing/infra/emulator.py
+++ b/support/testing/infra/emulator.py
@@ -89,11 +89,11 @@ class Emulator(object):
raise SystemError("Cannot login")
self.run("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.sendline(cmd)
- 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:]