enable old test

pull/28641/head
Shane Smiskol 2 years ago
parent 99da735104
commit 16aef10003
  1. 68
      selfdrive/car/toyota/tests/test_toyota.py

@ -53,19 +53,6 @@ class TestToyotaFingerprint(unittest.TestCase):
fws = data.draw(fw_strategy) fws = data.draw(fw_strategy)
get_platform_codes(fws) get_platform_codes(fws)
def test_fw_pattern_new(self):
"""Asserts all ECUs can be parsed"""
for car_model, ecus in FW_VERSIONS.items():
for ecu, fws in ecus.items():
for fw in fws:
if ecu[0] not in PLATFORM_CODE_ECUS:
continue
print('\ninput', car_model, fw)
ret = get_platform_codes([fw])
self.assertTrue(len(ret))
print('ret', ret)
def test_platform_code_ecus_available(self): def test_platform_code_ecus_available(self):
# Asserts ECU keys essential for fuzzy fingerprinting are available on all platforms # Asserts ECU keys essential for fuzzy fingerprinting are available on all platforms
for car_model, ecus in FW_VERSIONS.items(): for car_model, ecus in FW_VERSIONS.items():
@ -80,36 +67,31 @@ class TestToyotaFingerprint(unittest.TestCase):
continue continue
self.assertIn(platform_code_ecu, [e[0] for e in ecus]) self.assertIn(platform_code_ecu, [e[0] for e in ecus])
# def test_fw_format(self): def test_fw_format(self):
# # Asserts: # Asserts:
# # - every supported ECU FW version returns one platform code # - every supported ECU FW version returns one platform code
# # - every supported ECU FW version has a part number # - every supported ECU FW version has a part number
# # - expected parsing of ECU FW dates # - expected parsing of ECU sub-versions
#
# for car_model, ecus in FW_VERSIONS.items(): for car_model, ecus in FW_VERSIONS.items():
# with self.subTest(car_model=car_model): with self.subTest(car_model=car_model):
# for ecu, fws in ecus.items(): for ecu, fws in ecus.items():
# if ecu[0] not in PLATFORM_CODE_ECUS: if ecu[0] not in PLATFORM_CODE_ECUS:
# continue continue
#
# codes = set() codes = dict()
# for fw in fws: for fw in fws:
# result = get_platform_codes([fw]) result = get_platform_codes([fw])
# self.assertEqual(1, len(result), f"Unable to parse FW: {fw}") # Check only one platform code and sub-version
# codes |= result self.assertEqual(1, len(result), f"Unable to parse FW: {fw}")
# self.assertEqual(1, len(list(result.values())[0]), f"Unable to parse FW: {fw}")
# if ecu[0] not in DATE_FW_ECUS or car_model in NO_DATES_PLATFORMS: codes |= result
# self.assertTrue(all({date is None for _, date in codes}))
# else: # Toyota places the ECU part number in their FW versions, assert all parsable
# self.assertTrue(all({date is not None for _, date in codes})) # Note that there is only one unique part number per ECU across the fleet, so this
# # is not important for identification, just a sanity check.
# if car_model == CAR.HYUNDAI_GENESIS: self.assertTrue(all({code.count(b"-") > 1 for code in codes}),
# raise unittest.SkipTest("No part numbers for car model") f"FW does not have part number: {fw} {codes}")
#
# # Hyundai places the ECU part number in their FW versions, assert all parsable
# # Some examples of valid formats: b"56310-L0010", b"56310L0010", b"56310/M6300"
# self.assertTrue(all({b"-" in code for code, _ in codes}),
# f"FW does not have part number: {fw}")
def test_platform_codes_spot_check(self): def test_platform_codes_spot_check(self):
# Asserts basic platform code parsing behavior for a few cases # Asserts basic platform code parsing behavior for a few cases

Loading…
Cancel
Save