Commit 6f66a66e authored by Fabien Lahoudere's avatar Fabien Lahoudere Committed by Enric Balletbo i Serra
Browse files

test_cros_ec_battery_abi: Test battery ABI

The scripts checks the battery ABI that all required
files are present.
Signed-off-by: default avatarFabien Lahoudere <>
Signed-off-by: default avatarEnric Balletbo i Serra <>
parent c7b56e49
......@@ -290,6 +290,22 @@ class TestCrosEC(unittest.TestCase):
if match == 0:
self.skipTest("No charger found, skipping")
def test_cros_ec_battery_abi(self):
match = 0
for devname in os.listdir("/sys/class/power_supply/"):
if devname.startswith("BAT"):
files = [ "alarm", "capacity_level", "charge_full_design",
"current_now", "manufacturer", "serial_number",
"type", "voltage_min_design", "capacity",
"charge_full", "charge_now", "cycle_count",
"model_name", "present", "status", "technology",
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__':
# these make sure that some options that are not applicable
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment