connman.py 1.1 KB

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