test: Fix xsync test

The xsync test is relying on the values being changed even in the case
of a BadMatch value.

Typically, it updates the delta but does not update the test type
comparison, so when passing a negative value, it generates a BadMatch.

That's actually not correct, and that will fail with the new fixes that
check the validity of the values prior to apply the changes.

Fix the test by updating the test type as needed.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 05e54fefaf)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1830>
This commit is contained in:
Olivier Fourdan 2025-02-25 18:47:05 +01:00
parent 0c6a7750f2
commit 32887f6ca4

View file

@ -260,9 +260,13 @@ test_change_alarm_delta(xcb_connection_t *c)
xcb_sync_create_alarm(c, alarm, 0, NULL); xcb_sync_create_alarm(c, alarm, 0, NULL);
for (int i = 0; i < ARRAY_SIZE(some_values); i++) { for (int i = 0; i < ARRAY_SIZE(some_values); i++) {
uint32_t values[] = { some_values[i] >> 32, some_values[i] }; uint32_t mask = XCB_SYNC_CA_TEST_TYPE | XCB_SYNC_CA_DELTA;
uint32_t test_type = (some_values[i] >= 0 ?
XCB_SYNC_TESTTYPE_POSITIVE_COMPARISON :
XCB_SYNC_TESTTYPE_NEGATIVE_COMPARISON);
uint32_t values[] = { test_type, some_values[i] >> 32, some_values[i] };
xcb_sync_change_alarm(c, alarm, XCB_SYNC_CA_DELTA, values); xcb_sync_change_alarm(c, alarm, mask, values);
queries[i] = xcb_sync_query_alarm_unchecked(c, alarm); queries[i] = xcb_sync_query_alarm_unchecked(c, alarm);
} }