mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-21 14:02:05 +08:00
test for duplicate ECU firmware versions
This commit is contained in:
@@ -203,7 +203,6 @@ FW_VERSIONS = {
|
||||
b'78209-TVA-A010\x00\x00',
|
||||
],
|
||||
(Ecu.fwdRadar, 0x18dab0f1, None): [
|
||||
b'36802-TVA-A160\x00\x00',
|
||||
b'36802-TVA-A160\x00\x00',
|
||||
b'36802-TVA-A170\x00\x00',
|
||||
b'36802-TWA-A070\x00\x00',
|
||||
@@ -744,7 +743,6 @@ FW_VERSIONS = {
|
||||
b'78109-THR-A820\x00\x00',
|
||||
b'78109-THR-A830\x00\x00',
|
||||
b'78109-THR-AB20\x00\x00',
|
||||
b'78109-THR-AB20\x00\x00',
|
||||
b'78109-THR-AB30\x00\x00',
|
||||
b'78109-THR-AB40\x00\x00',
|
||||
b'78109-THR-AC40\x00\x00',
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
#!/usr/bin/env python3
|
||||
import unittest
|
||||
from cereal import car
|
||||
from selfdrive.car.fingerprints import FW_VERSIONS
|
||||
from selfdrive.car.fw_versions import match_fw_to_car
|
||||
from selfdrive.car.toyota.values import CAR as TOYOTA
|
||||
|
||||
CarFw = car.CarParams.CarFw
|
||||
Ecu = car.CarParams.Ecu
|
||||
|
||||
ECU_NAME = {v: k for k, v in Ecu.schema.enumerants.items()}
|
||||
|
||||
class TestFwFingerprint(unittest.TestCase):
|
||||
def assertFingerprints(self, candidates, expected):
|
||||
@@ -41,6 +43,16 @@ class TestFwFingerprint(unittest.TestCase):
|
||||
|
||||
self.assertFingerprints(match_fw_to_car(CP.carFw), TOYOTA.RAV4_TSS2)
|
||||
|
||||
def test_no_duplicate_fw_versions(self):
|
||||
passed = True
|
||||
for car_name, ecus in FW_VERSIONS.items():
|
||||
for ecu, ecu_fw in ecus.items():
|
||||
duplicates = set([fw for fw in ecu_fw if ecu_fw.count(fw) > 1])
|
||||
if len(duplicates):
|
||||
print(car_name, ECU_NAME[ecu[0]], duplicates)
|
||||
passed = False
|
||||
|
||||
self.assertTrue(passed, "Duplicate FW versions found")
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user