Toyota: essential ECU test (#28737)

* bump cereal

* more queries (to see the new time)

* fix

* not sure what i want this to do yet

not sure what i want this to do yet

* no body

* no body

* add test

* spacing

* revert

* check len

* static fix

* shorter cmt
pull/28673/head
Shane Smiskol 2 years ago committed by GitHub
parent 1b98fea696
commit 3b8aec4b06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 28
      selfdrive/car/toyota/tests/test_toyota.py

@ -1,7 +1,10 @@
#!/usr/bin/env python3
from cereal import car
import unittest
from selfdrive.car.toyota.values import DBC, TSS2_CAR, ANGLE_CONTROL_CAR
from selfdrive.car.toyota.values import CAR, DBC, TSS2_CAR, ANGLE_CONTROL_CAR, FW_VERSIONS
Ecu = car.CarParams.Ecu
class TestToyotaInterfaces(unittest.TestCase):
@ -11,10 +14,29 @@ class TestToyotaInterfaces(unittest.TestCase):
def test_tss2_dbc(self):
# We make some assumptions about TSS2 platforms,
# like looking up certain signals only in this DBC
for car, dbc in DBC.items():
if car in TSS2_CAR:
for car_model, dbc in DBC.items():
if car_model in TSS2_CAR:
self.assertEqual(dbc["pt"], "toyota_nodsu_pt_generated")
def test_essential_ecus(self):
# Asserts standard ECUs exist for each platform
common_ecus = {Ecu.fwdRadar, Ecu.fwdCamera}
for car_model, ecus in FW_VERSIONS.items():
with self.subTest(car_model=car_model):
present_ecus = {ecu[0] for ecu in ecus}
missing_ecus = common_ecus - present_ecus
self.assertEqual(len(missing_ecus), 0)
# Some exceptions for other common ECUs
if car_model not in (CAR.ALPHARD_TSS2,):
self.assertIn(Ecu.abs, present_ecus)
if car_model not in (CAR.MIRAI,):
self.assertIn(Ecu.engine, present_ecus)
if car_model not in (CAR.PRIUS_V, CAR.LEXUS_CTH):
self.assertIn(Ecu.eps, present_ecus)
if __name__ == "__main__":
unittest.main()

Loading…
Cancel
Save