diff options
author | Mihail Konev <k.mvc@ya.ru> | 2017-01-12 13:21:09 +0500 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2017-01-12 15:01:33 -0500 |
commit | 773fc07e4c2f816966809492a924a9bd1a15d059 (patch) | |
tree | 0bef8d63e6eb5c871766efffa7858217127505cb /test | |
parent | 371576f64baa99c4ab1e736fbae7975a32577275 (diff) |
tests: Convert test/xi2/ to single binary
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Mihail Konev <k.mvc@ya.ru>
Diffstat (limited to 'test')
-rw-r--r-- | test/tests.h | 20 | ||||
-rw-r--r-- | test/xi2/.gitignore | 12 | ||||
-rw-r--r-- | test/xi2/Makefile.am | 83 | ||||
-rw-r--r-- | test/xi2/protocol-common.c | 4 | ||||
-rw-r--r-- | test/xi2/protocol-eventconvert.c | 2 | ||||
-rw-r--r-- | test/xi2/protocol-xigetclientpointer.c | 2 | ||||
-rw-r--r-- | test/xi2/protocol-xigetselectedevents.c | 4 | ||||
-rw-r--r-- | test/xi2/protocol-xipassivegrabdevice.c | 9 | ||||
-rw-r--r-- | test/xi2/protocol-xiquerydevice.c | 2 | ||||
-rw-r--r-- | test/xi2/protocol-xiquerypointer.c | 2 | ||||
-rw-r--r-- | test/xi2/protocol-xiqueryversion.c | 2 | ||||
-rw-r--r-- | test/xi2/protocol-xiselectevents.c | 9 | ||||
-rw-r--r-- | test/xi2/protocol-xisetclientpointer.c | 2 | ||||
-rw-r--r-- | test/xi2/protocol-xiwarppointer.c | 2 | ||||
-rw-r--r-- | test/xi2/tests.c | 21 | ||||
-rw-r--r-- | test/xi2/xi2.c | 2 |
16 files changed, 105 insertions, 73 deletions
diff --git a/test/tests.h b/test/tests.h index 7fa5ac210..0b673ee7a 100644 --- a/test/tests.h +++ b/test/tests.h @@ -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 */ + diff --git a/test/xi2/.gitignore b/test/xi2/.gitignore index 817aa7b6b..2b29f2764 100644 --- a/test/xi2/.gitignore +++ b/test/xi2/.gitignore @@ -1,11 +1 @@ -protocol-eventconvert -protocol-xigetclientpointer -protocol-xigetselectedevents -protocol-xipassivegrabdevice -protocol-xiquerydevice -protocol-xiquerypointer -protocol-xiqueryversion -protocol-xiselectevents -protocol-xisetclientpointer -protocol-xiwarppointer -xi2 +tests diff --git a/test/xi2/Makefile.am b/test/xi2/Makefile.am index 49aaebb36..a7f9831a9 100644 --- a/test/xi2/Makefile.am +++ b/test/xi2/Makefile.am @@ -1,67 +1,48 @@ 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 diff --git a/test/xi2/protocol-common.c b/test/xi2/protocol-common.c index d30593a13..b91692f55 100644 --- a/test/xi2/protocol-common.c +++ b/test/xi2/protocol-common.c @@ -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) { diff --git a/test/xi2/protocol-eventconvert.c b/test/xi2/protocol-eventconvert.c index ff30bdc35..8d19d5339 100644 --- a/test/xi2/protocol-eventconvert.c +++ b/test/xi2/protocol-eventconvert.c @@ -1202,7 +1202,7 @@ test_convert_XIBarrierEvent(void) } int -main(int argc, char **argv) +protocol_eventconvert_test(void) { test_convert_XIRawEvent(); test_convert_XIFocusEvent(); diff --git a/test/xi2/protocol-xigetclientpointer.c b/test/xi2/protocol-xigetclientpointer.c index 394f9f703..f0c27b933 100644 --- a/test/xi2/protocol-xigetclientpointer.c +++ b/test/xi2/protocol-xigetclientpointer.c @@ -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); diff --git a/test/xi2/protocol-xigetselectedevents.c b/test/xi2/protocol-xigetselectedevents.c index c4fae39f5..3a7f3641f 100644 --- a/test/xi2/protocol-xigetselectedevents.c +++ b/test/xi2/protocol-xigetselectedevents.c @@ -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(); diff --git a/test/xi2/protocol-xipassivegrabdevice.c b/test/xi2/protocol-xipassivegrabdevice.c index 29ef4322c..db7e6abf7 100644 --- a/test/xi2/protocol-xipassivegrabdevice.c +++ b/test/xi2/protocol-xipassivegrabdevice.c @@ -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(); diff --git a/test/xi2/protocol-xiquerydevice.c b/test/xi2/protocol-xiquerydevice.c index a07da0442..a068038fd 100644 --- a/test/xi2/protocol-xiquerydevice.c +++ b/test/xi2/protocol-xiquerydevice.c @@ -335,7 +335,7 @@ test_XIQueryDevice(void) } int -main(int argc, char **argv) +protocol_xiquerydevice_test(void) { init_simple(); diff --git a/test/xi2/protocol-xiquerypointer.c b/test/xi2/protocol-xiquerypointer.c index 9d3f94562..ed75d7910 100644 --- a/test/xi2/protocol-xiquerypointer.c +++ b/test/xi2/protocol-xiquerypointer.c @@ -190,7 +190,7 @@ test_XIQueryPointer(void) } int -main(int argc, char **argv) +protocol_xiquerypointer_test(void) { init_simple(); diff --git a/test/xi2/protocol-xiqueryversion.c b/test/xi2/protocol-xiqueryversion.c index efee156c4..3ce758faa 100644 --- a/test/xi2/protocol-xiqueryversion.c +++ b/test/xi2/protocol-xiqueryversion.c @@ -288,7 +288,7 @@ test_XIQueryVersion_multiple(void) } int -main(int argc, char **argv) +protocol_xiqueryversion_test(void) { init_simple(); diff --git a/test/xi2/protocol-xiselectevents.c b/test/xi2/protocol-xiselectevents.c index 575a06611..686e7d394 100644 --- a/test/xi2/protocol-xiselectevents.c +++ b/test/xi2/protocol-xiselectevents.c @@ -65,9 +65,16 @@ 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(); diff --git a/test/xi2/protocol-xisetclientpointer.c b/test/xi2/protocol-xisetclientpointer.c index bd6267d59..6584bb9cc 100644 --- a/test/xi2/protocol-xisetclientpointer.c +++ b/test/xi2/protocol-xisetclientpointer.c @@ -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); diff --git a/test/xi2/protocol-xiwarppointer.c b/test/xi2/protocol-xiwarppointer.c index 8483aacd4..8484d54e5 100644 --- a/test/xi2/protocol-xiwarppointer.c +++ b/test/xi2/protocol-xiwarppointer.c @@ -186,7 +186,7 @@ test_XIWarpPointer(void) } int -main(int argc, char **argv) +protocol_xiwarppointer_test(void) { init_simple(); screen.SetCursorPosition = ScreenSetCursorPosition; diff --git a/test/xi2/tests.c b/test/xi2/tests.c new file mode 100644 index 000000000..559fb23ed --- /dev/null +++ b/test/xi2/tests.c @@ -0,0 +1,21 @@ +#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; +} diff --git a/test/xi2/xi2.c b/test/xi2/xi2.c index 070d641af..6ed4c7f4f 100644 --- a/test/xi2/xi2.c +++ b/test/xi2/xi2.c @@ -137,7 +137,7 @@ xi2mask_test(void) } int -main(int argc, char **argv) +xi2_test(void) { xi2mask_test(); |