[PATCH] testsuite/cibuilder: append stdout and stderr to log file

21 views
Skip to first unread message

srinuv...@siemens.com

unread,
Apr 4, 2025, 5:52:00 AM4/4/25
to isar-...@googlegroups.com, ub...@ilbers.de, srinuvasan
From: srinuvasan <srinuv...@siemens.com>

With these changes, users can see their output of running
commands or set of commands in the launched qemu system.

This would be really helpful to see the actual output
of remotely running programs.

Signed-off-by: srinuvasan <srinuv...@siemens.com>
---
testsuite/cibuilder.py | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
index e726ba87..c5ce7fc8 100755
--- a/testsuite/cibuilder.py
+++ b/testsuite/cibuilder.py
@@ -738,6 +738,12 @@ class CIBuilder(Test):
self.log.info(f"Connect command:\n{cmd_prefix}")

rc, stdout, stderr = self.remote_run(cmd, script, timeout)
+
+ stdout = stdout.decode('utf-8') if isinstance(stdout, bytes) else stdout
+ stderr = stderr.decode('utf-8') if isinstance(stderr, bytes) else stderr
+ self.log.info("stdout log:\n" + stdout)
+ self.log.info("stderr log:\n" + stderr)
+
if rc != 0:
if not keep:
self.vm_turn_off(vm)
--
2.39.5

Uladzimir Bely

unread,
Apr 8, 2025, 9:56:20 AM4/8/25
to srinuv...@siemens.com, isar-...@googlegroups.com
On Fri, 2025-04-04 at 15:22 +0530, srinuv...@siemens.com wrote:
> From: srinuvasan <srinuv...@siemens.com>
>
> With these changes, users can see their output of running
> commands or set of commands in the launched qemu system.
>
> This would be really helpful to see the actual output
> of remotely running programs.
>
> Signed-off-by: srinuvasan <srinuv...@siemens.com>
> ---
>  testsuite/cibuilder.py | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
> index e726ba87..c5ce7fc8 100755
> --- a/testsuite/cibuilder.py
> +++ b/testsuite/cibuilder.py
> @@ -738,6 +738,12 @@ class CIBuilder(Test):
>              self.log.info(f"Connect command:\n{cmd_prefix}")
>  
>              rc, stdout, stderr = self.remote_run(cmd, script,
> timeout)
> +
> +            stdout = stdout.decode('utf-8') if isinstance(stdout,
> bytes) else stdout
> +            stderr = stderr.decode('utf-8') if isinstance(stderr,
> bytes) else stderr

It would be better to use different variable to append to avocado log
since existing tests in downstream may expect data (stdout, stdeorr) of
original (bytes) type and use .decode() by their own.

> +            self.log.info("stdout log:\n" + stdout)
> +            self.log.info("stderr log:\n" + stderr)
> +
>              if rc != 0:
>                  if not keep:
>                      self.vm_turn_off(vm)

--
Best regards,
Uladzimir.


srinuv...@siemens.com

unread,
Apr 9, 2025, 2:09:37 AM4/9/25
to isar-...@googlegroups.com, ub...@ilbers.de, srinuvasan
From: srinuvasan <srinuv...@siemens.com>

With these changes, users can see their output of running
commands or set of commands in the launched qemu system.

This would be really helpful to see the actual output
of remotely running programs.

Signed-off-by: srinuvasan <srinuv...@siemens.com>
---
testsuite/cibuilder.py | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
index e726ba87..88bf9b8e 100755
--- a/testsuite/cibuilder.py
+++ b/testsuite/cibuilder.py
@@ -738,6 +738,12 @@ class CIBuilder(Test):
self.log.info(f"Connect command:\n{cmd_prefix}")

rc, stdout, stderr = self.remote_run(cmd, script, timeout)
+
+ standard_output = stdout.decode('utf-8') if isinstance(stdout, bytes) else stdout
+ standard_error = stderr.decode('utf-8') if isinstance(stderr, bytes) else stderr
+ self.log.info("standard output log:\n" + standard_output)
+ self.log.info("standard error log:\n" + standard_error)
+
if rc != 0:
if not keep:
self.vm_turn_off(vm)
--
2.34.1

Baurzhan Ismagulov

unread,
May 7, 2025, 9:45:34 AM5/7/25
to isar-...@googlegroups.com
On 2025-04-09 11:40, srinuvasan.a via isar-users wrote:
> From: srinuvasan <srinuv...@siemens.com>
>
> With these changes, users can see their output of running
> commands or set of commands in the launched qemu system.
>
> This would be really helpful to see the actual output
> of remotely running programs.
>
> Signed-off-by: srinuvasan <srinuv...@siemens.com>

Applied to next, thanks.

With kind regards,
Baurzhan
Reply all
Reply to author
Forward
0 new messages