diff --git a/selfdrive/car/tests/test_models.py b/selfdrive/car/tests/test_models.py index 6e88e227cc3abc..32dd7a45a41d8f 100755 --- a/selfdrive/car/tests/test_models.py +++ b/selfdrive/car/tests/test_models.py @@ -84,6 +84,7 @@ def setUpClass(cls): car_fw = [] can_msgs = [] fingerprint = defaultdict(dict) + CP = None for msg in lr: if msg.which() == "can": for m in msg.can: @@ -91,11 +92,12 @@ def setUpClass(cls): fingerprint[m.src][m.address] = len(m.dat) can_msgs.append(msg) elif msg.which() == "carParams": - car_fw = msg.carParams.carFw - if msg.carParams.openpilotLongitudinalControl: + CP = msg.carParams + car_fw = CP.carFw + if CP.openpilotLongitudinalControl: disable_radar = True if cls.car_model is None and not cls.ci: - cls.car_model = msg.carParams.carFingerprint + cls.car_model = CP.carFingerprint if len(can_msgs) > int(50 / DT_CTRL): break @@ -104,6 +106,11 @@ def setUpClass(cls): cls.can_msgs = sorted(can_msgs, key=lambda msg: msg.logMonoTime) + # Sets enableDsu for cars with missing carFw + # TODO: get new route for TOYOTA.LEXUS_CTH + if len(car_fw) == 0 and CP is not None and CP.enableDsu: + car_fw = [car.CarParams.CarFw(ecu=car.CarParams.Ecu.unknown)] + cls.CarInterface, cls.CarController, cls.CarState = interfaces[cls.car_model] cls.CP = cls.CarInterface.get_params(cls.car_model, fingerprint, car_fw, disable_radar) assert cls.CP