Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 1 | # |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 2 | # Copyright OpenEmbedded Contributors |
| 3 | # |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 4 | # SPDX-License-Identifier: MIT |
| 5 | # |
| 6 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 7 | from oeqa.runtime.case import OERuntimeTestCase |
| 8 | from oeqa.core.decorator.depends import OETestDepends |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 9 | from oeqa.runtime.decorator.package import OEHasPackage |
| 10 | |
| 11 | class 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 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 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 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 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") |