diff --git a/selfdrive/car/toyota/tests/test_toyota.py b/selfdrive/car/toyota/tests/test_toyota.py index d9d4fe087f..6a2476dff9 100755 --- a/selfdrive/car/toyota/tests/test_toyota.py +++ b/selfdrive/car/toyota/tests/test_toyota.py @@ -13,6 +13,10 @@ Ecu = car.CarParams.Ecu ECU_NAME = {v: k for k, v in Ecu.schema.enumerants.items()} +def check_fw_version(fw_version: bytes) -> bool: + return b'?' not in fw_version + + class TestToyotaInterfaces(unittest.TestCase): def test_car_sets(self): self.assertTrue(len(ANGLE_CONTROL_CAR - TSS2_CAR) == 0) @@ -59,6 +63,14 @@ class TestToyotaFingerprint(unittest.TestCase): car_model in FW_QUERY_CONFIG.non_essential_ecus[Ecu.engine], f"Car model unexpectedly {'not ' if len(engine_ecus) > 1 else ''}in non-essential list") + def test_valid_fw_versions(self): + # Asserts all FW versions are valid + for car_model, ecus in FW_VERSIONS.items(): + with self.subTest(car_model=car_model.value): + for fws in ecus.values(): + for fw in fws: + self.assertTrue(check_fw_version(fw), fw) + # Tests for part numbers, platform codes, and sub-versions which Toyota will use to fuzzy # fingerprint in the absence of full FW matches: @settings(max_examples=100)