tests: Refactor wraps into protocol-common.c
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. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Mihail Konev <k.mvc@ya.ru>
This commit is contained in:
parent
45546219e1
commit
ff66bca3e8
|
@ -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_LD_FLAGS = -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_LD_FLAGS) -Wl,-wrap,WriteToClient
|
||||
|
||||
protocol_xchangedevicecontrol_SOURCES=$(COMMON_SOURCES) protocol-xchangedevicecontrol.c
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
#include "protocol-common.h"
|
||||
|
||||
ClientRec client_window;
|
||||
static ClientRec client_request;
|
||||
|
||||
static void
|
||||
|
|
|
@ -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_LD_FLAGS= -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_LD_FLAGS) -Wl,-wrap,WriteToClient
|
||||
protocol_xiquerydevice_LDFLAGS=$(COMMON_LD_FLAGS) -Wl,-wrap,WriteToClient
|
||||
protocol_xiselectevents_LDFLAGS=$(COMMON_LD_FLAGS) -Wl,-wrap,XISetEventMask
|
||||
protocol_xigetselectedevents_LDFLAGS=$(COMMON_LD_FLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,AddResource
|
||||
protocol_xisetclientpointer_LDFLAGS=$(COMMON_LD_FLAGS) -Wl,-wrap,dixLookupClient
|
||||
protocol_xigetclientpointer_LDFLAGS=$(COMMON_LD_FLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,dixLookupClient
|
||||
protocol_xipassivegrabdevice_LDFLAGS=$(COMMON_LD_FLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,GrabButton
|
||||
protocol_xiquerypointer_LDFLAGS=$(COMMON_LD_FLAGS) -Wl,-wrap,WriteToClient
|
||||
protocol_xiwarppointer_LDFLAGS=$(COMMON_LD_FLAGS) -Wl,-wrap,WriteToClient
|
||||
xi2_LDFLAGS=$(COMMON_LD_FLAGS)
|
||||
|
||||
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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
|
||||
#include "protocol-common.h"
|
||||
|
||||
ClientRec client_window;
|
||||
static ClientRec client_request;
|
||||
|
||||
#define N_MODS 7
|
||||
|
@ -57,21 +58,6 @@ int __wrap_GrabButton(ClientPtr client, DeviceIntPtr dev,
|
|||
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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -30,6 +30,10 @@
|
|||
#include "inputstr.h"
|
||||
#include "assert.h"
|
||||
|
||||
#include "protocol-common.h"
|
||||
|
||||
ClientRec client_window;
|
||||
|
||||
static void
|
||||
xi2mask_test(void)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue