summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/runtime/syslog.py
diff options
context:
space:
mode:
authorAníbal Limón <anibal.limon@linux.intel.com>2016-10-27 16:39:47 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-01-23 12:05:19 +0000
commitb61326efb1bc66202831f9710716b5171a722039 (patch)
tree31e229ee225f0a816eb60a5fb721b021f8eab3e2 /meta/lib/oeqa/runtime/syslog.py
parentba1aec3407e38f4dc4141e4d6300b3d538dc9dd3 (diff)
downloadpoky-b61326efb1bc66202831f9710716b5171a722039.tar.gz
oeqa/runtime: Move to runtime_cases
The new oeqa core framework will modify the structure of the runtime folder the new runtime folder will have python code inside to support runtime test cases. (From OE-Core rev: 637b712096e9d230e15b1a432a561e4118db34c8) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/runtime/syslog.py')
-rw-r--r--meta/lib/oeqa/runtime/syslog.py52
1 files changed, 0 insertions, 52 deletions
diff --git a/meta/lib/oeqa/runtime/syslog.py b/meta/lib/oeqa/runtime/syslog.py
deleted file mode 100644
index 8f550329e7..0000000000
--- a/meta/lib/oeqa/runtime/syslog.py
+++ /dev/null
@@ -1,52 +0,0 @@
1import unittest
2from oeqa.oetest import oeRuntimeTest, skipModule
3from oeqa.utils.decorators import *
4
5def setUpModule():
6 if not (oeRuntimeTest.hasPackage("busybox-syslog") or oeRuntimeTest.hasPackage("sysklogd")):
7 skipModule("No syslog package in image")
8
9class SyslogTest(oeRuntimeTest):
10
11 @testcase(201)
12 def test_syslog_running(self):
13 (status,output) = self.target.run(oeRuntimeTest.pscmd + ' | grep -i [s]yslogd')
14 self.assertEqual(status, 0, msg="no syslogd process, ps output: %s" % self.target.run(oeRuntimeTest.pscmd)[1])
15
16class SyslogTestConfig(oeRuntimeTest):
17
18 @testcase(1149)
19 @skipUnlessPassed("test_syslog_running")
20 def test_syslog_logger(self):
21 (status, output) = self.target.run('logger foobar')
22 self.assertEqual(status, 0, msg="Can't log into syslog. Output: %s " % output)
23
24 (status, output) = self.target.run('grep foobar /var/log/messages')
25 if status != 0:
26 if oeRuntimeTest.tc.d.getVar("VIRTUAL-RUNTIME_init_manager", "") == "systemd":
27 (status, output) = self.target.run('journalctl -o cat | grep foobar')
28 else:
29 (status, output) = self.target.run('logread | grep foobar')
30 self.assertEqual(status, 0, msg="Test log string not found in /var/log/messages or logread. Output: %s " % output)
31
32 @testcase(1150)
33 @skipUnlessPassed("test_syslog_running")
34 def test_syslog_restart(self):
35 if "systemd" != oeRuntimeTest.tc.d.getVar("VIRTUAL-RUNTIME_init_manager", False):
36 (status,output) = self.target.run('/etc/init.d/syslog restart')
37 else:
38 (status,output) = self.target.run('systemctl restart syslog.service')
39
40 @testcase(202)
41 @skipUnlessPassed("test_syslog_restart")
42 @skipUnlessPassed("test_syslog_logger")
43 @unittest.skipIf("systemd" == oeRuntimeTest.tc.d.getVar("VIRTUAL-RUNTIME_init_manager", False), "Not appropiate for systemd image")
44 @unittest.skipIf(oeRuntimeTest.hasPackage("sysklogd") or not oeRuntimeTest.hasPackage("busybox"), "Non-busybox syslog")
45 def test_syslog_startup_config(self):
46 self.target.run('echo "LOGFILE=/var/log/test" >> /etc/syslog-startup.conf')
47 (status,output) = self.target.run('/etc/init.d/syslog restart')
48 self.assertEqual(status, 0, msg="Could not restart syslog service. Status and output: %s and %s" % (status,output))
49 (status,output) = self.target.run('logger foobar && grep foobar /var/log/test')
50 self.assertEqual(status, 0, msg="Test log string not found. Output: %s " % output)
51 self.target.run("sed -i 's#LOGFILE=/var/log/test##' /etc/syslog-startup.conf")
52 self.target.run('/etc/init.d/syslog restart')