From accf0362f964cc9d6330b6e52e83d748d890521f Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Fri, 24 Mar 2017 22:46:16 +0100 Subject: qemurunner: configurable timeout for run_serial() Some commands might need to run longer than the default timeout of five seconds. If that occurred, run_serial() returned with a status code of zero (sic!) and no other indication of what went wrong. Now the timeout is configurable (with five still the default) and an explicit warning ("<<< run_serial(): command timed out after 5 seconds without output >>>") gets appended at the end of the data returned to the caller. While at it, the logic for checking for the timeout was updated a bit because both implementations could overshoot the timeout when entering select() right before the final deadline. Signed-off-by: Patrick Ohly Signed-off-by: Richard Purdie --- meta/lib/oeqa/utils/qemutinyrunner.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'meta/lib/oeqa/utils/qemutinyrunner.py') diff --git a/meta/lib/oeqa/utils/qemutinyrunner.py b/meta/lib/oeqa/utils/qemutinyrunner.py index ec52473834..b1009a0a37 100644 --- a/meta/lib/oeqa/utils/qemutinyrunner.py +++ b/meta/lib/oeqa/utils/qemutinyrunner.py @@ -107,14 +107,14 @@ class QemuTinyRunner(QemuRunner): return self.is_alive() - def run_serial(self, command): + def run_serial(self, command, timeout=5): self.server_socket.sendall(command+'\n') data = '' status = 0 stopread = False - endtime = time.time()+5 + endtime = time.time()+timeout while time.time()