summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/runtime
diff options
context:
space:
mode:
authorluca fancellu <luca.fancellu@arm.com>2023-11-09 14:36:31 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-11-10 17:44:27 +0000
commit0f25c8aa775001166a03b8b215b7b9ab80ef4f9e (patch)
treee3b91a958717a05115bd4c5b811202615abcdfeb /meta/lib/oeqa/runtime
parent2f08d6b84054cd07def60fc7344008005c2743d1 (diff)
downloadpoky-0f25c8aa775001166a03b8b215b7b9ab80ef4f9e.tar.gz
oeqa/ssh: Handle SSHCall timeout error code
The current code in ssh.py is terminating the ssh process that does not finish its computation in a given timeout (when timeout is passed), the SSHCall function is returning the process error code. The Openssl ssh before version 8.6_p1 is returning 0 when it is terminated, from commit 8a9520836e71830f4fccca066dba73fea3d16bda onwards (version >= 8.6_p1) ssh is returning 255 instead. So for version of ssh older than 8.6_p1 when the SSHCall time out, the return code will be 0, meaning success, which is wrong. Fix this issue checking if the process has timeout (hence it's been terminated) and checking if the returned code is 0, in that case set it to 255 to advertise that an error occurred. Add a test case excercising the timeout in the SSHTest, test_ssh test function. (From OE-Core rev: 948fecca1db4c7a30fcca5fcf5eef95cd12efb00) Signed-off-by: Luca Fancellu <luca.fancellu@arm.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/runtime')
-rw-r--r--meta/lib/oeqa/runtime/cases/ssh.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/meta/lib/oeqa/runtime/cases/ssh.py b/meta/lib/oeqa/runtime/cases/ssh.py
index 13aac54396..cdbef59500 100644
--- a/meta/lib/oeqa/runtime/cases/ssh.py
+++ b/meta/lib/oeqa/runtime/cases/ssh.py
@@ -13,6 +13,9 @@ class SSHTest(OERuntimeTestCase):
13 @OETestDepends(['ping.PingTest.test_ping']) 13 @OETestDepends(['ping.PingTest.test_ping'])
14 @OEHasPackage(['dropbear', 'openssh-sshd']) 14 @OEHasPackage(['dropbear', 'openssh-sshd'])
15 def test_ssh(self): 15 def test_ssh(self):
16 (status, output) = self.target.run('sleep 20', timeout=2)
17 msg='run() timed out but return code was zero.'
18 self.assertNotEqual(status, 0, msg=msg)
16 (status, output) = self.target.run('uname -a') 19 (status, output) = self.target.run('uname -a')
17 self.assertEqual(status, 0, msg='SSH Test failed: %s' % output) 20 self.assertEqual(status, 0, msg='SSH Test failed: %s' % output)
18 (status, output) = self.target.run('cat /etc/controllerimage') 21 (status, output) = self.target.run('cat /etc/controllerimage')