From 637b712096e9d230e15b1a432a561e4118db34c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?An=C3=ADbal=20Lim=C3=B3n?= Date: Thu, 27 Oct 2016 16:39:47 -0500 Subject: oeqa/runtime: Move to runtime_cases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- meta/lib/oeqa/runtime_cases/logrotate.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 meta/lib/oeqa/runtime_cases/logrotate.py (limited to 'meta/lib/oeqa/runtime_cases/logrotate.py') diff --git a/meta/lib/oeqa/runtime_cases/logrotate.py b/meta/lib/oeqa/runtime_cases/logrotate.py new file mode 100644 index 0000000000..063280b5f7 --- /dev/null +++ b/meta/lib/oeqa/runtime_cases/logrotate.py @@ -0,0 +1,30 @@ +# 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): + + @testcase(1544) + @skipUnlessPassed("test_ssh") + def test_1_logrotate_setup(self): + (status, output) = self.target.run('mkdir $HOME/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/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)) + + @testcase(1542) + @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/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/logrotate_dir')[1])) + self.target.run('rm -rf $HOME/logrotate_dir') -- cgit v1.2.3