oe_syslog.py: fix for syslog-ng
cover oe_syslog.py: fix for syslog-ng
*** BLURB HERE ***
The following changes since commit da24071e92071ecbefe51314d82bf40f85172485:
bitbake: toaster/orm/management/commands/lsupdates.py: Use new layerindexlib module (2018-08-02 10:18:27 +0100)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib ChenQi/oe_syslog
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/oe_syslog
Chen Qi (1):
oe_syslog.py: fix for syslog-ng
meta/lib/oeqa/runtime/cases/oe_syslog.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/1 oe_syslog.py: fix for syslog-ng
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]
...
--- meta/lib/oeqa/runtime/cases/oe_syslog.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
meta/lib/oeqa/runtime/cases/oe_syslog.py +4 -3
@@ -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):
Signature · 1 line
1.9.1
Quoted 50 lines · Chen Qi
When using syslog-ng as the syslog provider,
oe_syslogtest 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:
Quoted 1 line
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:Quoted 5 lines
AssertionError: 1 != 0 : No syslogd process; ps -ef output:
UID PID PPID C STIME TTY TIME CMDroot 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 <[email protected]>--- meta/lib/oeqa/runtime/cases/oe_syslog.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)meta/lib/oeqa/runtime/cases/oe_syslog.py +1
-3@@ -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']
meta/lib/oeqa/runtime/cases/oe_syslog.py +3
-0+ status, _ = self.target.run(cmd) + _, output = self.target.run(self.tc.target_cmds['ps']) + msg = "No syslogd process; %s output:\n%s" %
Quoted 2 lines
(self.tc.target_cmds['ps'], output)
self.assertEqual(status, 0, msg=msg)
Rather than getting the output of "ps" again if the test failed (which may then be different), could we just get the output of ps and then test for the presence of syslog using python, sharing the output of ps if the match isn't found?
Cheers,
Richard
Quoted 56 lines · Richard Purdie
Quoted 48 lines · Chen Qi
When using syslog-ng as the syslog provider,
oe_syslogtest 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:
Quoted 1 line
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:Quoted 5 lines
AssertionError: 1 != 0 : No syslogd process; ps -ef output:
UID PID PPID C STIME TTY TIME CMDroot 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 <[email protected]>--- meta/lib/oeqa/runtime/cases/oe_syslog.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)meta/lib/oeqa/runtime/cases/oe_syslog.py +1
-3@@ -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']
meta/lib/oeqa/runtime/cases/oe_syslog.py +3
-0+ status, _ = self.target.run(cmd) + _, output = self.target.run(self.tc.target_cmds['ps']) + msg = "No syslogd process; %s output:\n%s" %Quoted 2 lines
(self.tc.target_cmds['ps'], output)
self.assertEqual(status, 0, msg=msg)Rather than getting the output of "ps" again if the test failed (which may then be different), could we just get the output of ps and then test for the presence of syslog using python, sharing the output of ps if the match isn't found?
Quoted 4 lines
Cheers,
Richard
Yes, it is better. I'll send out V2.
Best Regards,
Chen Qi