From e0be4a1f851cf1f3b39bdf4a488ce1f05f58aa1c Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Fri, 6 Sep 2024 07:24:25 +0800 Subject: [PATCH] ci: eliminate unnecessary sleep to shorten UI report run time (#33462) reduce sleep --- selfdrive/ui/tests/test_ui/run.py | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/selfdrive/ui/tests/test_ui/run.py b/selfdrive/ui/tests/test_ui/run.py index 1a075b3c44f2a1..c8b14dad95ae42 100644 --- a/selfdrive/ui/tests/test_ui/run.py +++ b/selfdrive/ui/tests/test_ui/run.py @@ -34,34 +34,24 @@ "liveCalibration", "modelV2", "radarState", "driverMonitoringState", "carState", "driverStateV2", "roadCameraState", "wideRoadCameraState", "driverCameraState"], None) -def setup_common(click, pm: PubMaster): - Params().put("DongleId", "123456789012345") - pm.send('deviceState', DATA['deviceState']) - def setup_homescreen(click, pm: PubMaster): - setup_common(click, pm) + pass def setup_settings_device(click, pm: PubMaster): - setup_common(click, pm) - click(100, 100) def setup_onroad(click, pm: PubMaster): - setup_common(click, pm) - vipc_server = VisionIpcServer("camerad") for stream_type, cam, _ in STREAMS: vipc_server.create_buffers(stream_type, 5, False, cam.width, cam.height) vipc_server.start_listener() - packet_id = 0 - for _ in range(20): + for packet_id in range(20): for service, data in DATA.items(): if data: data.clear_write_flag() pm.send(service, data) - packet_id = packet_id + 1 for stream_type, _, image in STREAMS: vipc_server.send(stream_type, image, packet_id, packet_id, packet_id) @@ -116,7 +106,6 @@ def setup_onroad_alert_full(click, pm: PubMaster): setup_onroad_alert(click, pm, 'Full Alert', 'This is a full alert message', log.SelfdriveState.AlertSize.full) def setup_offroad_alert(click, pm: PubMaster): - setup_common(click, pm) for alert in OFFROAD_ALERTS: set_offroad_alert(alert, True) @@ -125,7 +114,6 @@ def setup_offroad_alert(click, pm: PubMaster): click(240, 216) def setup_update_available(click, pm: PubMaster): - setup_common(click, pm) Params().put_bool("UpdateAvailable", True) release_notes_path = os.path.join(BASEDIR, "RELEASES.md") with open(release_notes_path) as file: @@ -164,11 +152,13 @@ def __init__(self): sys.modules["mouseinfo"] = False def setup(self): + Params().put("DongleId", "123456789012345") self.sm = SubMaster(["uiDebug"]) self.pm = PubMaster(list(DATA.keys())) while not self.sm.valid["uiDebug"]: self.sm.update(1) time.sleep(UI_DELAY) # wait a bit more for the UI to start rendering + self.pm.send('deviceState', DATA['deviceState']) try: self.ui = pywinctl.getWindowsWithTitle("ui")[0] except Exception as e: @@ -195,8 +185,6 @@ def test_ui(self, name, setup_case): setup_case(self.click, self.pm) - time.sleep(UI_DELAY) # wait a bit more for the UI to finish rendering - im = self.screenshot() plt.imsave(SCREENSHOTS_DIR / f"{name}.png", im)