From 1bd9632156a78ae947eeaaebe96a08bd5b0cfeeb Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Wed, 19 Oct 2022 01:02:51 -0700 Subject: [PATCH] FPv2 tests: consider extra ECUs in brand ECUs (#26149) * Hyundai: add corner radar FW query * add extra ecus to brand ecus * add comment * rev * bumpo * cmt Co-authored-by: Adeeb Shihadeh --- selfdrive/car/tests/test_fw_fingerprint.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/selfdrive/car/tests/test_fw_fingerprint.py b/selfdrive/car/tests/test_fw_fingerprint.py index ed323b0563..b9926301f1 100755 --- a/selfdrive/car/tests/test_fw_fingerprint.py +++ b/selfdrive/car/tests/test_fw_fingerprint.py @@ -45,6 +45,7 @@ class TestFwFingerprint(unittest.TestCase): self.assertFalse(len(duplicates), f"{car_model}: Duplicate FW versions: Ecu.{ECU_NAME[ecu[0]]}, {duplicates}") def test_data_collection_ecus(self): + # Asserts no extra ECUs are in the fingerprinting database for brand, config in FW_QUERY_CONFIGS.items(): for car_model, ecus in VERSIONS[brand].items(): bad_ecus = set(ecus).intersection(config.extra_ecus) @@ -80,10 +81,11 @@ class TestFwFingerprint(unittest.TestCase): def test_fw_request_ecu_whitelist(self): for brand, config in FW_QUERY_CONFIGS.items(): with self.subTest(brand=brand): - whitelisted_ecus = set([ecu for r in config.requests for ecu in r.whitelist_ecus]) - brand_ecus = set([fw[0] for car_fw in VERSIONS[brand].values() for fw in car_fw]) + whitelisted_ecus = {ecu for r in config.requests for ecu in r.whitelist_ecus} + brand_ecus = {fw[0] for car_fw in VERSIONS[brand].values() for fw in car_fw} + brand_ecus |= {ecu[0] for ecu in config.extra_ecus} - # each ecu in brand's fw versions needs to be whitelisted at least once + # each ecu in brand's fw versions + extra ecus needs to be whitelisted at least once ecus_not_whitelisted = brand_ecus - whitelisted_ecus ecu_strings = ", ".join([f'Ecu.{ECU_NAME[ecu]}' for ecu in ecus_not_whitelisted])