hc
2023-11-07 f45e756958099c35d6afb746df1d40a1c6302cfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#
# SPDX-License-Identifier: MIT
#
 
from oeqa.runtime.case import OERuntimeTestCase
from oeqa.core.decorator.depends import OETestDepends
from oeqa.runtime.decorator.package import OEHasPackage
 
class ConnmanTest(OERuntimeTestCase):
 
    def service_status(self, service):
        if 'systemd' in self.tc.td['DISTRO_FEATURES']:
            (_, output) = self.target.run('systemctl status -l %s' % service)
            return output
        else:
            return "Unable to get status or logs for %s" % service
 
    @OETestDepends(['ssh.SSHTest.test_ssh'])
    @OEHasPackage(["connman"])
    def test_connmand_help(self):
        (status, output) = self.target.run('/usr/sbin/connmand --help')
        msg = 'Failed to get connman help. Output: %s' % output
        self.assertEqual(status, 0, msg=msg)
 
    @OETestDepends(['connman.ConnmanTest.test_connmand_help'])
    def test_connmand_running(self):
        cmd = '%s | grep [c]onnmand' % self.tc.target_cmds['ps']
        (status, output) = self.target.run(cmd)
        if status != 0:
            self.logger.info(self.service_status("connman"))
            self.fail("No connmand process running")