aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabien Lahoudere <fabien.lahoudere@collabora.com>2019-12-12 13:28:51 +0100
committerEnric Balletbo i Serra <enric.balletbo@collabora.com>2019-12-23 17:13:53 +0100
commitef8c029e6b733a9928a2784a7daa9f1df3f07d32 (patch)
tree58a3f16c5b8f7ee7e81e4bfc73cb2d4276f02483
parent77716af394075db088f1a21b4b182f1aaa481133 (diff)
downloadcros-ec-tests-ef8c029e6b733a9928a2784a7daa9f1df3f07d32.tar.gz
cros_ec_extcon: Check also the cable API
The test was buggy and only checked the device name and state. Now, we also check all the cable names and states. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
-rw-r--r--tests/cros_ec_extcon.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/tests/cros_ec_extcon.py b/tests/cros_ec_extcon.py
index 073471f..f68c4c9 100644
--- a/tests/cros_ec_extcon.py
+++ b/tests/cros_ec_extcon.py
@@ -15,12 +15,19 @@ class TestCrosECextcon(unittest.TestCase):
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 cable.startswith("cable"):
+ self.assertEqual(
+ os.path.exists(
+ "/sys/class/extcon/" + devname + "/" + cable + "/name"
+ ),
+ 1,
+ )
+ self.assertEqual(
+ os.path.exists(
+ "/sys/class/extcon/" + devname + "/" + cable + "/state"
+ ),
+ 1,
+ )
+ match += 1
if match == 0:
self.skipTest("No extcon device found, skipping")