connman.py 1.1 KB

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