summaryrefslogtreecommitdiffstats
path: root/support/testing/infra/emulator.py
diff options
context:
space:
mode:
authorRicardo Martincoski <ricardo.martincoski@gmail.com>2017-06-28 23:45:43 -0300
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2017-07-01 16:05:14 +0200
commite664c5f71c9614b991b13225809772eaea4a3dc5 (patch)
treeecdb5a638ef4a538fbba69e084bedf3b988ae727 /support/testing/infra/emulator.py
parent8ebc2278067eb99a25ce3098867f1f613ab50c7f (diff)
downloadbuildroot-e664c5f71c9614b991b13225809772eaea4a3dc5.tar.gz
buildroot-e664c5f71c9614b991b13225809772eaea4a3dc5.zip
support/testing: let pexpect write stdout to log
When the parameter logfile is passed to spawn(), pexpect sends both stdin and stdout to the logfile and it creates a double echo effect. One way to avoid the double echo in the logfile would be to disable the echo on the terminal just after login ("stty -echo"), but double echo of user and password would remain. Instead of that, send only the stdout to the logfile using the logfile_read property. Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'support/testing/infra/emulator.py')
-rw-r--r--support/testing/infra/emulator.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/support/testing/infra/emulator.py b/support/testing/infra/emulator.py
index aa1e9e5b2c..55110db401 100644
--- a/support/testing/infra/emulator.py
+++ b/support/testing/infra/emulator.py
@@ -67,6 +67,8 @@ class Emulator(object):
self.logfile.write("> starting qemu with '%s'\n" % " ".join(qemu_cmd))
self.qemu = pexpect.spawn(qemu_cmd[0], qemu_cmd[1:])
+ # We want only stdout into the log to avoid double echo
+ self.qemu.logfile_read = self.logfile
def __read_until(self, waitstr, timeout=5):
index = self.qemu.expect([waitstr, pexpect.TIMEOUT], timeout=timeout)
@@ -74,7 +76,6 @@ class Emulator(object):
if index == 0:
data += self.qemu.after
self.log += data
- self.logfile.write(data)
# Remove double carriage return from qemu stdout so str.splitlines()
# works as expected.
return data.replace("\r\r", "\r")
OpenPOWER on IntegriCloud