diff options
Diffstat (limited to 'meta/lib/oeqa/runtime/cases/logrotate.py')
| -rw-r--r-- | meta/lib/oeqa/runtime/cases/logrotate.py | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/meta/lib/oeqa/runtime/cases/logrotate.py b/meta/lib/oeqa/runtime/cases/logrotate.py index 0d4b9ac60b..9fe1170226 100644 --- a/meta/lib/oeqa/runtime/cases/logrotate.py +++ b/meta/lib/oeqa/runtime/cases/logrotate.py | |||
| @@ -12,17 +12,6 @@ from oeqa.core.decorator.depends import OETestDepends | |||
| 12 | from oeqa.runtime.decorator.package import OEHasPackage | 12 | from oeqa.runtime.decorator.package import OEHasPackage |
| 13 | 13 | ||
| 14 | class LogrotateTest(OERuntimeTestCase): | 14 | class LogrotateTest(OERuntimeTestCase): |
| 15 | |||
| 16 | @classmethod | ||
| 17 | def setUpClass(cls): | ||
| 18 | cls.tc.target.run('cp /etc/logrotate.d/wtmp $HOME/wtmp.oeqabak', | ||
| 19 | ignore_ssh_fails=True) | ||
| 20 | |||
| 21 | @classmethod | ||
| 22 | def tearDownClass(cls): | ||
| 23 | cls.tc.target.run('mv -f $HOME/wtmp.oeqabak /etc/logrotate.d/wtmp && rm -rf /var/log/logrotate_dir', ignore_ssh_fails=True) | ||
| 24 | cls.tc.target.run('rm -rf /var/log/logrotate_testfile && rm -rf /etc/logrotate.d/logrotate_testfile', ignore_ssh_fails=True) | ||
| 25 | |||
| 26 | @OETestDepends(['ssh.SSHTest.test_ssh']) | 15 | @OETestDepends(['ssh.SSHTest.test_ssh']) |
| 27 | @OEHasPackage(['logrotate']) | 16 | @OEHasPackage(['logrotate']) |
| 28 | def test_logrotate_wtmp(self): | 17 | def test_logrotate_wtmp(self): |
| @@ -33,6 +22,7 @@ class LogrotateTest(OERuntimeTestCase): | |||
| 33 | 22 | ||
| 34 | # Create a folder to store rotated file and add the corresponding | 23 | # Create a folder to store rotated file and add the corresponding |
| 35 | # configuration option | 24 | # configuration option |
| 25 | self.addCleanup(self.target.run, 'rm -rf /var/log/logrotate_dir') | ||
| 36 | status, output = self.target.run('mkdir /var/log/logrotate_dir') | 26 | status, output = self.target.run('mkdir /var/log/logrotate_dir') |
| 37 | msg = ('Could not create logrotate_dir. Output: %s' % output) | 27 | msg = ('Could not create logrotate_dir. Output: %s' % output) |
| 38 | self.assertEqual(status, 0, msg = msg) | 28 | self.assertEqual(status, 0, msg = msg) |
| @@ -55,10 +45,17 @@ class LogrotateTest(OERuntimeTestCase): | |||
| 55 | self.assertEqual(status, 0, msg = msg) | 45 | self.assertEqual(status, 0, msg = msg) |
| 56 | 46 | ||
| 57 | # Create a new configuration file dedicated to a /var/log/logrotate_testfile | 47 | # Create a new configuration file dedicated to a /var/log/logrotate_testfile |
| 48 | self.addCleanup(self.target.run, 'rm -f /var/log/logrotate_testfile') | ||
| 58 | status, output = self.target.run('echo "/var/log/logrotate_testfile {\n missingok \n monthly \n rotate 1}" > /etc/logrotate.d/logrotate_testfile') | 49 | status, output = self.target.run('echo "/var/log/logrotate_testfile {\n missingok \n monthly \n rotate 1}" > /etc/logrotate.d/logrotate_testfile') |
| 59 | msg = ('Could not write to /etc/logrotate.d/logrotate_testfile') | 50 | msg = ('Could not write to /etc/logrotate.d/logrotate_testfile') |
| 60 | self.assertEqual(status, 0, msg = msg) | 51 | self.assertEqual(status, 0, msg = msg) |
| 61 | 52 | ||
| 53 | self.addCleanup(self.target.run, 'rm -rf /var/log/logrotate_dir') | ||
| 54 | status, output = self.target.run('mkdir /var/log/logrotate_dir') | ||
| 55 | msg = ('Could not create logrotate_dir. Output: %s' % output) | ||
| 56 | self.assertEqual(status, 0, msg = msg) | ||
| 57 | |||
| 58 | self.addCleanup(self.target.run, 'rm -f /etc/logrotate.d/logrotate_testfile') | ||
| 62 | status, output = self.target.run('echo "create \n olddir /var/log/logrotate_dir \n include /etc/logrotate.d/logrotate_testfile" > /tmp/logrotate-test2.conf') | 59 | status, output = self.target.run('echo "create \n olddir /var/log/logrotate_dir \n include /etc/logrotate.d/logrotate_testfile" > /tmp/logrotate-test2.conf') |
| 63 | msg = ('Could not write to /tmp/logrotate_test2.conf') | 60 | msg = ('Could not write to /tmp/logrotate_test2.conf') |
| 64 | self.assertEqual(status, 0, msg = msg) | 61 | self.assertEqual(status, 0, msg = msg) |
