summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa
diff options
context:
space:
mode:
authorAlexandru Palalau <alexandrux.palalau@intel.com>2013-08-09 10:59:12 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-08-13 23:06:00 +0100
commitdbee00c9e9f8381bbab02cab42ef6f94318d347e (patch)
tree6c388c42ce0eb01528d2d5c6be3ba389ef6144ea /meta/lib/oeqa
parent1990a6c507240fff0c8a65e28b065096bf4031e5 (diff)
downloadpoky-dbee00c9e9f8381bbab02cab42ef6f94318d347e.tar.gz
lib/oeqa/runtime: add new systemd tests
New systemd runtime tests for enable/disable service, start/stop service and list services. (From OE-Core rev: 6386dc718f85210c9b6b9f69878ec9a7847b78de) Signed-off-by: Alexandru Palalau <alexandrux.palalau@intel.com> Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
-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)