From 55f1f00d25d465e687665c7687b2edbc38c3f357 Mon Sep 17 00:00:00 2001 From: Mathieu Dubois-Briand Date: Tue, 7 Oct 2025 19:38:07 +0200 Subject: [PATCH] oeqa: runtime: Ignore SSH errors during setup and tear down Tests using SSH will fail when no SSH server is present on the target. These tests are disabled in these cases, by being marked with a dependency on ssh.SSHTest.test_ssh, which in turns has a dependency on having either dropbear or openssh-sshd in the image. But setUpClass() and tearDownClass() functions are always executed, even on tests failing the dependency checks, leading to unexpected failed tests. Ignoring SSH errors in setup and tear down allows to avoid these test errors. (From OE-Core rev: 5bcc914cf5a193137cddc004f3b38b7b04af9ecb) Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Richard Purdie --- meta/lib/oeqa/runtime/cases/logrotate.py | 7 ++++--- meta/lib/oeqa/runtime/cases/weston.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/meta/lib/oeqa/runtime/cases/logrotate.py b/meta/lib/oeqa/runtime/cases/logrotate.py index 6ad980cb6a..7cb43d98c5 100644 --- a/meta/lib/oeqa/runtime/cases/logrotate.py +++ b/meta/lib/oeqa/runtime/cases/logrotate.py @@ -15,12 +15,13 @@ class LogrotateTest(OERuntimeTestCase): @classmethod def setUpClass(cls): - cls.tc.target.run('cp /etc/logrotate.d/wtmp $HOME/wtmp.oeqabak') + cls.tc.target.run('cp /etc/logrotate.d/wtmp $HOME/wtmp.oeqabak', + ignore_ssh_fails=True) @classmethod def tearDownClass(cls): - cls.tc.target.run('mv -f $HOME/wtmp.oeqabak /etc/logrotate.d/wtmp && rm -rf /var/log//logrotate_dir') - cls.tc.target.run('rm -rf /var/log/logrotate_testfile && rm -rf /etc/logrotate.d/logrotate_testfile') + cls.tc.target.run('mv -f $HOME/wtmp.oeqabak /etc/logrotate.d/wtmp && rm -rf /var/log//logrotate_dir', ignore_ssh_fails=True) + cls.tc.target.run('rm -rf /var/log/logrotate_testfile && rm -rf /etc/logrotate.d/logrotate_testfile', ignore_ssh_fails=True) @OETestDepends(['ssh.SSHTest.test_ssh']) @OEHasPackage(['logrotate']) diff --git a/meta/lib/oeqa/runtime/cases/weston.py b/meta/lib/oeqa/runtime/cases/weston.py index ee4d336482..e2cecffe83 100644 --- a/meta/lib/oeqa/runtime/cases/weston.py +++ b/meta/lib/oeqa/runtime/cases/weston.py @@ -16,7 +16,7 @@ class WestonTest(OERuntimeTestCase): @classmethod def tearDownClass(cls): - cls.tc.target.run('rm %s' % cls.weston_log_file) + cls.tc.target.run('rm %s' % cls.weston_log_file, ignore_ssh_fails=True) @OETestDepends(['ssh.SSHTest.test_ssh']) @OEHasPackage(['weston'])