]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa/runtime/syslog.py: Improve test_syslog_logger on systemd
authorAníbal Limón <anibal.limon@linux.intel.com>
Thu, 11 Aug 2016 20:18:16 +0000 (15:18 -0500)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 17 Aug 2016 09:35:15 +0000 (10:35 +0100)
When an image uses systemd journald acts as a main syslog daemon using
/dev/log.

The test_syslog_logger try to log a predifined message into the syslog
using logger and then search using grep in /var/log/messages if this
fails for some reason (file rotated) now search the predifined message
into the journal.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/lib/oeqa/runtime/syslog.py

index cce3c221d697bb3d42523da8861569b34fb64412..8f550329e7cc22fd60ff2aca80e005e998895ef5 100644 (file)
@@ -22,8 +22,11 @@ class SyslogTestConfig(oeRuntimeTest):
         self.assertEqual(status, 0, msg="Can't log into syslog. Output: %s " % output)
 
         (status, output) = self.target.run('grep foobar /var/log/messages')
-        if status != 0 and not oeRuntimeTest.tc.d.getVar("VIRTUAL-RUNTIME_init_manager", "") == "systemd":
-            (status, output) = self.target.run('logread | grep foobar')
+        if status != 0:
+            if oeRuntimeTest.tc.d.getVar("VIRTUAL-RUNTIME_init_manager", "") == "systemd":
+                (status, output) = self.target.run('journalctl -o cat | grep foobar')
+            else:
+                (status, output) = self.target.run('logread | grep foobar')
         self.assertEqual(status, 0, msg="Test log string not found in /var/log/messages or logread. Output: %s " % output)
 
     @testcase(1150)