Commit 773fc07e authored by Mihail Konev's avatar Mihail Konev Committed by Adam Jackson

tests: Convert test/xi2/ to single binary

Reviewed-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
Signed-off-by: default avatarMihail Konev <k.mvc@ya.ru>
parent 371576f6
......@@ -3,4 +3,24 @@
int protocol_xchangedevicecontrol_test(void);
int protocol_xiqueryversion_test(void);
int protocol_xiquerydevice_test(void);
int protocol_xiselectevents_test(void);
int protocol_xigetselectedevents_test(void);
int protocol_xisetclientpointer_test(void);
int protocol_xigetclientpointer_test(void);
int protocol_xipassivegrabdevice_test(void);
int protocol_xiquerypointer_test(void);
int protocol_xiwarppointer_test(void);
int protocol_eventconvert_test(void);
int xi2_test(void);
#ifndef INSIDE_PROTOCOL_COMMON
extern int enable_XISetEventMask_wrap;
extern int enable_GrabButton_wrap;
#endif /* INSIDE_PROTOCOL_COMMON */
#endif /* TESTS_H */
protocol-eventconvert
protocol-xigetclientpointer
protocol-xigetselectedevents
protocol-xipassivegrabdevice
protocol-xiquerydevice
protocol-xiquerypointer
protocol-xiqueryversion
protocol-xiselectevents
protocol-xisetclientpointer
protocol-xiwarppointer
xi2
tests
if ENABLE_UNIT_TESTS
if HAVE_LD_WRAP
noinst_PROGRAMS = \
protocol-xiqueryversion \
protocol-xiquerydevice \
protocol-xiselectevents \
protocol-xigetselectedevents \
protocol-xisetclientpointer \
protocol-xigetclientpointer \
protocol-xipassivegrabdevice \
protocol-xiquerypointer \
protocol-xiwarppointer \
protocol-eventconvert \
xi2
noinst_PROGRAMS = tests
TESTS = tests
TESTS=$(noinst_PROGRAMS)
TESTS_ENVIRONMENT = $(XORG_MALLOC_DEBUG_ENV)
AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
AM_CPPFLAGS = \
tests_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
tests_CPPFLAGS = \
@XORG_INCS@ \
-I$(srcdir)/..
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
tests_LDADD = ../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
if SPECIAL_DTRACE_OBJECTS
TEST_LDADD += $(OS_LIB) $(DIX_LIB)
tests_LDADD += $(OS_LIB) $(DIX_LIB)
endif
protocol_xiqueryversion_LDADD=$(TEST_LDADD)
protocol_xiquerydevice_LDADD=$(TEST_LDADD)
protocol_xiselectevents_LDADD=$(TEST_LDADD)
protocol_xigetselectedevents_LDADD=$(TEST_LDADD)
protocol_xisetclientpointer_LDADD=$(TEST_LDADD)
protocol_xigetclientpointer_LDADD=$(TEST_LDADD)
protocol_xiquerypointer_LDADD=$(TEST_LDADD)
protocol_xipassivegrabdevice_LDADD=$(TEST_LDADD)
protocol_xiwarppointer_LDADD=$(TEST_LDADD)
protocol_eventconvert_LDADD=$(TEST_LDADD)
xi2_LDADD=$(TEST_LDADD)
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)
tests_LDFLAGS = \
-Wl,-wrap,WriteToClient \
-Wl,-wrap,dixLookupWindow \
-Wl,-wrap,XISetEventMask \
-Wl,-wrap,AddResource \
-Wl,-wrap,GrabButton \
-Wl,-wrap,dixLookupClient \
$()
tests_SOURCES = \
$(srcdir)/../tests-common.c \
protocol-common.c \
protocol-xiqueryversion.c \
protocol-xiquerydevice.c \
protocol-xiselectevents.c \
protocol-xigetselectedevents.c \
protocol-xisetclientpointer.c \
protocol-xigetclientpointer.c \
protocol-xiquerypointer.c \
protocol-xipassivegrabdevice.c \
protocol-xiwarppointer.c \
protocol-eventconvert.c \
xi2.c \
tests.c
protocol_xiqueryversion_SOURCES=$(COMMON_SOURCES) protocol-xiqueryversion.c
protocol_xiquerydevice_SOURCES=$(COMMON_SOURCES) protocol-xiquerydevice.c
protocol_xiselectevents_SOURCES=$(COMMON_SOURCES) protocol-xiselectevents.c
protocol_xigetselectedevents_SOURCES=$(COMMON_SOURCES) protocol-xigetselectedevents.c
protocol_xisetclientpointer_SOURCES=$(COMMON_SOURCES) protocol-xisetclientpointer.c
protocol_xigetclientpointer_SOURCES=$(COMMON_SOURCES) protocol-xigetclientpointer.c
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
......
......@@ -34,6 +34,7 @@
#include "syncsrv.h"
#include <X11/extensions/XI2.h>
#define INSIDE_PROTOCOL_COMMON
#include "protocol-common.h"
struct devices devices;
......@@ -44,6 +45,9 @@ static ClientRec server_client;
void *global_userdata;
int enable_GrabButton_wrap = 1;
int enable_XISetEventMask_wrap = 1;
static void
fake_init_sprite(DeviceIntPtr dev)
{
......
......@@ -1202,7 +1202,7 @@ test_convert_XIBarrierEvent(void)
}
int
main(int argc, char **argv)
protocol_eventconvert_test(void)
{
test_convert_XIRawEvent();
test_convert_XIFocusEvent();
......
......@@ -142,7 +142,7 @@ test_XIGetClientPointer(void)
}
int
main(int argc, char **argv)
protocol_xigetclientpointer_test(void)
{
init_simple();
client_window = init_client(0, NULL);
......
......@@ -206,9 +206,11 @@ test_XIGetSelectedEvents(void)
}
int
main(int argc, char **argv)
protocol_xigetselectedevents_test(void)
{
init_simple();
enable_GrabButton_wrap = 0;
enable_XISetEventMask_wrap = 0;
test_XIGetSelectedEvents();
......
......@@ -55,6 +55,10 @@ int __wrap_GrabButton(ClientPtr client, DeviceIntPtr dev,
DeviceIntPtr modifier_device, int button,
GrabParameters *param, enum InputLevel grabtype,
GrabMask *mask);
int __real_GrabButton(ClientPtr client, DeviceIntPtr dev,
DeviceIntPtr modifier_device, int button,
GrabParameters *param, enum InputLevel grabtype,
GrabMask *mask);
static void reply_XIPassiveGrabDevice_data(ClientPtr client, int len,
char *data, void *closure);
......@@ -64,6 +68,9 @@ __wrap_GrabButton(ClientPtr client, DeviceIntPtr dev,
GrabParameters *param, enum InputLevel grabtype,
GrabMask *mask)
{
if (!enable_GrabButton_wrap)
__real_GrabButton(client, dev, modifier_device, button, param, grabtype, mask);
/* Fail every odd modifier */
if (param->modifiers % 2)
return BadAccess;
......@@ -238,7 +245,7 @@ test_XIPassiveGrabDevice(void)
}
int
main(int argc, char **argv)
protocol_xipassivegrabdevice_test(void)
{
init_simple();
......
......@@ -335,7 +335,7 @@ test_XIQueryDevice(void)
}
int
main(int argc, char **argv)
protocol_xiquerydevice_test(void)
{
init_simple();
......
......@@ -190,7 +190,7 @@ test_XIQueryPointer(void)
}
int
main(int argc, char **argv)
protocol_xiquerypointer_test(void)
{
init_simple();
......
......@@ -288,7 +288,7 @@ test_XIQueryVersion_multiple(void)
}
int
main(int argc, char **argv)
protocol_xiqueryversion_test(void)
{
init_simple();
......
......@@ -64,10 +64,17 @@ static unsigned char *data[4096 * 20]; /* the request data buffer */
ClientRec client_window;
int
__real_XISetEventMask(DeviceIntPtr dev, WindowPtr win, int len,
unsigned char *mask);
int
__wrap_XISetEventMask(DeviceIntPtr dev, WindowPtr win, int len,
unsigned char *mask)
{
if (!enable_XISetEventMask_wrap)
return __real_XISetEventMask(dev, win, len, mask);
return Success;
}
......@@ -324,7 +331,7 @@ test_XISelectEvents(void)
}
int
main(int argc, char **argv)
protocol_xiselectevents_test(void)
{
init_simple();
......
......@@ -122,7 +122,7 @@ test_XISetClientPointer(void)
}
int
main(int argc, char **argv)
protocol_xisetclientpointer_test(void)
{
init_simple();
client_window = init_client(0, NULL);
......
......@@ -186,7 +186,7 @@ test_XIWarpPointer(void)
}
int
main(int argc, char **argv)
protocol_xiwarppointer_test(void)
{
init_simple();
screen.SetCursorPosition = ScreenSetCursorPosition;
......
#include "tests.h"
#include "tests-common.h"
#include "protocol-common.h"
int
main(int argc, char **argv)
{
run_test(protocol_xiqueryversion_test);
run_test(protocol_xiquerydevice_test);
run_test(protocol_xiselectevents_test);
run_test(protocol_xigetselectedevents_test);
run_test(protocol_xisetclientpointer_test);
run_test(protocol_xigetclientpointer_test);
run_test(protocol_xipassivegrabdevice_test);
run_test(protocol_xiquerypointer_test);
run_test(protocol_xiwarppointer_test);
run_test(protocol_eventconvert_test);
run_test(xi2_test);
return 0;
}
......@@ -137,7 +137,7 @@ xi2mask_test(void)
}
int
main(int argc, char **argv)
xi2_test(void)
{
xi2mask_test();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment