diff options
Diffstat (limited to 'meta/lib/oeqa/runtime/cases/date.py')
-rw-r--r-- | meta/lib/oeqa/runtime/cases/date.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/meta/lib/oeqa/runtime/cases/date.py b/meta/lib/oeqa/runtime/cases/date.py index fdd2a6ae58..bd6537400e 100644 --- a/meta/lib/oeqa/runtime/cases/date.py +++ b/meta/lib/oeqa/runtime/cases/date.py | |||
@@ -13,12 +13,12 @@ class DateTest(OERuntimeTestCase): | |||
13 | def setUp(self): | 13 | def setUp(self): |
14 | if self.tc.td.get('VIRTUAL-RUNTIME_init_manager') == 'systemd': | 14 | if self.tc.td.get('VIRTUAL-RUNTIME_init_manager') == 'systemd': |
15 | self.logger.debug('Stopping systemd-timesyncd daemon') | 15 | self.logger.debug('Stopping systemd-timesyncd daemon') |
16 | self.target.run('systemctl disable --now systemd-timesyncd') | 16 | self.target.run('systemctl disable --now --runtime systemd-timesyncd') |
17 | 17 | ||
18 | def tearDown(self): | 18 | def tearDown(self): |
19 | if self.tc.td.get('VIRTUAL-RUNTIME_init_manager') == 'systemd': | 19 | if self.tc.td.get('VIRTUAL-RUNTIME_init_manager') == 'systemd': |
20 | self.logger.debug('Starting systemd-timesyncd daemon') | 20 | self.logger.debug('Starting systemd-timesyncd daemon') |
21 | self.target.run('systemctl enable --now systemd-timesyncd') | 21 | self.target.run('systemctl enable --now --runtime systemd-timesyncd') |
22 | 22 | ||
23 | @OETestDepends(['ssh.SSHTest.test_ssh']) | 23 | @OETestDepends(['ssh.SSHTest.test_ssh']) |
24 | @OEHasPackage(['coreutils', 'busybox']) | 24 | @OEHasPackage(['coreutils', 'busybox']) |
@@ -28,14 +28,13 @@ class DateTest(OERuntimeTestCase): | |||
28 | self.assertEqual(status, 0, msg=msg) | 28 | self.assertEqual(status, 0, msg=msg) |
29 | oldDate = output | 29 | oldDate = output |
30 | 30 | ||
31 | sampleDate = '"2016-08-09 10:00:00"' | 31 | sampleTimestamp = 1488800000 |
32 | (status, output) = self.target.run("date -s %s" % sampleDate) | 32 | (status, output) = self.target.run("date -s @%d" % sampleTimestamp) |
33 | self.assertEqual(status, 0, msg='Date set failed, output: %s' % output) | 33 | self.assertEqual(status, 0, msg='Date set failed, output: %s' % output) |
34 | 34 | ||
35 | (status, output) = self.target.run("date -R") | 35 | (status, output) = self.target.run('date +"%s"') |
36 | p = re.match('Tue, 09 Aug 2016 10:00:.. \+0000', output) | ||
37 | msg = 'The date was not set correctly, output: %s' % output | 36 | msg = 'The date was not set correctly, output: %s' % output |
38 | self.assertTrue(p, msg=msg) | 37 | self.assertTrue(int(output) - sampleTimestamp < 300, msg=msg) |
39 | 38 | ||
40 | (status, output) = self.target.run('date -s "%s"' % oldDate) | 39 | (status, output) = self.target.run('date -s "%s"' % oldDate) |
41 | msg = 'Failed to reset date, output: %s' % output | 40 | msg = 'Failed to reset date, output: %s' % output |