diff options
author | Enric Balletbo i Serra <enric.balletbo@collabora.com> | 2019-10-24 12:17:25 +0200 |
---|---|---|
committer | Enric Balletbo i Serra <enric.balletbo@collabora.com> | 2019-12-06 00:08:26 +0100 |
commit | 63a653a1cc246309f41f2e3fa2ea8c99768efa54 (patch) | |
tree | f90f84f614fdaf389750585c63d26eedb2e8dc84 | |
parent | 22a70bd6a1116a6edccd1a53b24aa5120ecfbce5 (diff) | |
download | cros-ec-tests-63a653a1cc246309f41f2e3fa2ea8c99768efa54.tar.gz |
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: Enric Balletbo i Serra <enric.balletbo@collabora.com>
-rwxr-xr-x | test-cros-ec.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/test-cros-ec.py b/test-cros-ec.py index 900bb9c..25865a5 100755 --- a/test-cros-ec.py +++ b/test-cros-ec.py @@ -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() |