Part of refactoring the tests into a single binary, to make partial rebuild slightly faster and less verbose.
Prepares for joining test/xi2/protocol-* into a single binary. Signed-off-by: Mihail Konev <k....@ya.ru> --- test/xi1/Makefile.am | 3 ++- test/xi1/protocol-xchangedevicecontrol.c | 1 + test/xi2/Makefile.am | 22 ++++++++++--------- test/xi2/protocol-common.c | 37 ++++++++++++++++++++++++++++++++ test/xi2/protocol-eventconvert.c | 2 ++ test/xi2/protocol-xigetclientpointer.c | 17 +-------------- test/xi2/protocol-xigetselectedevents.c | 20 +---------------- test/xi2/protocol-xipassivegrabdevice.c | 16 +------------- test/xi2/protocol-xiquerydevice.c | 2 ++ test/xi2/protocol-xiquerypointer.c | 21 +----------------- test/xi2/protocol-xiqueryversion.c | 2 ++ test/xi2/protocol-xiselectevents.c | 22 ++----------------- test/xi2/protocol-xisetclientpointer.c | 17 +-------------- test/xi2/protocol-xiwarppointer.c | 20 +---------------- test/xi2/xi2.c | 4 ++++ 15 files changed, 70 insertions(+), 136 deletions(-) diff --git a/test/xi1/Makefile.am b/test/xi1/Makefile.am index 907fa7aea5f3..813241c0aeed 100644 --- a/test/xi1/Makefile.am +++ b/test/xi1/Makefile.am @@ -10,6 +10,7 @@ AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@ AM_CPPFLAGS = @XORG_INCS@ -I$(srcdir)/../xi2 TEST_LDADD=../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS) COMMON_SOURCES=$(srcdir)/../xi2/protocol-common.c +COMMON_LDFLAGS= -Wl,-wrap,dixLookupWindow -Wl,-wrap,dixLookupClient if SPECIAL_DTRACE_OBJECTS TEST_LDADD += $(OS_LIB) $(DIX_LIB) @@ -17,7 +18,7 @@ endif protocol_xchangedevicecontrol_LDADD=$(TEST_LDADD) -protocol_xchangedevicecontrol_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient +protocol_xchangedevicecontrol_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient protocol_xchangedevicecontrol_SOURCES=$(COMMON_SOURCES) protocol-xchangedevicecontrol.c diff --git a/test/xi1/protocol-xchangedevicecontrol.c b/test/xi1/protocol-xchangedevicecontrol.c index 8e638b218f72..64d2ca29bb95 100644 --- a/test/xi1/protocol-xchangedevicecontrol.c +++ b/test/xi1/protocol-xchangedevicecontrol.c @@ -37,6 +37,7 @@ #include "protocol-common.h" +ClientRec client_window; static ClientRec client_request; static void diff --git a/test/xi2/Makefile.am b/test/xi2/Makefile.am index bfddfef133fd..6b9679872b48 100644 --- a/test/xi2/Makefile.am +++ b/test/xi2/Makefile.am @@ -20,6 +20,7 @@ AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@ AM_CPPFLAGS = @XORG_INCS@ TEST_LDADD=../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS) COMMON_SOURCES=protocol-common.h protocol-common.c +COMMON_LDFLAGS= -Wl,-wrap,dixLookupWindow -Wl,-wrap,dixLookupClient if SPECIAL_DTRACE_OBJECTS TEST_LDADD += $(OS_LIB) $(DIX_LIB) @@ -37,16 +38,16 @@ protocol_xiwarppointer_LDADD=$(TEST_LDADD) protocol_eventconvert_LDADD=$(TEST_LDADD) xi2_LDADD=$(TEST_LDADD) -protocol_xiqueryversion_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient -protocol_xiquerydevice_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient -protocol_xiselectevents_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,dixLookupWindow -Wl,-wrap,XISetEventMask -protocol_xigetselectedevents_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,dixLookupWindow -Wl,-wrap,AddResource -protocol_xisetclientpointer_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,dixLookupClient -protocol_xigetclientpointer_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,dixLookupClient -protocol_xipassivegrabdevice_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,GrabButton -Wl,-wrap,dixLookupWindow -Wl,-wrap,WriteToClient -protocol_xiquerypointer_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,dixLookupWindow -protocol_xiwarppointer_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,dixLookupWindow -xi2_LDFLAGS=$(AM_LDFLAGS) +protocol_xiqueryversion_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient +protocol_xiquerydevice_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient +protocol_xiselectevents_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,XISetEventMask +protocol_xigetselectedevents_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,AddResource +protocol_xisetclientpointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,dixLookupClient +protocol_xigetclientpointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,dixLookupClient +protocol_xipassivegrabdevice_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,GrabButton +protocol_xiquerypointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient +protocol_xiwarppointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient +xi2_LDFLAGS=$(COMMON_LDFLAGS) protocol_xiqueryversion_SOURCES=$(COMMON_SOURCES) protocol-xiqueryversion.c protocol_xiquerydevice_SOURCES=$(COMMON_SOURCES) protocol-xiquerydevice.c @@ -57,6 +58,7 @@ protocol_xigetclientpointer_SOURCES=$(COMMON_SOURCES) protocol-xigetclientpointe protocol_xiquerypointer_SOURCES=$(COMMON_SOURCES) protocol-xiquerypointer.c protocol_xipassivegrabdevice_SOURCES=$(COMMON_SOURCES) protocol-xipassivegrabdevice.c protocol_xiwarppointer_SOURCES=$(COMMON_SOURCES) protocol-xiwarppointer.c +xi2_SOURCES=$(COMMON_SOURCES) xi2.c else # Print that xi2-tests were skipped (exit code 77 for automake test harness) TESTS = xi2-tests diff --git a/test/xi2/protocol-common.c b/test/xi2/protocol-common.c index 9265ba390d95..d30593a13af9 100644 --- a/test/xi2/protocol-common.c +++ b/test/xi2/protocol-common.c @@ -284,3 +284,40 @@ __wrap_WriteToClient(ClientPtr client, int len, void *data) (*reply_handler) (client, len, data, global_userdata); } + +/* dixLookupWindow requires a lot of setup not necessary for this test. + * Simple wrapper that returns either one of the fake root window or the + * fake client window. If the requested ID is neither of those wanted, + * return whatever the real dixLookupWindow does. + */ +int +__wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access) +{ + if (id == root.drawable.id) { + *win = &root; + return Success; + } + else if (id == window.drawable.id) { + *win = &window; + return Success; + } + + return __real_dixLookupWindow(win, id, client, access); +} + +extern ClientRec client_window; + +int +__wrap_dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, + Mask access) +{ + if (rid == ROOT_WINDOW_ID) + return BadWindow; + + if (rid == CLIENT_WINDOW_ID) { + *pClient = &client_window; + return Success; + } + + return __real_dixLookupClient(pClient, rid, client, access); +} diff --git a/test/xi2/protocol-eventconvert.c b/test/xi2/protocol-eventconvert.c index aea380ed5a6b..ff30bdc352c1 100644 --- a/test/xi2/protocol-eventconvert.c +++ b/test/xi2/protocol-eventconvert.c @@ -33,6 +33,8 @@ #include "inpututils.h" #include <X11/extensions/XI2proto.h> +#include "protocol-common.h" + static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent * out, BOOL swap) { diff --git a/test/xi2/protocol-xigetclientpointer.c b/test/xi2/protocol-xigetclientpointer.c index 570c53e066e8..394f9f703078 100644 --- a/test/xi2/protocol-xigetclientpointer.c +++ b/test/xi2/protocol-xigetclientpointer.c @@ -46,24 +46,9 @@ struct { int win; } test_data; -static ClientRec client_window; +ClientRec client_window; static ClientRec client_request; -int -__wrap_dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, - Mask access) -{ - if (rid == ROOT_WINDOW_ID) - return BadWindow; - - if (rid == CLIENT_WINDOW_ID) { - *pClient = &client_window; - return Success; - } - - return __real_dixLookupClient(pClient, rid, client, access); -} - static void reply_XIGetClientPointer(ClientPtr client, int len, char *data, void *userdata) { diff --git a/test/xi2/protocol-xigetselectedevents.c b/test/xi2/protocol-xigetselectedevents.c index bedc217b1df0..c4fae39f545e 100644 --- a/test/xi2/protocol-xigetselectedevents.c +++ b/test/xi2/protocol-xigetselectedevents.c @@ -60,25 +60,7 @@ struct { int mask_len; } test_data; -/* dixLookupWindow requires a lot of setup not necessary for this test. - * Simple wrapper that returns either one of the fake root window or the - * fake client window. If the requested ID is neither of those wanted, - * return whatever the real dixLookupWindow does. - */ -int -__wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access) -{ - if (id == root.drawable.id) { - *win = &root; - return Success; - } - else if (id == window.drawable.id) { - *win = &window; - return Success; - } - - return __real_dixLookupWindow(win, id, client, access); -} +ClientRec client_window; /* AddResource is called from XISetSEventMask, we don't need this */ Bool diff --git a/test/xi2/protocol-xipassivegrabdevice.c b/test/xi2/protocol-xipassivegrabdevice.c index 95d8ebf2bf62..29ef4322c8fd 100644 --- a/test/xi2/protocol-xipassivegrabdevice.c +++ b/test/xi2/protocol-xipassivegrabdevice.c @@ -41,6 +41,7 @@ #include "protocol-common.h" +ClientRec client_window; static ClientRec client_request; #define N_MODS 7 @@ -58,21 +59,6 @@ static void reply_XIPassiveGrabDevice_data(ClientPtr client, int len, char *data, void *closure); int -__wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access) -{ - if (id == root.drawable.id) { - *win = &root; - return Success; - } - else if (id == window.drawable.id) { - *win = &window; - return Success; - } - - return __real_dixLookupWindow(win, id, client, access); -} - -int __wrap_GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device, int button, GrabParameters *param, enum InputLevel grabtype, diff --git a/test/xi2/protocol-xiquerydevice.c b/test/xi2/protocol-xiquerydevice.c index deef1f180902..a07da0442387 100644 --- a/test/xi2/protocol-xiquerydevice.c +++ b/test/xi2/protocol-xiquerydevice.c @@ -54,6 +54,8 @@ struct test_data { int num_devices_in_reply; }; +ClientRec client_window; + static void reply_XIQueryDevice_data(ClientPtr client, int len, char *data, void *closure); static void reply_XIQueryDevice(ClientPtr client, int len, char *data, diff --git a/test/xi2/protocol-xiquerypointer.c b/test/xi2/protocol-xiquerypointer.c index 2bf18fadc5ca..9d3f945627dd 100644 --- a/test/xi2/protocol-xiquerypointer.c +++ b/test/xi2/protocol-xiquerypointer.c @@ -41,6 +41,7 @@ #include "protocol-common.h" +ClientRec client_window; static ClientRec client_request; static void reply_XIQueryPointer_data(ClientPtr client, int len, char *data, void *closure); @@ -50,26 +51,6 @@ static struct { WindowPtr win; } test_data; -/* dixLookupWindow requires a lot of setup not necessary for this test. - * Simple wrapper that returns either one of the fake root window or the - * fake client window. If the requested ID is neither of those wanted, - * return whatever the real dixLookupWindow does. - */ -int -__wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access) -{ - if (id == root.drawable.id) { - *win = &root; - return Success; - } - else if (id == window.drawable.id) { - *win = &window; - return Success; - } - - return __real_dixLookupWindow(win, id, client, access); -} - static void reply_XIQueryPointer(ClientPtr client, int len, char *data, void *closure) { diff --git a/test/xi2/protocol-xiqueryversion.c b/test/xi2/protocol-xiqueryversion.c index 3749b3041e0c..efee156c42fb 100644 --- a/test/xi2/protocol-xiqueryversion.c +++ b/test/xi2/protocol-xiqueryversion.c @@ -58,6 +58,8 @@ struct test_data { int minor_expected; }; +ClientRec client_window; + static void reply_XIQueryVersion(ClientPtr client, int len, char *data, void *closure) { diff --git a/test/xi2/protocol-xiselectevents.c b/test/xi2/protocol-xiselectevents.c index 183746f98af2..575a06611bd8 100644 --- a/test/xi2/protocol-xiselectevents.c +++ b/test/xi2/protocol-xiselectevents.c @@ -62,6 +62,8 @@ static unsigned char *data[4096 * 20]; /* the request data buffer */ +ClientRec client_window; + int __wrap_XISetEventMask(DeviceIntPtr dev, WindowPtr win, int len, unsigned char *mask) @@ -69,26 +71,6 @@ __wrap_XISetEventMask(DeviceIntPtr dev, WindowPtr win, int len, return Success; } -/* dixLookupWindow requires a lot of setup not necessary for this test. - * Simple wrapper that returns either one of the fake root window or the - * fake client window. If the requested ID is neither of those wanted, - * return whatever the real dixLookupWindow does. - */ -int -__wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access) -{ - if (id == root.drawable.id) { - *win = &root; - return Success; - } - else if (id == window.drawable.id) { - *win = &window; - return Success; - } - - return __real_dixLookupWindow(win, id, client, access); -} - static void request_XISelectEvent(xXISelectEventsReq * req, int error) { diff --git a/test/xi2/protocol-xisetclientpointer.c b/test/xi2/protocol-xisetclientpointer.c index 90f1b94c359c..bd6267d59633 100644 --- a/test/xi2/protocol-xisetclientpointer.c +++ b/test/xi2/protocol-xisetclientpointer.c @@ -48,24 +48,9 @@ #include "protocol-common.h" -static ClientRec client_window; +ClientRec client_window; static ClientRec client_request; -int -__wrap_dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, - Mask access) -{ - if (rid == ROOT_WINDOW_ID) - return BadWindow; - - if (rid == CLIENT_WINDOW_ID) { - *pClient = &client_window; - return Success; - } - - return __real_dixLookupClient(pClient, rid, client, access); -} - static void request_XISetClientPointer(xXISetClientPointerReq * req, int error) { diff --git a/test/xi2/protocol-xiwarppointer.c b/test/xi2/protocol-xiwarppointer.c index 3aaaae6f9201..8483aacd4708 100644 --- a/test/xi2/protocol-xiwarppointer.c +++ b/test/xi2/protocol-xiwarppointer.c @@ -44,25 +44,7 @@ static int expected_x = SPRITE_X; static int expected_y = SPRITE_Y; -/* dixLookupWindow requires a lot of setup not necessary for this test. - * Simple wrapper that returns either one of the fake root window or the - * fake client window. If the requested ID is neither of those wanted, - * return whatever the real dixLookupWindow does. - */ -int -__wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access) -{ - if (id == root.drawable.id) { - *win = &root; - return Success; - } - else if (id == window.drawable.id) { - *win = &window; - return Success; - } - - return __real_dixLookupWindow(win, id, client, access); -} +ClientRec client_window; /** * This function overrides the one in the screen rec. diff --git a/test/xi2/xi2.c b/test/xi2/xi2.c index 1cdad1dbdc50..070d641af4a8 100644 --- a/test/xi2/xi2.c +++ b/test/xi2/xi2.c @@ -30,6 +30,10 @@ #include "inputstr.h" #include "assert.h" +#include "protocol-common.h" + +ClientRec client_window; + static void xi2mask_test(void) { -- 2.9.2 _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel