aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabien Lahoudere <fabien.lahoudere@collabora.com>2019-11-08 16:12:10 +0100
committerEnric Balletbo i Serra <enric.balletbo@collabora.com>2019-12-06 00:08:35 +0100
commitde2c8b53827104bdad83e9bb17323d8b8aaa1bb9 (patch)
treedf846d1b5ae5d53415b1d21f5095de20a4b32e84
parent9b82032363b4a839d3c1e17a1f8cf601de83d929 (diff)
downloadcros-ec-tests-de2c8b53827104bdad83e9bb17323d8b8aaa1bb9.tar.gz
test_cros_ec_gyro_iio_abi: Test gyrsocope ABI
The scripts checks the IIO gyroscope 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-xtest-cros-ec.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/test-cros-ec.py b/test-cros-ec.py
index a1d418a..c29f9eb 100755
--- a/test-cros-ec.py
+++ b/test-cros-ec.py
@@ -253,6 +253,28 @@ class TestCrosEC(unittest.TestCase):
if match == 0:
self.skipTest("No accelerometer found, skipping")
+ def test_cros_ec_gyro_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-gyro"):
+ files = [ "buffer/", "calibrate", "current_timestamp_clock",
+ "frequency", "id", "in_anglvel_x_calibbias",
+ "in_anglvel_x_calibscale", "in_anglvel_x_raw",
+ "in_anglvel_y_calibbias", "in_anglvel_y_calibscale",
+ "in_anglvel_y_raw", "in_anglvel_z_calibbias",
+ "in_anglvel_z_calibscale", "in_anglvel_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 gyroscope found, skipping")
+
if __name__ == '__main__':
unittest.main(testRunner=LavaTestRunner(),
# these make sure that some options that are not applicable