diff options
author | Alexandru Palalau <alexandrux.palalau@intel.com> | 2013-08-20 16:00:48 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-08-26 11:42:13 +0100 |
commit | 186d79a603b5cbf5a93e6f5dbba5f62ed8d4d8d8 (patch) | |
tree | 4c682e11f9e4d59dbfa22a97fbea71b79d6be635 | |
parent | d53ffbf21a6b17f0f0537929a95a502958d82a09 (diff) | |
download | openembedded-core-186d79a603b5cbf5a93e6f5dbba5f62ed8d4d8d8.tar.gz openembedded-core-186d79a603b5cbf5a93e6f5dbba5f62ed8d4d8d8.tar.bz2 openembedded-core-186d79a603b5cbf5a93e6f5dbba5f62ed8d4d8d8.zip |
lib/oeqa/runtime: add new logrotate test
New logrotate test which verifies the log directory change in logrotate.conf.
Needs an image with logrotate installed.
Signed-off-by: Alexandru Palalau <alexandrux.palalau@intel.com>
Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
-rw-r--r-- | meta/lib/oeqa/runtime/logrotate.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/meta/lib/oeqa/runtime/logrotate.py b/meta/lib/oeqa/runtime/logrotate.py new file mode 100644 index 0000000000..80489a3267 --- /dev/null +++ b/meta/lib/oeqa/runtime/logrotate.py @@ -0,0 +1,27 @@ +# This test should cover https://bugzilla.yoctoproject.org/tr_show_case.cgi?case_id=289 testcase +# Note that the image under test must have logrotate installed + +import unittest +from oeqa.oetest import oeRuntimeTest, skipModule +from oeqa.utils.decorators import * + +def setUpModule(): + if not oeRuntimeTest.hasPackage("logrotate"): + skipModule("No logrotate package in image") + + +class LogrotateTest(oeRuntimeTest): + + @skipUnlessPassed("test_ssh") + def test_1_logrotate_setup(self): + (status, output) = self.target.run('mkdir /home/root/logrotate_dir') + self.assertEqual(status, 0, msg = "Could not create logrotate_dir. Output: %s" % output) + (status, output) = self.target.run("sed -i 's#wtmp {#wtmp {\\n olddir /home/root/logrotate_dir#' /etc/logrotate.conf") + self.assertEqual(status, 0, msg = "Could not write to logrotate.conf file. Status and output: %s and %s)" % (status, output)) + + @skipUnlessPassed("test_1_logrotate_setup") + def test_2_logrotate(self): + (status, output) = self.target.run('logrotate -f /etc/logrotate.conf') + self.assertEqual(status, 0, msg = "logrotate service could not be reloaded. Status and output: %s and %s" % (status, output)) + output = self.target.run('ls -la /home/root/logrotate_dir/ | wc -l')[1] + self.assertTrue(int(output)>=3, msg = "new logfile could not be created. List of files within log directory: %s" %(self.target.run('ls -la /home/root/logrotate_dir')[1])) |