From b1ecfd55ce73062f297a5ea7d99d0c55d57c58ab Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Mon, 11 Dec 2023 22:12:21 -0800 Subject: [PATCH] Revert "FW query timing test: mock get_data function for timeout" (#30696) Revert "FW query timing test: mock get_data function for timeout (#29712)" This reverts commit 4028cb6121ffd1f92463cfc109593b17abe3aa8c. --- selfdrive/car/tests/test_fw_fingerprint.py | 24 ++++++++-------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/selfdrive/car/tests/test_fw_fingerprint.py b/selfdrive/car/tests/test_fw_fingerprint.py index d4cd6315f2..5721896787 100755 --- a/selfdrive/car/tests/test_fw_fingerprint.py +++ b/selfdrive/car/tests/test_fw_fingerprint.py @@ -5,7 +5,6 @@ import time import unittest from collections import defaultdict from parameterized import parameterized -from unittest import mock import threading from cereal import car @@ -177,7 +176,7 @@ class TestFwFingerprint(unittest.TestCase): class TestFwFingerprintTiming(unittest.TestCase): N: int = 5 - TOL: float = 0.1 + TOL: float = 0.12 @staticmethod def _run_thread(thread: threading.Thread) -> float: @@ -192,19 +191,12 @@ class TestFwFingerprintTiming(unittest.TestCase): return time.perf_counter() - t def _benchmark_brand(self, brand, num_pandas): - def fake_get_data(_, timeout): - nonlocal fake_timeout_time - fake_timeout_time += timeout - return {} - - with mock.patch("openpilot.selfdrive.car.isotp_parallel_query.IsoTpParallelQuery.get_data", fake_get_data): - fake_socket = FakeSocket() - brand_time = 0 - for _ in range(self.N): - fake_timeout_time = 0 - thread = threading.Thread(target=get_fw_versions, args=(fake_socket, fake_socket, brand), - kwargs=dict(num_pandas=num_pandas)) - brand_time += self._run_thread(thread) + fake_timeout_time + fake_socket = FakeSocket() + brand_time = 0 + for _ in range(self.N): + thread = threading.Thread(target=get_fw_versions, args=(fake_socket, fake_socket, brand), + kwargs=dict(num_pandas=num_pandas)) + brand_time += self._run_thread(thread) return brand_time / self.N @@ -235,7 +227,7 @@ class TestFwFingerprintTiming(unittest.TestCase): @pytest.mark.timeout(60) def test_fw_query_timing(self): - total_ref_time = 6.58 + total_ref_time = 6.41 brand_ref_times = { 1: { 'body': 0.11,