aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@bootlin.com>2021-08-12 23:46:38 +0200
committerAnuj Mittal <anuj.mittal@intel.com>2021-08-23 15:46:51 +0800
commit09e238635c8d4cd595c2233a14c2ce1cbb9e5162 (patch)
treed9402a344e56193bbf577f898f276bd0b2504cc2
parent6fa724a55a4cb7eac7d4d50017b573af54fd6a34 (diff)
downloadopenembedded-core-09e238635c8d4cd595c2233a14c2ce1cbb9e5162.tar.gz
openembedded-core-09e238635c8d4cd595c2233a14c2ce1cbb9e5162.tar.bz2
openembedded-core-09e238635c8d4cd595c2233a14c2ce1cbb9e5162.zip
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] 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>
-rw-r--r--meta/lib/oeqa/runtime/cases/date.py9
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):
self.assertEqual(status, 0, msg=msg)
oldDate = output
- sampleDate = '"2016-08-09 10:00:00"'
- (status, output) = self.target.run("date -s %s" % sampleDate)
+ sampleTimestamp = 1488800000
+ (status, output) = self.target.run("date -s @%d" % sampleTimestamp)
self.assertEqual(status, 0, msg='Date set failed, output: %s' % output)
- (status, output) = self.target.run("date -R")
- p = re.match('Tue, 09 Aug 2016 10:00:.. \+0000', output)
+ (status, output) = self.target.run('date +"%s"')
msg = 'The date was not set correctly, output: %s' % output
- self.assertTrue(p, msg=msg)
+ self.assertTrue(int(output) - sampleTimestamp < 300, msg=msg)
(status, output) = self.target.run('date -s "%s"' % oldDate)
msg = 'Failed to reset date, output: %s' % output