diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-07-04 11:10:38 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-07-04 22:56:15 +0100 |
commit | a7d13a3cface5322e7ff3ba9bf27ca8def1e3a4d (patch) | |
tree | 2da49730a05a352112b89a6fcc6a3256091103d8 | |
parent | 2e9e8f6fb3415f9aac6b5f96e8e7c8d9ced5beb5 (diff) | |
download | poky-a7d13a3cface5322e7ff3ba9bf27ca8def1e3a4d.tar.gz |
oeqa/runtime/ssh: In case of failure, show exit code and handle -15 (SIGTERM)
Ensure we show the failing exit code in case of failures.
We're seeing autobuilder failures with -15 (SIGTERM) which is probably from
slow boot/init. Retry in these cases for now.
(From OE-Core rev: 127d3bd8d5509ae17e359c1365859fd362ffc74f)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/lib/oeqa/runtime/cases/ssh.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/meta/lib/oeqa/runtime/cases/ssh.py b/meta/lib/oeqa/runtime/cases/ssh.py index ae92bb34cd..9a8deb3f25 100644 --- a/meta/lib/oeqa/runtime/cases/ssh.py +++ b/meta/lib/oeqa/runtime/cases/ssh.py | |||
@@ -5,6 +5,7 @@ | |||
5 | # | 5 | # |
6 | 6 | ||
7 | import time | 7 | import time |
8 | import signal | ||
8 | 9 | ||
9 | from oeqa.runtime.case import OERuntimeTestCase | 10 | from oeqa.runtime.case import OERuntimeTestCase |
10 | from oeqa.core.decorator.depends import OETestDepends | 11 | from oeqa.core.decorator.depends import OETestDepends |
@@ -19,16 +20,18 @@ class SSHTest(OERuntimeTestCase): | |||
19 | status, output = self.target.run("uname -a", timeout=5) | 20 | status, output = self.target.run("uname -a", timeout=5) |
20 | if status == 0: | 21 | if status == 0: |
21 | break | 22 | break |
22 | elif status == 255: | 23 | elif status == 255 or status == -signal.SIGTERM: |
23 | # ssh returns 255 only if a ssh error occurs. This could | 24 | # ssh returns 255 only if a ssh error occurs. This could |
24 | # be an issue with "Connection refused" because the port | 25 | # be an issue with "Connection refused" because the port |
25 | # isn't open yet, and this could check explicitly for that | 26 | # isn't open yet, and this could check explicitly for that |
26 | # here. However, let's keep it simple and just retry for | 27 | # here. However, let's keep it simple and just retry for |
27 | # all errors a limited amount of times with a sleep to | 28 | # all errors a limited amount of times with a sleep to |
28 | # give it time for the port to open. | 29 | # give it time for the port to open. |
30 | # We sometimes see -15 (SIGTERM) on slow emulation machines too, likely | ||
31 | # from boot/init not being 100% complete, retry for these too. | ||
29 | time.sleep(5) | 32 | time.sleep(5) |
30 | continue | 33 | continue |
31 | else: | 34 | else: |
32 | self.fail("uname failed with \"%s\"" %output) | 35 | self.fail("uname failed with \"%s\" (exit code %s)" % (output, status)) |
33 | if status == 255: | 36 | if status == 255: |
34 | self.fail("ssh error %s" %output) | 37 | self.fail("ssh error %s" %output) |