Patchwork lib/oeqa/runtime: systemd failure case improvements

login
register
mail settings
Submitter Ross Burton
Date Dec. 12, 2013, 10:06 a.m.
Message ID <1386842769-1350-1-git-send-email-ross.burton@intel.com>
Download mbox | patch
Permalink /patch/63259/
State Accepted
Commit 599eed2f3b363eb8e89b29da00921e02902242c1
Headers show

Comments

Ross Burton - Dec. 12, 2013, 10:06 a.m.
If the hostnamed service can't be started or stopped, show the output from
systemctl status to assist debugging.

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 meta/lib/oeqa/runtime/systemd.py |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Patch

diff --git a/meta/lib/oeqa/runtime/systemd.py b/meta/lib/oeqa/runtime/systemd.py
index 17cc19f..31007df 100644
--- a/meta/lib/oeqa/runtime/systemd.py
+++ b/meta/lib/oeqa/runtime/systemd.py
@@ -34,14 +34,18 @@  class SystemdTests(oeRuntimeTest):
     def test_systemd_stop(self):
         self.target.run('systemctl stop systemd-hostnamed.service')
         (status, output) = self.target.run('systemctl show systemd-hostnamed.service | grep "ActiveState" | grep "=inactive"')
-        self.assertEqual(status, 0, msg="systemd-hostnamed.service service could not be stopped.Status and output: %s and %s" % (status, output))
+        if status != 0:
+            (status, output) = self.target.run('systemctl status -l systemd-hostnamed.service')
+            self.fail(msg="systemd-hostnamed.service service could not be stopped. Status:\n" + output)
 
     @skipUnlessPassed('test_systemd_stop')
     @skipUnlessPassed('test_systemd_version')
     def test_systemd_start(self):
         self.target.run('systemctl start systemd-hostnamed.service')
-        (status, output) = self.target.run('systemctl show systemd-hostnamed.service | grep "ActiveState" | grep "=active"')
-        self.assertEqual(status, 0, msg="systemd-hostnamed.service service could not be started. Status and output: %s and %s" % (status, output))
+        (status, output) = self.target.run('systemctl is-active systemd-hostnamed.service')
+        if status != 0:
+            (status, output) = self.target.run('systemctl status -l systemd-hostnamed.service')
+            self.fail(msg="systemd-hostnamed.service service could not be started. Status:\n" + output)
 
     @skipUnlessPassed('test_systemd_version')
     def test_systemd_enable(self):