Skip to contentSkip to conversation

zephyrtargetcontrol: fix unexpected ignore_ssh_fails

PATCH New [email protected] 1 participant 1 message Oct 28

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 zephyrtargetcontrol: fix unexpected ignore_ssh_fails

From: Lee Chee Yang <[email protected]>

fix unexpected keyword argument for QemuTargetZephyr

File: '/data/blacksail/openembedded-core/meta/lib/oeqa/utils/postactions.py', lineno: 88, function: run_coredumpctl_info

     0084:    # message ID for coredumps, so it shows all of the coredumps that are in the
     0085:    # journal.
     0086:    output_file = d.expand("${localstatedir}/log/coredumps.txt")
     0087:    cmd = f"coredumpctl info MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1 | tee {output_file}"
 *** 0088:    tc.target.run(cmd, ignore_ssh_fails=True)
     0089:
     0090:
     0091:##################################################################
     0092:# General post actions runner

Exception: TypeError: OETarget.run() got an unexpected keyword argument 'ignore_ssh_fails'

---
 .../lib/oeqa/controllers/zephyrtargetcontrol.py | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
meta-zephyr-core/lib/oeqa/controllers/zephyrtargetcontrol.py +16 -1
index e9bc6bb..a557a5c 100644
@@ -15,7 +15,8 @@ class QemuTargetZephyr(OETarget):
             machine='', rootfs='', tmpdir ='',dir_image ='',display=None,
             kernel='',boottime=60,bootlog='',kvm=False,slirp=False,
             dump_dir='',serial_ports=0,ovmf=None,tmpfsdir='' ,target_modules_path='',powercontrol_cmd='',powercontrol_extra_args='',
-            serialcontrol_cmd=None,serialcontrol_extra_args='',testimage_dump_target='',testimage_dump_monitor='',native_sysroot=None):
+            serialcontrol_cmd=None,serialcontrol_extra_args='',testimage_dump_target='',testimage_dump_monitor='',native_sysroot=None,
+            ignore_ssh_fails=True):
 
         timeout =  300
         user = 'root'
@@ -60,3 +61,17 @@ class QemuTargetZephyr(OETarget):
 
     def serial_readline(self):
         return self.runner.serial_readline()
+
+    def run(self, cmd, timeout=None, ignore_status=True, raw=False, ignore_ssh_fails=False):
+        """
+        QemuTargetZephyr has no SSH (or other remote shell) support, only
+        a serial console. Treat every call as an SSH failure (status 255),
+        matching OESSHTarget's convention, so that callers written for
+        SSH-capable targets (e.g. testimage's post-failure actions) degrade
+        gracefully instead of raising a TypeError.
+        """
+        status, output = 255, "QemuTargetZephyr has no SSH support; only serial console access is available"
+        if not ignore_ssh_fails:
+            raise AssertionError(output)
+        return (status, output)
+
Signature · 1 line
2.43.0