diff options
author | Fabien Lahoudere <fabien.lahoudere@collabora.com> | 2019-11-08 13:38:52 +0100 |
---|---|---|
committer | Enric Balletbo i Serra <enric.balletbo@collabora.com> | 2019-12-06 00:08:35 +0100 |
commit | 9b82032363b4a839d3c1e17a1f8cf601de83d929 (patch) | |
tree | a6fe21b2d59bae4b256e67ff780930438848f094 | |
parent | 63a653a1cc246309f41f2e3fa2ea8c99768efa54 (diff) | |
download | cros-ec-tests-9b82032363b4a839d3c1e17a1f8cf601de83d929.tar.gz |
test_cros_ec_accel_iio_abi: Test the CrOS EC accelerometer ABI
The scripts checks the IIO accelerometer ABI by verifying
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 | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test-cros-ec.py b/test-cros-ec.py index 25865a5..a1d418a 100755 --- a/test-cros-ec.py +++ b/test-cros-ec.py @@ -231,6 +231,28 @@ class TestCrosEC(unittest.TestCase): fd.close() self.assertEqual(cm.exception.error_code, 22) + def test_cros_ec_accel_iio_abi(self): + match = 0 + for devname in os.listdir("/sys/bus/iio/devices"): + fd = open("/sys/bus/iio/devices/" + devname + "/name", 'r') + devtype = fd.read() + if devtype.startswith("cros-ec-accel"): + files = [ "buffer", "calibrate", "current_timestamp_clock", + "frequency", "id", "in_accel_x_calibbias", + "in_accel_x_calibscale", "in_accel_x_raw", + "in_accel_y_calibbias", "in_accel_y_calibscale", + "in_accel_y_raw", "in_accel_z_calibbias", + "in_accel_z_calibscale", "in_accel_z_raw", + "location", "sampling_frequency", + "sampling_frequency_available", "scale", + "scan_elements/", "trigger/"] + match += 1 + for filename in files: + self.assertEqual(os.path.exists("/sys/bus/iio/devices/" + devname + "/" + filename), 1) + fd.close() + if match == 0: + self.skipTest("No accelerometer found, skipping") + if __name__ == '__main__': unittest.main(testRunner=LavaTestRunner(), # these make sure that some options that are not applicable |