FW query timing test: fix total reference time (#31344)

* We never had any bus 0 logging queries for CAN!

* should be logging

* try all, and try on can fd as well

* update refs

* oof forgot about hda2 can fd where pt is bus 1

* sheesh

* fix the timing

* not here

* revert

* this just simply measured the total time of all the brands with aux queries (1.25s)

* clean up
pull/31334/head
Shane Smiskol 2 years ago committed by GitHub
parent a07259d765
commit 4ec0ed311c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 27
      selfdrive/car/tests/test_fw_fingerprint.py

@ -254,7 +254,7 @@ class TestFwFingerprintTiming(unittest.TestCase):
@pytest.mark.timeout(60)
def test_fw_query_timing(self):
total_ref_time = 6.8
total_ref_time = {1: 5.55, 2: 6.05}
brand_ref_times = {
1: {
'gm': 0.5,
@ -276,24 +276,27 @@ class TestFwFingerprintTiming(unittest.TestCase):
}
}
total_time = 0
total_times = {1: 0.0, 2: 0.0}
for num_pandas in (1, 2):
for brand, config in FW_QUERY_CONFIGS.items():
with self.subTest(brand=brand, num_pandas=num_pandas):
multi_panda_requests = [r for r in config.requests if r.bus > 3]
if not len(multi_panda_requests) and num_pandas > 1:
raise unittest.SkipTest("No multi-panda FW queries")
avg_time = self._benchmark_brand(brand, num_pandas)
total_time += avg_time
total_times[num_pandas] += avg_time
avg_time = round(avg_time, 2)
self._assert_timing(avg_time, brand_ref_times[num_pandas][brand])
ref_time = brand_ref_times[num_pandas].get(brand)
if ref_time is None:
# ref time should be same as 1 panda if no aux queries
ref_time = brand_ref_times[num_pandas - 1][brand]
self._assert_timing(avg_time, ref_time)
print(f'{brand=}, {num_pandas=}, {len(config.requests)=}, avg FW query time={avg_time} seconds')
with self.subTest(brand='all_brands'):
total_time = round(total_time, 2)
self._assert_timing(total_time, total_ref_time)
print(f'all brands, total FW query time={total_time} seconds')
for num_pandas in (1, 2):
with self.subTest(brand='all_brands', num_pandas=num_pandas):
total_time = round(total_times[num_pandas], 2)
self._assert_timing(total_time, total_ref_time[num_pandas])
print(f'all brands, total FW query time={total_time} seconds')
if __name__ == "__main__":

Loading…
Cancel
Save