diff options
author | Jason M. Bills <jason.m.bills@linux.intel.com> | 2020-12-08 00:38:17 +0300 |
---|---|---|
committer | Jason M. Bills <jason.m.bills@linux.intel.com> | 2020-12-08 00:38:17 +0300 |
commit | 8d6ae7f2a817751fad151168fa10ce28ee0869d8 (patch) | |
tree | 281032f7ec07c41589aa094bd165cc2a98f2d3a7 /poky/meta/lib/oeqa/runtime/cases/rtc.py | |
parent | c16fb8893b19075db4bcf3b5bf33c1db8c3ca2bd (diff) | |
parent | 5da3c2284560a7e08ffafd03c5b5ba44a3242228 (diff) | |
download | openbmc-8d6ae7f2a817751fad151168fa10ce28ee0869d8.tar.xz |
Merge tag '0.26' of ssh://git-amr-1.devtools.intel.com:29418/openbmc-openbmc into update
Diffstat (limited to 'poky/meta/lib/oeqa/runtime/cases/rtc.py')
-rw-r--r-- | poky/meta/lib/oeqa/runtime/cases/rtc.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/poky/meta/lib/oeqa/runtime/cases/rtc.py b/poky/meta/lib/oeqa/runtime/cases/rtc.py new file mode 100644 index 000000000..a34c101a9 --- /dev/null +++ b/poky/meta/lib/oeqa/runtime/cases/rtc.py @@ -0,0 +1,38 @@ +from oeqa.runtime.case import OERuntimeTestCase +from oeqa.core.decorator.depends import OETestDepends +from oeqa.runtime.decorator.package import OEHasPackage + +import re + +class RTCTest(OERuntimeTestCase): + + def setUp(self): + if self.tc.td.get('VIRTUAL-RUNTIME_init_manager') == 'systemd': + self.logger.debug('Stopping systemd-timesyncd daemon') + self.target.run('systemctl disable --now systemd-timesyncd') + + def tearDown(self): + if self.tc.td.get('VIRTUAL-RUNTIME_init_manager') == 'systemd': + self.logger.debug('Starting systemd-timesyncd daemon') + self.target.run('systemctl enable --now systemd-timesyncd') + + @OETestDepends(['ssh.SSHTest.test_ssh']) + @OEHasPackage(['coreutils', 'busybox']) + def test_rtc(self): + (status, output) = self.target.run('hwclock -r') + self.assertEqual(status, 0, msg='Failed to get RTC time, output: %s' % output) + + (status, current_datetime) = self.target.run('date +"%m%d%H%M%Y"') + self.assertEqual(status, 0, msg='Failed to get system current date & time, output: %s' % current_datetime) + + example_datetime = '062309452008' + (status, output) = self.target.run('date %s ; hwclock -w ; hwclock -r' % example_datetime) + check_hwclock = re.search('2008-06-23 09:45:..', output) + self.assertTrue(check_hwclock, msg='The RTC time was not set correctly, output: %s' % output) + + (status, output) = self.target.run('date %s' % current_datetime) + self.assertEqual(status, 0, msg='Failed to reset system date & time, output: %s' % output) + + (status, output) = self.target.run('hwclock -w') + self.assertEqual(status, 0, msg='Failed to reset RTC time, output: %s' % output) + |