1# 2# Copyright OpenEmbedded Contributors 3# 4# SPDX-License-Identifier: MIT 5# 6 7from oeqa.runtime.case import OERuntimeTestCase 8from oeqa.core.decorator.depends import OETestDepends 9from oeqa.runtime.decorator.package import OEHasPackage 10 11class SSHTest(OERuntimeTestCase): 12 13 @OETestDepends(['ping.PingTest.test_ping']) 14 @OEHasPackage(['dropbear', 'openssh-sshd']) 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) 19 (status, output) = self.target.run('uname -a') 20 self.assertEqual(status, 0, msg='SSH Test failed: %s' % output) 21 (status, output) = self.target.run('cat /etc/controllerimage') 22 msg = "This isn't the right image - /etc/controllerimage " \ 23 "shouldn't be here %s" % output 24 self.assertEqual(status, 1, msg=msg) 25