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

Message ID 20250409061017.2639760-1-srinuvasan.a@siemens.com
State New
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(+)

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)