mirror of https://gitee.com/openkylin/qemu.git
tests/vm: write raw console log
Run "tail -f /var/tmp/*/qemu*console.raw" in another terminal to watch the install console. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200310083218.26355-2-kraxel@redhat.com> Message-Id: <20200323161514.23952-2-alex.bennee@linaro.org>
This commit is contained in:
parent
f4ce3adf6b
commit
698a64f948
|
@ -213,6 +213,9 @@ def boot(self, img, extra_args=[]):
|
|||
def console_init(self, timeout = 120):
|
||||
vm = self._guest
|
||||
vm.console_socket.settimeout(timeout)
|
||||
self.console_raw_path = os.path.join(vm._temp_dir,
|
||||
vm._name + "-console.raw")
|
||||
self.console_raw_file = open(self.console_raw_path, 'wb')
|
||||
|
||||
def console_log(self, text):
|
||||
for line in re.split("[\r\n]", text):
|
||||
|
@ -234,6 +237,9 @@ def console_wait(self, expect, expectalt = None):
|
|||
while True:
|
||||
try:
|
||||
chars = vm.console_socket.recv(1)
|
||||
if self.console_raw_file:
|
||||
self.console_raw_file.write(chars)
|
||||
self.console_raw_file.flush()
|
||||
except socket.timeout:
|
||||
sys.stderr.write("console: *** read timeout ***\n")
|
||||
sys.stderr.write("console: waiting for: '%s'\n" % expect)
|
||||
|
|
Loading…
Reference in New Issue