abs and engine are very rarely shared (avalonh tss2 and camryh tss2 is one example)

pull/28641/head
Shane Smiskol 2 years ago
parent 78f812bf43
commit f5ddccab1e
  1. 57
      selfdrive/car/toyota/tests/test_toyota.py

@ -1,5 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import unittest import unittest
from collections import defaultdict
from cereal import car from cereal import car
from selfdrive.car.fw_versions import build_fw_dict from selfdrive.car.fw_versions import build_fw_dict
@ -42,25 +43,57 @@ class TestToyotaInterfaces(unittest.TestCase):
class TestToyotaFingerprint(unittest.TestCase): class TestToyotaFingerprint(unittest.TestCase):
def test_fw_debugging(self): # def test_fw_debugging(self):
# for car_model, ecus in FW_VERSIONS.items():
# print()
# print(car_model)
# cam_len_code = False
# eng_len_code = False
#
# for ecu, fws in ecus.items():
# if ecu[0] in (Ecu.fwdRadar, Ecu.fwdCamera):
# cam_len_code |= all(f[0] < 4 for f in fws)
# if ecu[0] in (Ecu.engine, Ecu.abs):
# eng_len_code |= all(1 < f[0] < 4 for f in fws)
# print(ecu, eng_len_code)
#
# if (car_model in TSS2_CAR) != cam_len_code:
# print(car_model, car_model in TSS2_CAR, cam_len_code)
#
# if (car_model in EV_HYBRID_CAR) != eng_len_code:
# print('MISMATCH', car_model, car_model in EV_HYBRID_CAR, eng_len_code)
def test_shared_fw(self):
all_fw = defaultdict(set)
for car_model, ecus in FW_VERSIONS.items():
print()
print(car_model)
for ecu, fws in ecus.items():
for fw in fws:
all_fw[(ecu[1], fw)].add(car_model)
print(all_fw)
# shared abs (or whatever is in the continue statement)
shared = defaultdict(set)
for car_model, ecus in FW_VERSIONS.items(): for car_model, ecus in FW_VERSIONS.items():
print() print()
print(car_model) print(car_model)
cam_len_code = False
eng_len_code = False
for ecu, fws in ecus.items(): for ecu, fws in ecus.items():
if ecu[0] in (Ecu.fwdRadar, Ecu.fwdCamera): if ecu[0] != Ecu.abs:
cam_len_code |= all(f[0] < 4 for f in fws) continue
if ecu[0] in (Ecu.engine, Ecu.abs): for fw in fws:
eng_len_code |= all(1 < f[0] < 4 for f in fws) if len(all_fw[ecu[1], fw]) > 1:
print(ecu, eng_len_code) shared[car_model] |= all_fw[ecu[1], fw]
# print(car_model, all_fw[ecu[1], fw])
# # all_fw[(ecu[1], fw)].add(car_model)
if (car_model in TSS2_CAR) != cam_len_code: print(shared)
print(car_model, car_model in TSS2_CAR, cam_len_code) print(len(shared))
if (car_model in EV_HYBRID_CAR) != eng_len_code:
print('MISMATCH', car_model, car_model in EV_HYBRID_CAR, eng_len_code)
# Tests for platform codes, part numbers, and FW dates which Hyundai will use to fuzzy # Tests for platform codes, part numbers, and FW dates which Hyundai will use to fuzzy
# fingerprint in the absence of full FW matches: # fingerprint in the absence of full FW matches:

Loading…
Cancel
Save