diff mbox series

[v1,01/11] tests/vm: write raw console log

Message ID 20200323161514.23952-2-alex.bennee@linaro.org
State Superseded
Headers show
Series testing/next | expand

Commit Message

Alex Bennée March 23, 2020, 4:15 p.m. UTC
From: Gerd Hoffmann <kraxel@redhat.com>


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>

Message-Id: <20200310083218.26355-2-kraxel@redhat.com>
---
 tests/vm/basevm.py | 6 ++++++
 1 file changed, 6 insertions(+)

-- 
2.20.1

Comments

Philippe Mathieu-Daudé March 24, 2020, 12:44 p.m. UTC | #1
On 3/23/20 5:15 PM, Alex Bennée wrote:
> From: Gerd Hoffmann <kraxel@redhat.com>

> 

> 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>

> Message-Id: <20200310083218.26355-2-kraxel@redhat.com>

> ---

>   tests/vm/basevm.py | 6 ++++++

>   1 file changed, 6 insertions(+)

> 

> diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py

> index 8400b0e07f6..c53fd354d95 100644

> --- a/tests/vm/basevm.py

> +++ b/tests/vm/basevm.py

> @@ -213,6 +213,9 @@ class BaseVM(object):

>       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 @@ class BaseVM(object):

>           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)

> 


Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
diff mbox series

Patch

diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 8400b0e07f6..c53fd354d95 100644
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -213,6 +213,9 @@  class BaseVM(object):
     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 @@  class BaseVM(object):
         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)