Merge branch 'hang-regression-test' into 'master'

Add a regression test for #13

See merge request xorg/lib/libxcb!23
This commit is contained in:
Uli Schlachter 2025-01-10 21:34:28 +00:00
commit af8cd516d6
4 changed files with 35 additions and 1 deletions

View File

@ -10,7 +10,7 @@ LDADD = @CHECK_LIBS@ $(top_builddir)/src/libxcb.la
if HAVE_CHECK
TESTS = check_all
check_PROGRAMS = check_all
check_all_SOURCES = check_all.c check_suites.h check_public.c
check_all_SOURCES = check_all.c check_suites.h check_public.c check_integration.c
check-local: check-TESTS
$(RM) CheckLog.html

View File

@ -21,6 +21,7 @@ int main(void)
{
int nf;
SRunner *sr = srunner_create(public_suite());
srunner_add_suite(sr, integration_suite());
srunner_set_xml(sr, "CheckLog_xcb.xml");
srunner_run_all(sr, CK_NORMAL);
nf = srunner_ntests_failed(sr);

32
tests/check_integration.c Normal file
View File

@ -0,0 +1,32 @@
#include <check.h>
#include <stdlib.h>
#include "check_suites.h"
#include "xcb.h"
#include "xcbext.h"
START_TEST(request_check_hang)
{
// Other tests mess with the environment. Try to get us an X11 server.
putenv("DISPLAY=:0");
xcb_connection_t *connection = xcb_connect(NULL, NULL);
ck_assert_uint_eq(0, xcb_connection_has_error(connection));
// Regression test for https://gitlab.freedesktop.org/xorg/lib/libxcb/-/issues/53
xcb_void_cookie_t cookie = xcb_no_operation_checked(connection);
xcb_flush(connection);
xcb_get_input_focus(connection);
// The following call once upon a time hung
xcb_request_check(connection, cookie);
xcb_disconnect(connection);
}
END_TEST
Suite *integration_suite(void)
{
Suite *s = suite_create("Integration");
suite_add_test(s, request_check_hang, "regression test: hand in xcb_request_check()");
return s;
}

View File

@ -6,3 +6,4 @@ void suite_add_test(Suite *s, TFun tf, const char *name);
void suite_add_test(Suite *s, const TTest *tt, const char *name);
#endif
Suite *public_suite(void);
Suite *integration_suite(void);