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