|
|
|
@ -35,16 +35,28 @@ class TestFwFingerprint(unittest.TestCase): |
|
|
|
|
|
|
|
|
|
@parameterized.expand([(b, c, e[c]) for b, e in VERSIONS.items() for c in e]) |
|
|
|
|
def test_exact_match(self, brand, car_model, ecus): |
|
|
|
|
print() |
|
|
|
|
print(brand, car_model) |
|
|
|
|
config = FW_QUERY_CONFIGS[brand] |
|
|
|
|
CP = car.CarParams.new_message() |
|
|
|
|
for _ in range(200): |
|
|
|
|
fw = [] |
|
|
|
|
for ecu, fw_versions in ecus.items(): |
|
|
|
|
print(ecu) |
|
|
|
|
# if car_model in config.non_essential_ecus.get(ecu[0], []): |
|
|
|
|
if ecu[0] in config.non_essential_ecus: |
|
|
|
|
print('continue') |
|
|
|
|
continue |
|
|
|
|
ecu_name, addr, sub_addr = ecu |
|
|
|
|
fw.append({"ecu": ecu_name, "fwVersion": random.choice(fw_versions), 'brand': brand, |
|
|
|
|
"address": addr, "subAddress": 0 if sub_addr is None else sub_addr}) |
|
|
|
|
CP.carFw = fw |
|
|
|
|
print(CP.carFw) |
|
|
|
|
_, matches = match_fw_to_car(CP.carFw, allow_fuzzy=False) |
|
|
|
|
assert len(matches) < 2 |
|
|
|
|
if len(matches) == 1: |
|
|
|
|
self.assertFingerprints(matches, car_model) |
|
|
|
|
# self.assertFingerprints(matches, car_model) |
|
|
|
|
|
|
|
|
|
@parameterized.expand([(b, c, e[c]) for b, e in VERSIONS.items() for c in e]) |
|
|
|
|
def test_custom_fuzzy_match(self, brand, car_model, ecus): |
|
|
|
|