aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabien Lahoudere <fabien.lahoudere@collabora.com>2019-11-20 12:12:55 +0100
committerEnric Balletbo i Serra <enric.balletbo@collabora.com>2019-12-06 00:08:35 +0100
commit8f502f83ca7be85c080e631f2f24b328ee190b66 (patch)
tree00724bfa035c17f3811930bc390c26cce77037e1
parent477efc906da237a1479c94bc7e6c154fb049ff4e (diff)
downloadcros-ec-tests-8f502f83ca7be85c080e631f2f24b328ee190b66.tar.gz
test_cros_ec_rtc_abi: Test RTC ABI
The script checks the RTC ABI that all required files are present. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
-rwxr-xr-xtest-cros-ec.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/test-cros-ec.py b/test-cros-ec.py
index c6a31ab..78eaa1d 100755
--- a/test-cros-ec.py
+++ b/test-cros-ec.py
@@ -321,6 +321,22 @@ class TestCrosEC(unittest.TestCase):
if match == 0:
self.skipTest("No extcon device found, skipping")
+ def test_cros_ec_rtc_abi(self):
+ if not is_feature_supported(EC_FEATURE_RTC):
+ self.skipTest("EC_FEATURE_RTC not supported, skipping")
+ match = 0
+ for devname in os.listdir("/sys/class/rtc"):
+ fd = open("/sys/class/rtc/" + devname + "/name", 'r')
+ devtype = fd.read()
+ fd.close()
+ if devtype.startswith("cros-ec-rtc"):
+ files = [ "date", "hctosys", "max_user_freq", "since_epoch",
+ "time", "wakealarm" ]
+ match += 1
+ for filename in files:
+ self.assertEqual(os.path.exists("/sys/class/rtc/" + devname + "/" + filename), 1)
+ self.assertNotEqual(match,0)
+
if __name__ == '__main__':
unittest.main(testRunner=LavaTestRunner(),
# these make sure that some options that are not applicable