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 ConnmanTest(OERuntimeTestCase): 12 13 def service_status(self, service): 14 if 'systemd' in self.tc.td['DISTRO_FEATURES']: 15 (_, output) = self.target.run('systemctl status -l %s' % service) 16 return output 17 else: 18 return "Unable to get status or logs for %s" % service 19 20 @OETestDepends(['ssh.SSHTest.test_ssh']) 21 @OEHasPackage(["connman"]) 22 def test_connmand_help(self): 23 (status, output) = self.target.run('/usr/sbin/connmand --help') 24 msg = 'Failed to get connman help. Output: %s' % output 25 self.assertEqual(status, 0, msg=msg) 26 27 @OETestDepends(['connman.ConnmanTest.test_connmand_help']) 28 def test_connmand_running(self): 29 cmd = '%s | grep [c]onnmand' % self.tc.target_cmds['ps'] 30 (status, output) = self.target.run(cmd) 31 if status != 0: 32 self.logger.info(self.service_status("connman")) 33 self.fail("No connmand process running") 34