summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/lib/oeqa/runtime/systemd.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/meta/lib/oeqa/runtime/systemd.py b/meta/lib/oeqa/runtime/systemd.py
index edf4f39609..e4f433632f 100644
--- a/meta/lib/oeqa/runtime/systemd.py
+++ b/meta/lib/oeqa/runtime/systemd.py
@@ -22,3 +22,38 @@ class SystemdTests(oeRuntimeTest):
22 def test_systemd_failed(self): 22 def test_systemd_failed(self):
23 (status, output) = self.target.run('systemctl --failed | grep "0 loaded units listed"') 23 (status, output) = self.target.run('systemctl --failed | grep "0 loaded units listed"')
24 self.assertEqual(status, 0, msg="Failed systemd services: %s" % self.target.run('systemctl --failed')[1]) 24 self.assertEqual(status, 0, msg="Failed systemd services: %s" % self.target.run('systemctl --failed')[1])
25
26 @skipUnlessPassed('test_systemd_version')
27 def test_systemd_service(self):
28 (status, output) = self.target.run('systemctl list-unit-files | grep "systemd-hostnamed.service"')
29 self.assertEqual(status, 0, msg="systemd-hostnamed.service service is not available.")
30
31 @skipUnlessPassed('test_systemd_service')
32 def test_systemd_stop(self):
33 self.target.run('systemctl stop systemd-hostnamed.service')
34 (status, output) = self.target.run('systemctl show systemd-hostnamed.service | grep "ActiveState" | grep "=inactive"')
35 self.assertEqual(status, 0, msg="systemd-hostnamed.service service could not be stopped.Status and output: %s and %s" % (status, output))
36
37 @skipUnlessPassed('test_systemd_stop')
38 @skipUnlessPassed('test_systemd_version')
39 def test_systemd_start(self):
40 self.target.run('systemctl start systemd-hostnamed.service')
41 (status, output) = self.target.run('systemctl show systemd-hostnamed.service | grep "ActiveState" | grep "=active"')
42 self.assertEqual(status, 0, msg="systemd-hostnamed.service service could not be started. Status and output: %s and %s" % (status, output))
43
44 @skipUnlessPassed('test_systemd_version')
45 def test_systemd_enable(self):
46 self.target.run('systemctl enable machineid.service')
47 (status, output) = self.target.run('systemctl is-enabled machineid.service')
48 self.assertEqual(output, 'enabled', msg="machineid.service service could not be enabled. Status and output: %s and %s" % (status, output))
49
50 @skipUnlessPassed('test_systemd_enable')
51 def test_systemd_disable(self):
52 self.target.run('systemctl disable machineid.service')
53 (status, output) = self.target.run('systemctl is-enabled machineid.service')
54 self.assertEqual(output, 'disabled', msg="machineid.service service could not be disabled. Status and output: %s and %s" % (status, output))
55
56 @skipUnlessPassed('test_systemd_version')
57 def test_systemd_list(self):
58 (status, output) = self.target.run('systemctl list-unit-files')
59 self.assertEqual(status, 0, msg="systemctl list-unit-files command failed. Status: %s" % status)