diff options
author | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2021-08-12 23:46:38 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-08-13 22:43:56 +0100 |
commit | 26f1ecb72d501eb1b0a18b62e83716562ccb57cf (patch) | |
tree | 25bf06c93f90fdba471d1025e11c5aeb4157571d /meta/lib | |
parent | 8a09663e7c66de743c0558297f3dcfd27542fa05 (diff) | |
download | poky-26f1ecb72d501eb1b0a18b62e83716562ccb57cf.tar.gz |
oeqa/runtime/cases: make date.DateTest.test_date more reliable
The test uses the broken out time and can only handle about 59s of delay,
use a UNIX timestamp to allow for up to a 300s delay.
[YOCTO #14463]
(From OE-Core rev: b705e9373acd4119da75af4eb96ec92cc964aa86)
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/runtime/cases/date.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/meta/lib/oeqa/runtime/cases/date.py b/meta/lib/oeqa/runtime/cases/date.py index e14322911d..bd6537400e 100644 --- a/meta/lib/oeqa/runtime/cases/date.py +++ b/meta/lib/oeqa/runtime/cases/date.py | |||
@@ -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 |