diff options
author | Fabien Lahoudere <fabien.lahoudere@collabora.com> | 2019-11-13 18:31:55 +0100 |
---|---|---|
committer | Enric Balletbo i Serra <enric.balletbo@collabora.com> | 2019-12-06 00:08:35 +0100 |
commit | c7b56e49247098fae665ded04f4d22fadaa87c9a (patch) | |
tree | 1805e262909293e4a8c7b5a435d3331ad9e82461 | |
parent | de2c8b53827104bdad83e9bb17323d8b8aaa1bb9 (diff) | |
download | cros-ec-tests-c7b56e49247098fae665ded04f4d22fadaa87c9a.tar.gz |
test_cros_ec_usbpd_charger_abi: Test CrOS USBPD charger ABI
The scripts checks in the charger power supply 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 c29f9eb..4617b9b 100755 --- a/test-cros-ec.py +++ b/test-cros-ec.py @@ -275,6 +275,21 @@ class TestCrosEC(unittest.TestCase): if match == 0: self.skipTest("No gyroscope found, skipping") + def test_cros_ec_usbpd_charger_abi(self): + match = 0 + for devname in os.listdir("/sys/class/power_supply/"): + if devname.startswith("CROS_USBPD_CHARGER"): + files = [ "current_max", "input_current_limit", + "input_voltage_limit", "manufacturer", "model_name", + "online", "power/autosuspend_delay_ms", "status", + "type", "usb_type", "voltage_max_design", + "voltage_now"] + match += 1 + for filename in files: + self.assertEqual(os.path.exists("/sys/class/power_supply/" + devname + "/" + filename), 1) + if match == 0: + self.skipTest("No charger found, skipping") + if __name__ == '__main__': unittest.main(testRunner=LavaTestRunner(), # these make sure that some options that are not applicable |