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

Message ID 20250409061017.2639760-1-srinuvasan.a@siemens.com
State Accepted, archived
Headers show
Series [v2] testsuite/cibuilder: append stdout and stderr to log file | expand

Commit Message

srinuvasan.a April 9, 2025, 6:10 a.m. UTC
From: srinuvasan <srinuvasan.a@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 <srinuvasan.a@siemens.com>
---
 testsuite/cibuilder.py | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Baurzhan Ismagulov May 7, 2025, 1:45 p.m. UTC | #1
On 2025-04-09 11:40, srinuvasan.a via isar-users wrote:
> From: srinuvasan <srinuvasan.a@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 <srinuvasan.a@siemens.com>

Applied to next, thanks.

With kind regards,
Baurzhan

Patch

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)