diff options
author | Fabien Lahoudere <fabien.lahoudere@collabora.com> | 2019-11-13 17:45:57 +0100 |
---|---|---|
committer | Enric Balletbo i Serra <enric.balletbo@collabora.com> | 2019-12-06 00:08:35 +0100 |
commit | 477efc906da237a1479c94bc7e6c154fb049ff4e (patch) | |
tree | cb6f05f3188a5e99ce19a85a419600180105c83c | |
parent | 6f66a66e399defbcdd11175a3d92e7957e25ea16 (diff) | |
download | cros-ec-tests-477efc906da237a1479c94bc7e6c154fb049ff4e.tar.gz |
test_cros_ec_extcon_usbc: Test extcon usbc ABI
The scripts checks the extcon usbc 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-x | test-cros-ec.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test-cros-ec.py b/test-cros-ec.py index b226c1d..c6a31ab 100755 --- a/test-cros-ec.py +++ b/test-cros-ec.py @@ -306,6 +306,21 @@ class TestCrosEC(unittest.TestCase): if match == 0: self.skipTest("No charger found, skipping") + def test_cros_ec_extcon_usbc_abi(self): + match = 0 + for devname in os.listdir("/sys/class/extcon"): + fd = open("/sys/class/extcon/" + devname + "/name", 'r') + devtype = fd.read() + fd.close() + if ".spi:ec@0:extcon@" in devtype: + self.assertEqual(os.path.exists("/sys/class/extcon/" + devname + "/state"), 1) + for cable in os.listdir("/sys/class/extcon/" + devname): + self.assertEqual(os.path.exists("/sys/class/extcon/" + devname + "/name"), 1) + self.assertEqual(os.path.exists("/sys/class/extcon/" + devname + "/state"), 1) + match += 1 + if match == 0: + self.skipTest("No extcon device found, skipping") + if __name__ == '__main__': unittest.main(testRunner=LavaTestRunner(), # these make sure that some options that are not applicable |