summaryrefslogtreecommitdiff
path: root/test-cli/test/tests/qrtc.py
diff options
context:
space:
mode:
authorManel Caro <mcaro@iseebcn.com>2019-03-09 21:25:56 +0100
committerManel Caro <mcaro@iseebcn.com>2019-03-09 21:25:56 +0100
commit9332c933fc05f42882640c9a4e35fab09854af84 (patch)
tree2b9b00b5a411b27f9705603c0d93b8925afd4677 /test-cli/test/tests/qrtc.py
downloadboard-9332c933fc05f42882640c9a4e35fab09854af84.zip
board-9332c933fc05f42882640c9a4e35fab09854af84.tar.gz
board-9332c933fc05f42882640c9a4e35fab09854af84.tar.bz2
Board: Client Test Suite Initial Commit
Diffstat (limited to 'test-cli/test/tests/qrtc.py')
-rw-r--r--test-cli/test/tests/qrtc.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/test-cli/test/tests/qrtc.py b/test-cli/test/tests/qrtc.py
new file mode 100644
index 0000000..1d02f78
--- /dev/null
+++ b/test-cli/test/tests/qrtc.py
@@ -0,0 +1,28 @@
+from test.helpers.syscmd import SysCommand
+import unittest
+import time
+
+class Qrtc(unittest.TestCase):
+
+ def __init__(self, testname, testfunc, rtc):
+ super(Qrtc, self).__init__(testfunc)
+ self.__rtc = rtc
+ self._testMethodDoc = testname
+
+ def execute(self):
+ str_cmd = "hwclock -f {}".format(self.__rtc)
+ rtc_set = SysCommand("rtc_set", str_cmd)
+ if rtc_set.execute() == 0:
+ curr_hour = rtc_set.getOutput().decode('ascii').split(" ")
+ time1 = int((curr_hour[4].split(":"))[2])
+ time.sleep(1)
+ if rtc_set.execute() == 0:
+ curr_hour = rtc_set.getOutput().decode('ascii').split(" ")
+ time2 = int((curr_hour[4].split(":"))[2])
+ if time1==time2:
+ self.fail("failed: RTC is not running")
+ else:
+ self.fail("failed: couldn't execute hwclock command 2nd time")
+ else:
+ self.fail("failed: couldn't execute hwclock command")
+