diff options
author | Aníbal Limón <anibal.limon@linux.intel.com> | 2016-10-27 16:39:47 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-01-23 12:03:55 +0000 |
commit | 637b712096e9d230e15b1a432a561e4118db34c8 (patch) | |
tree | 3cdde5ee757e754a8651f0caa093680f4377ccd8 /meta/lib/oeqa/runtime_cases/syslog.py | |
parent | f099302efe8f222c3e4ae3604429f5ede4fd8c67 (diff) | |
download | openembedded-core-637b712096e9d230e15b1a432a561e4118db34c8.tar.gz openembedded-core-637b712096e9d230e15b1a432a561e4118db34c8.tar.bz2 openembedded-core-637b712096e9d230e15b1a432a561e4118db34c8.zip |
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.
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Diffstat (limited to 'meta/lib/oeqa/runtime_cases/syslog.py')
-rw-r--r-- | meta/lib/oeqa/runtime_cases/syslog.py | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/meta/lib/oeqa/runtime_cases/syslog.py b/meta/lib/oeqa/runtime_cases/syslog.py new file mode 100644 index 0000000000..8f550329e7 --- /dev/null +++ b/meta/lib/oeqa/runtime_cases/syslog.py @@ -0,0 +1,52 @@ +import unittest +from oeqa.oetest import oeRuntimeTest, skipModule +from oeqa.utils.decorators import * + +def setUpModule(): + if not (oeRuntimeTest.hasPackage("busybox-syslog") or oeRuntimeTest.hasPackage("sysklogd")): + skipModule("No syslog package in image") + +class SyslogTest(oeRuntimeTest): + + @testcase(201) + def test_syslog_running(self): + (status,output) = self.target.run(oeRuntimeTest.pscmd + ' | grep -i [s]yslogd') + self.assertEqual(status, 0, msg="no syslogd process, ps output: %s" % self.target.run(oeRuntimeTest.pscmd)[1]) + +class SyslogTestConfig(oeRuntimeTest): + + @testcase(1149) + @skipUnlessPassed("test_syslog_running") + def test_syslog_logger(self): + (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: + 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) + @skipUnlessPassed("test_syslog_running") + def test_syslog_restart(self): + if "systemd" != oeRuntimeTest.tc.d.getVar("VIRTUAL-RUNTIME_init_manager", False): + (status,output) = self.target.run('/etc/init.d/syslog restart') + else: + (status,output) = self.target.run('systemctl restart syslog.service') + + @testcase(202) + @skipUnlessPassed("test_syslog_restart") + @skipUnlessPassed("test_syslog_logger") + @unittest.skipIf("systemd" == oeRuntimeTest.tc.d.getVar("VIRTUAL-RUNTIME_init_manager", False), "Not appropiate for systemd image") + @unittest.skipIf(oeRuntimeTest.hasPackage("sysklogd") or not oeRuntimeTest.hasPackage("busybox"), "Non-busybox syslog") + def test_syslog_startup_config(self): + self.target.run('echo "LOGFILE=/var/log/test" >> /etc/syslog-startup.conf') + (status,output) = self.target.run('/etc/init.d/syslog restart') + self.assertEqual(status, 0, msg="Could not restart syslog service. Status and output: %s and %s" % (status,output)) + (status,output) = self.target.run('logger foobar && grep foobar /var/log/test') + self.assertEqual(status, 0, msg="Test log string not found. Output: %s " % output) + self.target.run("sed -i 's#LOGFILE=/var/log/test##' /etc/syslog-startup.conf") + self.target.run('/etc/init.d/syslog restart') |