[Buildroot] [PATCH v2 1/6] testing/infra/emulator: allow to specify pexpect timeout
Andrey Smirnov
andrew.smirnov at gmail.com
Wed Jul 12 02:40:04 UTC 2017
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 at gmail.com>
---
support/testing/infra/emulator.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/support/testing/infra/emulator.py b/support/testing/infra/emulator.py
index a39d59b..9b079cb 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:]
--
2.9.4
More information about the buildroot
mailing list