summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2019-06-26 10:59:37 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-06-27 12:20:36 +0100
commitabfe4b3d5cd8d05c8ab99240e30ac281725fac14 (patch)
treeece59dc5b7159d0104454dee0f23d9c9c9889d31 /meta/lib
parent91144160e1770d07994670b8b97274d1f96ed05f (diff)
downloadopenembedded-core-contrib-abfe4b3d5cd8d05c8ab99240e30ac281725fac14.tar.gz
oeqa/runtime/syslog: Improve test debug messages
Its useful to test whether the restart command returned an error code and exit early from the test if so. Also add different messages to tell if the syslog processes didn't die or didn't restart. (From OE-Core rev: f19e95b8571a0d8213c4dec0da056e3d243fbbd1) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/runtime/cases/oe_syslog.py32
1 files changed, 20 insertions, 12 deletions
diff --git a/meta/lib/oeqa/runtime/cases/oe_syslog.py b/meta/lib/oeqa/runtime/cases/oe_syslog.py
index 0f79e5a0f3..f987dccfb1 100644
--- a/meta/lib/oeqa/runtime/cases/oe_syslog.py
+++ b/meta/lib/oeqa/runtime/cases/oe_syslog.py
@@ -43,31 +43,38 @@ class SyslogTestConfig(OERuntimeTestCase):
def restart_sanity(self, names, restart_cmd):
status, original_pids = self.verify_running(names)
if status:
- return 1
+ return False
status, output = self.target.run(restart_cmd)
+ msg = ('Could not restart %s service. Status and output: %s and %s' % (names, status, output))
+ self.assertEqual(status, 0, msg)
+
# Always check for an error, most likely a race between shutting down and starting up
timeout = time.time() + 30
+ restarted = False
+ status = ""
while time.time() < timeout:
# Verify the previous ones are no longer running
status = self.verif_not_running(original_pids)
if status:
+ status = "Original syslog processes still running"
continue
status, pids = self.verify_running(names)
if status:
+ status = "New syslog processes not running"
continue
# Everything is fine now, so exit to continue the test
- status = 0
+ restarted = True
break
- msg = ('Could not restart %s service. Status and output: %s and %s'
- %(names, status, output))
- self.assertEqual(status, 0, msg)
+ msg = ('%s didn\'t appear to restart: %s' % (names, status))
+ self.assertTrue(restarted, msg)
+ return True
@OETestDepends(['oe_syslog.SyslogTest.test_syslog_running'])
def test_syslog_logger(self):
@@ -88,13 +95,14 @@ class SyslogTestConfig(OERuntimeTestCase):
@OETestDepends(['oe_syslog.SyslogTest.test_syslog_running'])
def test_syslog_restart(self):
- status = self.restart_sanity(['systemd-journald'], 'systemctl restart syslog.service')
- if status:
- status = self.restart_sanity(['rsyslogd'], '/etc/init.d/rsyslog restart')
- if status:
- status = self.restart_sanity(['syslogd', 'klogd'], '/etc/init.d/syslog restart')
- else:
- self.logger.info("No syslog found to restart, ignoring")
+ if self.restart_sanity(['systemd-journald'], 'systemctl restart syslog.service'):
+ pass
+ elif self.restart_sanity(['rsyslogd'], '/etc/init.d/rsyslog restart'):
+ pass
+ elif self.restart_sanity(['syslogd', 'klogd'], '/etc/init.d/syslog restart'):
+ pass
+ else:
+ self.logger.info("No syslog found to restart, ignoring")
@OETestDepends(['oe_syslog.SyslogTestConfig.test_syslog_logger'])