]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa/runtime/syslog.py: Improve test_syslog_logger
authorAníbal Limón <anibal.limon@linux.intel.com>
Wed, 27 Jul 2016 22:40:38 +0000 (17:40 -0500)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 1 Aug 2016 10:46:37 +0000 (11:46 +0100)
Instead of make all the testing in a shell one liner, divide the
test into 3 operations to be able to know in what part is failing.

Parts,
- Log message to syslog
- Review if message exist in /var/log/messages
- Review if message exist using logread

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 f7421ec8c5b9aecab2b897eb64ca76b1f6db1984..202a63f2af997e69314de984438e1505571a4282 100644 (file)
@@ -18,8 +18,13 @@ class SyslogTestConfig(oeRuntimeTest):
     @testcase(1149)
     @skipUnlessPassed("test_syslog_running")
     def test_syslog_logger(self):
-        (status,output) = self.target.run('logger foobar && test -e /var/log/messages && grep foobar /var/log/messages || logread | grep foobar')
-        self.assertEqual(status, 0, msg="Test log string not found in /var/log/messages. Output: %s " % output)
+        (status, output) = self.target.run('logger foobar')
+        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:
+            (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)
     @skipUnlessPassed("test_syslog_running")