test_cros_ec_battery_cutoff_at_shutdown: Check if EC_FEATURE_BATTERY is supported for cutoff tests

The cutoff tests should only run if the EC_FEATURE_BATTERY is supported
by the Embedded Controller. Also assert the sysfs ile exists.
Signed-off-by: default avatarEnric Balletbo i Serra <enric.balletbo@collabora.com>
parent 22a70bd6
......@@ -200,7 +200,11 @@ class TestCrosEC(unittest.TestCase):
# EC_FEATURE_BATTERY: Battery cutoff at-shutdown
def test_cros_ec_battery_cutoff_at_shutdown(self):
self.skipTest("demonstrating skipping")
if not is_feature_supported(EC_FEATURE_BATTERY):
self.skipTest("EC_FEATURE_BATTERY not supported, skipping")
self.assertEqual(os.path.exists("/sys/class/chromeos/cros_ec/" + "battery_cutoff"), 1)
fd = open("/sys/class/chromeos/cros_ec/" + "battery_cutoff", 'w')
fd.write("at-shutdown")
fd.close()
......
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