diff options
Diffstat (limited to 'meta/lib/oeqa/runtime/date.py')
-rw-r--r-- | meta/lib/oeqa/runtime/date.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/meta/lib/oeqa/runtime/date.py b/meta/lib/oeqa/runtime/date.py new file mode 100644 index 0000000000..97e8ee42ad --- /dev/null +++ b/meta/lib/oeqa/runtime/date.py | |||
@@ -0,0 +1,23 @@ | |||
1 | from oeqa.oetest import oeRuntimeTest | ||
2 | from oeqa.utils.decorators import * | ||
3 | import re | ||
4 | |||
5 | class DateTest(oeRuntimeTest): | ||
6 | |||
7 | @testcase(211) | ||
8 | @skipUnlessPassed("test_ssh") | ||
9 | def test_date(self): | ||
10 | (status, output) = self.target.run('date +"%Y-%m-%d %T"') | ||
11 | self.assertEqual(status, 0, msg="Failed to get initial date, output: %s" % output) | ||
12 | oldDate = output | ||
13 | |||
14 | sampleDate = '"2016-08-09 10:00:00"' | ||
15 | (status, output) = self.target.run("date -s %s" % sampleDate) | ||
16 | self.assertEqual(status, 0, msg="Date set failed, output: %s" % output) | ||
17 | |||
18 | (status, output) = self.target.run("date -R") | ||
19 | p = re.match('Tue, 09 Aug 2016 10:00:.. \+0000', output) | ||
20 | self.assertTrue(p, msg="The date was not set correctly, output: %s" % output) | ||
21 | |||
22 | (status, output) = self.target.run('date -s "%s"' % oldDate) | ||
23 | self.assertEqual(status, 0, msg="Failed to reset date, output: %s" % output) | ||