From 2ac4227843658c4719e1ad299851d1796dbfaec8 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 31 Oct 2024 15:10:11 +1000 Subject: [PATCH] test: fix two race conditions waiting for proximity events This test does a prox in/out and immediately drains events. Where we are slow enough we may drain only one (or none) of the proximity events which causes a failure later in the test. Similar issue with the second test where we may get a delayed tip event. Part-of: --- test/test-tablet.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/test-tablet.c b/test/test-tablet.c index d5696c8e..07a14dc4 100644 --- a/test/test-tablet.c +++ b/test/test-tablet.c @@ -3775,6 +3775,7 @@ START_TEST(tablet_calibration_set_matrix_delta) dy = libinput_event_tablet_tool_get_y(tablet_event) - y; libinput_event_destroy(event); litest_tablet_proximity_out(dev); + litest_wait_for_event_of_type(li, LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); litest_drain_events(li); status = libinput_device_config_calibration_set_matrix(d, @@ -3857,6 +3858,8 @@ START_TEST(tablet_calibration_set_matrix) litest_dispatch(li); litest_tablet_proximity_in(dev, 50, 50, axes); litest_tablet_proximity_out(dev); + litest_wait_for_event_of_type(li, LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); + litest_wait_for_event_of_type(li, LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); litest_drain_events(li); calibration[0] = 1; -- 2.34.1