From 4e52b8ad8161d37a06371145b1ac7b8d4001bdbf Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Wed, 7 Jun 2023 20:51:22 -0700 Subject: [PATCH] adapt fuzzy test recently added (nice it caught this!) --- selfdrive/car/tests/test_fw_fingerprint.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/tests/test_fw_fingerprint.py b/selfdrive/car/tests/test_fw_fingerprint.py index f89595198b..41893813f3 100755 --- a/selfdrive/car/tests/test_fw_fingerprint.py +++ b/selfdrive/car/tests/test_fw_fingerprint.py @@ -10,7 +10,8 @@ from cereal import car from common.params import Params from selfdrive.car.car_helpers import interfaces from selfdrive.car.fingerprints import FW_VERSIONS -from selfdrive.car.fw_versions import FW_QUERY_CONFIGS, FUZZY_EXCLUDE_ECUS, VERSIONS, match_fw_to_car, get_fw_versions +from selfdrive.car.fw_versions import FW_QUERY_CONFIGS, FUZZY_EXCLUDE_ECUS, MODEL_TO_BRAND, VERSIONS, \ + match_fw_to_car, get_fw_versions CarFw = car.CarParams.CarFw Ecu = car.CarParams.Ecu @@ -53,6 +54,7 @@ class TestFwFingerprint(unittest.TestCase): raise unittest.SkipTest("Car model has no compatible ECUs for fuzzy matching") fw = [] + config = FW_QUERY_CONFIGS[MODEL_TO_BRAND[car_model]] for ecu in valid_ecus: ecu_name, addr, sub_addr = ecu for _ in range(5): @@ -64,7 +66,7 @@ class TestFwFingerprint(unittest.TestCase): # Assert no match if there are not enough unique ECUs unique_ecus = {(f['address'], f['subAddress']) for f in fw} - if len(unique_ecus) < 2: + if len(unique_ecus) < config.fuzzy_min_match_count: self.assertEqual(len(matches), 0, car_model) # There won't always be a match due to shared FW, but if there is it should be correct elif len(matches):