diff options
Diffstat (limited to 'meta/lib')
| -rw-r--r-- | meta/lib/oeqa/runtime/cases/logrotate.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/meta/lib/oeqa/runtime/cases/logrotate.py b/meta/lib/oeqa/runtime/cases/logrotate.py index a4efcd07c0..2bff08f9da 100644 --- a/meta/lib/oeqa/runtime/cases/logrotate.py +++ b/meta/lib/oeqa/runtime/cases/logrotate.py | |||
| @@ -17,7 +17,7 @@ class LogrotateTest(OERuntimeTestCase): | |||
| 17 | 17 | ||
| 18 | @classmethod | 18 | @classmethod |
| 19 | def tearDownClass(cls): | 19 | def tearDownClass(cls): |
| 20 | cls.tc.target.run('mv -f $HOME/wtmp.oeqabak /etc/logrotate.d/wtmp && rm -rf $HOME/logrotate_dir') | 20 | cls.tc.target.run('mv -f $HOME/wtmp.oeqabak /etc/logrotate.d/wtmp && rm -rf /var/log//logrotate_dir') |
| 21 | cls.tc.target.run('rm -rf /var/log/logrotate_testfile && rm -rf /etc/logrotate.d/logrotate_testfile') | 21 | cls.tc.target.run('rm -rf /var/log/logrotate_testfile && rm -rf /etc/logrotate.d/logrotate_testfile') |
| 22 | 22 | ||
| 23 | @OETestDepends(['ssh.SSHTest.test_ssh']) | 23 | @OETestDepends(['ssh.SSHTest.test_ssh']) |
| @@ -29,17 +29,17 @@ class LogrotateTest(OERuntimeTestCase): | |||
| 29 | msg = ('Could not create/update /var/log/wtmp with touch') | 29 | msg = ('Could not create/update /var/log/wtmp with touch') |
| 30 | self.assertEqual(status, 0, msg = msg) | 30 | self.assertEqual(status, 0, msg = msg) |
| 31 | 31 | ||
| 32 | status, output = self.target.run('mkdir $HOME/logrotate_dir') | 32 | status, output = self.target.run('mkdir /var/log//logrotate_dir') |
| 33 | msg = ('Could not create logrotate_dir. Output: %s' % output) | 33 | msg = ('Could not create logrotate_dir. Output: %s' % output) |
| 34 | self.assertEqual(status, 0, msg = msg) | 34 | self.assertEqual(status, 0, msg = msg) |
| 35 | 35 | ||
| 36 | status, output = self.target.run('echo "create \n olddir $HOME/logrotate_dir \n include /etc/logrotate.d/wtmp" > /tmp/logrotate-test.conf') | 36 | status, output = self.target.run('echo "create \n olddir /var/log//logrotate_dir \n include /etc/logrotate.d/wtmp" > /tmp/logrotate-test.conf') |
| 37 | msg = ('Could not write to /tmp/logrotate-test.conf') | 37 | msg = ('Could not write to /tmp/logrotate-test.conf') |
| 38 | self.assertEqual(status, 0, msg = msg) | 38 | self.assertEqual(status, 0, msg = msg) |
| 39 | 39 | ||
| 40 | # If logrotate fails to rotate the log, view the verbose output of logrotate to see what prevented it | 40 | # If logrotate fails to rotate the log, view the verbose output of logrotate to see what prevented it |
| 41 | _, logrotate_output = self.target.run('logrotate -vf /tmp/logrotate-test.conf') | 41 | _, logrotate_output = self.target.run('logrotate -vf /tmp/logrotate-test.conf') |
| 42 | status, _ = self.target.run('find $HOME/logrotate_dir -type f | grep wtmp.1') | 42 | status, _ = self.target.run('find /var/log//logrotate_dir -type f | grep wtmp.1') |
| 43 | msg = ("logrotate did not successfully rotate the wtmp log. Output from logrotate -vf: \n%s" % (logrotate_output)) | 43 | msg = ("logrotate did not successfully rotate the wtmp log. Output from logrotate -vf: \n%s" % (logrotate_output)) |
| 44 | self.assertEqual(status, 0, msg = msg) | 44 | self.assertEqual(status, 0, msg = msg) |
| 45 | 45 | ||
| @@ -54,17 +54,17 @@ class LogrotateTest(OERuntimeTestCase): | |||
| 54 | msg = ('Could not write to /etc/logrotate.d/logrotate_testfile') | 54 | msg = ('Could not write to /etc/logrotate.d/logrotate_testfile') |
| 55 | self.assertEqual(status, 0, msg = msg) | 55 | self.assertEqual(status, 0, msg = msg) |
| 56 | 56 | ||
| 57 | status, output = self.target.run('echo "create \n olddir $HOME/logrotate_dir \n include /etc/logrotate.d/logrotate_testfile" > /tmp/logrotate-test2.conf') | 57 | status, output = self.target.run('echo "create \n olddir /var/log//logrotate_dir \n include /etc/logrotate.d/logrotate_testfile" > /tmp/logrotate-test2.conf') |
| 58 | msg = ('Could not write to /tmp/logrotate_test2.conf') | 58 | msg = ('Could not write to /tmp/logrotate_test2.conf') |
| 59 | self.assertEqual(status, 0, msg = msg) | 59 | self.assertEqual(status, 0, msg = msg) |
| 60 | 60 | ||
| 61 | status, output = self.target.run('find $HOME/logrotate_dir -type f | grep logrotate_testfile.1') | 61 | status, output = self.target.run('find /var/log//logrotate_dir -type f | grep logrotate_testfile.1') |
| 62 | msg = ('A rotated log for logrotate_testfile is already present in logrotate_dir') | 62 | msg = ('A rotated log for logrotate_testfile is already present in logrotate_dir') |
| 63 | self.assertEqual(status, 1, msg = msg) | 63 | self.assertEqual(status, 1, msg = msg) |
| 64 | 64 | ||
| 65 | # If logrotate fails to rotate the log, view the verbose output of logrotate instead of just listing the files in olddir | 65 | # If logrotate fails to rotate the log, view the verbose output of logrotate instead of just listing the files in olddir |
| 66 | _, logrotate_output = self.target.run('logrotate -vf /tmp/logrotate-test2.conf') | 66 | _, logrotate_output = self.target.run('logrotate -vf /tmp/logrotate-test2.conf') |
| 67 | status, _ = self.target.run('find $HOME/logrotate_dir -type f | grep logrotate_testfile.1') | 67 | status, _ = self.target.run('find /var/log//logrotate_dir -type f | grep logrotate_testfile.1') |
| 68 | msg = ('logrotate did not successfully rotate the logrotate_test log. Output from logrotate -vf: \n%s' % (logrotate_output)) | 68 | msg = ('logrotate did not successfully rotate the logrotate_test log. Output from logrotate -vf: \n%s' % (logrotate_output)) |
| 69 | self.assertEqual(status, 0, msg = msg) | 69 | self.assertEqual(status, 0, msg = msg) |
| 70 | 70 | ||
