[OE-core] [PATCH 1/1] oe_syslog.py: fix for syslog-ng

Chen Qi Qi.Chen at windriver.com
Fri Aug 3 08:27:05 UTC 2018


When using syslog-ng as the syslog provider, oe_syslog test case fails
because it cannot find the syslog daemon. This is because it greps for
'syslogd' but syslog-ng's daemon is 'syslog-ng'. So fix the grep command
to also consider syslog-ng.

Also, when the test case fails, what I get is:
| AssertionError: 1 != 0 : No syslogd process; ps output:
<empty here>

This does not help user. The output is actually from the 'PS | GREP' command.
And when the 'PS | GREP' command fails, the output is always empty. So also
fix it to actually output the ps information. After the change, it looks like:
| AssertionError: 1 != 0 : No syslogd process; ps -ef output:
| UID        PID  PPID  C STIME TTY          TIME CMD
| root         1     0 28 07:35 ?        00:00:19 /sbin/init
| root         2     0  0 07:35 ?        00:00:00 [kthreadd]
| root         3     2  0 07:35 ?        00:00:00 [kworker/0:0]
...

Signed-off-by: Chen Qi <Qi.Chen at windriver.com>
---
 meta/lib/oeqa/runtime/cases/oe_syslog.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/meta/lib/oeqa/runtime/cases/oe_syslog.py b/meta/lib/oeqa/runtime/cases/oe_syslog.py
index 935f10f..23abae3 100644
--- a/meta/lib/oeqa/runtime/cases/oe_syslog.py
+++ b/meta/lib/oeqa/runtime/cases/oe_syslog.py
@@ -10,9 +10,10 @@ class SyslogTest(OERuntimeTestCase):
     @OETestDepends(['ssh.SSHTest.test_ssh'])
     @OEHasPackage(["busybox-syslog", "sysklogd", "rsyslog", "syslog-ng"])
     def test_syslog_running(self):
-        cmd = '%s  | grep -i [s]yslogd' % self.tc.target_cmds['ps']
-        status, output = self.target.run(cmd)
-        msg = "No syslogd process; ps output: %s" % output
+        cmd = '%s  | grep -iE "[s]yslogd|[s]yslog-ng"' % self.tc.target_cmds['ps']
+        status, _ = self.target.run(cmd)
+        _, output = self.target.run(self.tc.target_cmds['ps'])
+        msg = "No syslogd process; %s output:\n%s" % (self.tc.target_cmds['ps'], output)
         self.assertEqual(status, 0, msg=msg)
 
 class SyslogTestConfig(OERuntimeTestCase):
-- 
1.9.1




More information about the Openembedded-core mailing list