Add VTS case for mandatory props in Vehicle HAL
Bug: b/33581262
Test: this is VTS test.
Change-Id: I71eae5dec0af3dc461698a147870d4c8fc7de7f4
diff --git a/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/host/VehicleHidlTest.py b/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/host/VehicleHidlTest.py
index e17c72d..715cba8 100644
--- a/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/host/VehicleHidlTest.py
+++ b/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/host/VehicleHidlTest.py
@@ -47,9 +47,15 @@
hw_binder_service_name="Vehicle",
bits=64 if self.dut.is64Bit else 32)
+ self.vehicle = self.dut.hal.vehicle # shortcut
+ self.vtypes = self.dut.hal.vehicle.GetHidlTypeInterface("types")
+ logging.info("vehicle types: %s", self.vtypes)
+
def tearDownClass(self):
- """ If profiling is enabled for the test, collect the profiling data
- and disable profiling after the test is done.
+ """Disables the profiling.
+
+ If profiling is enabled for the test, collect the profiling data
+ and disable profiling after the test is done.
"""
if self.enable_profiling:
profiling_trace_path = getattr(
@@ -58,12 +64,26 @@
profiling_utils.DisableVTSProfiling(self.dut.shell.one)
def testListProperties(self):
- logging.info("vehicle_types")
- vehicle_types = self.dut.hal.vehicle.GetHidlTypeInterface("types")
- logging.info("vehicle_types: %s", vehicle_types)
+ """Checks whether some PropConfigs are returned.
- allConfigs = self.dut.hal.vehicle.getAllPropConfigs()
+ Verifies that call to getAllPropConfigs is not failing and
+ it returns at least 1 vehicle property config.
+ """
+ allConfigs = self.vehicle.getAllPropConfigs()
logging.info("all supported properties: %s", allConfigs)
+ asserts.assertLess(0, len(allConfigs))
+
+ def testMandatoryProperties(self):
+ """Verifies that all mandatory properties are supported."""
+ mandatoryProps = set([self.vtypes.DRIVING_STATUS]) # 1 property so far
+ logging.info(self.vtypes.DRIVING_STATUS)
+ allConfigs = self.dut.hal.vehicle.getAllPropConfigs()
+
+ for config in allConfigs:
+ mandatoryProps.discard(config['prop'])
+
+ asserts.assertEqual(0, len(mandatoryProps))
+
if __name__ == "__main__":
test_runner.main()