diff options
author | Tudor Florea <tudor.florea@enea.com> | 2015-10-09 22:59:03 +0200 |
---|---|---|
committer | Tudor Florea <tudor.florea@enea.com> | 2015-10-09 22:59:03 +0200 |
commit | 972dcfcdbfe75dcfeb777150c136576cf1a71e99 (patch) | |
tree | 97a61cd7e293d7ae9d56ef7ed0f81253365bb026 /meta/lib/oeqa/runtime/syslog.py | |
download | poky-972dcfcdbfe75dcfeb777150c136576cf1a71e99.tar.gz |
initial commit for Enea Linux 5.0 arm
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta/lib/oeqa/runtime/syslog.py')
-rw-r--r-- | meta/lib/oeqa/runtime/syslog.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/meta/lib/oeqa/runtime/syslog.py b/meta/lib/oeqa/runtime/syslog.py new file mode 100644 index 0000000000..7fa018e97f --- /dev/null +++ b/meta/lib/oeqa/runtime/syslog.py | |||
@@ -0,0 +1,48 @@ | |||
1 | import unittest | ||
2 | from oeqa.oetest import oeRuntimeTest, skipModule | ||
3 | from oeqa.utils.decorators import * | ||
4 | |||
5 | def setUpModule(): | ||
6 | if not oeRuntimeTest.hasPackage("syslog"): | ||
7 | skipModule("No syslog package in image") | ||
8 | |||
9 | class SyslogTest(oeRuntimeTest): | ||
10 | |||
11 | @skipUnlessPassed("test_ssh") | ||
12 | def test_syslog_help(self): | ||
13 | (status,output) = self.target.run('/sbin/syslogd --help') | ||
14 | self.assertEqual(status, 0, msg="status and output: %s and %s" % (status,output)) | ||
15 | |||
16 | @testcase(201) | ||
17 | @skipUnlessPassed("test_syslog_help") | ||
18 | def test_syslog_running(self): | ||
19 | (status,output) = self.target.run(oeRuntimeTest.pscmd + ' | grep -i [s]yslogd') | ||
20 | self.assertEqual(status, 0, msg="no syslogd process, ps output: %s" % self.target.run(oeRuntimeTest.pscmd)[1]) | ||
21 | |||
22 | |||
23 | class SyslogTestConfig(oeRuntimeTest): | ||
24 | |||
25 | @skipUnlessPassed("test_syslog_running") | ||
26 | def test_syslog_logger(self): | ||
27 | (status,output) = self.target.run('logger foobar && test -e /var/log/messages && grep foobar /var/log/messages || logread | grep foobar') | ||
28 | self.assertEqual(status, 0, msg="Test log string not found in /var/log/messages. Output: %s " % output) | ||
29 | |||
30 | @skipUnlessPassed("test_syslog_running") | ||
31 | def test_syslog_restart(self): | ||
32 | if "systemd" != oeRuntimeTest.tc.d.getVar("VIRTUAL-RUNTIME_init_manager"): | ||
33 | (status,output) = self.target.run('/etc/init.d/syslog restart') | ||
34 | else: | ||
35 | (status,output) = self.target.run('systemctl restart syslog.service') | ||
36 | |||
37 | @testcase(202) | ||
38 | @skipUnlessPassed("test_syslog_restart") | ||
39 | @skipUnlessPassed("test_syslog_logger") | ||
40 | @unittest.skipIf("systemd" == oeRuntimeTest.tc.d.getVar("VIRTUAL-RUNTIME_init_manager"), "Not appropiate for systemd image") | ||
41 | def test_syslog_startup_config(self): | ||
42 | self.target.run('echo "LOGFILE=/var/log/test" >> /etc/syslog-startup.conf') | ||
43 | (status,output) = self.target.run('/etc/init.d/syslog restart') | ||
44 | self.assertEqual(status, 0, msg="Could not restart syslog service. Status and output: %s and %s" % (status,output)) | ||
45 | (status,output) = self.target.run('logger foobar && grep foobar /var/log/test') | ||
46 | self.assertEqual(status, 0, msg="Test log string not found. Output: %s " % output) | ||
47 | self.target.run("sed -i 's#LOGFILE=/var/log/test##' /etc/syslog-startup.conf") | ||
48 | self.target.run('/etc/init.d/syslog restart') | ||