Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a23ee67 authored by Pavel Maltsev's avatar Pavel Maltsev Committed by Keun Soo Yim
Browse files

Add VTS case for mandatory props in Vehicle HAL

Bug: b/33581262

Test: this is VTS test.
Change-Id: I71eae5dec0af3dc461698a147870d4c8fc7de7f4
parent 879cd899
Loading
Loading
Loading
Loading
+26 −6
Original line number Diff line number Diff line
@@ -47,8 +47,14 @@ class VehicleHidlTest(base_test_with_webdb.BaseTestWithWebDbClass):
            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
        """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:
@@ -58,12 +64,26 @@ class VehicleHidlTest(base_test_with_webdb.BaseTestWithWebDbClass):
            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()