diff --git a/tests/Makefile.am b/tests/Makefile.am index ceef722..fbcee61 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 diff --git a/tests/check_all.c b/tests/check_all.c index f4c909c..990c64f 100644 --- a/tests/check_all.c +++ b/tests/check_all.c @@ -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); diff --git a/tests/check_integration.c b/tests/check_integration.c new file mode 100644 index 0000000..71cabfc --- /dev/null +++ b/tests/check_integration.c @@ -0,0 +1,32 @@ +#include +#include +#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; +} diff --git a/tests/check_suites.h b/tests/check_suites.h index e662084..05dfc3d 100644 --- a/tests/check_suites.h +++ b/tests/check_suites.h @@ -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);