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-26 08:32:13 +0100 |
commit | 121e851c84a5d8ad08681c34972615e0c4ac7382 (patch) | |
tree | 8f04b62808fd598242e7ba75f4befe5cde371bcd /meta | |
parent | eef8655e3c029b2d2dfbdb22c23b71951551d519 (diff) | |
download | poky-121e851c84a5d8ad08681c34972615e0c4ac7382.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: 09e238635c8d4cd595c2233a14c2ce1cbb9e5162)
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit b705e9373acd4119da75af4eb96ec92cc964aa86)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-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 |