libinput/test
Peter Hutterer 84e6321f51 test: add a backtrace facility to litest
The check unit test framework isn't particularly suited to having ck_assert*
calls in helper functions. A failed assertion in a helper function or the
litest framework merely gives us a the failed line in litest.c.
which doesn't tell us which test actually failed.

Add a backtracing facility with litest_backtrace(). And since this requires
wrapping all ck_assert macros with litest_assert() this patch ended up
replacing/duplicating a bunch of ck_assert_* bits. So rather than
ck_assert_int_eq() we now use litest_assert_int_eq(), etc. in the litest
framework itself.

The int comparison macros are more type-safe than ck_assert()'s macros which
just cast all the ints to intmax_t.

Backtrace is spewed to stderr, which is good enough for debugging. Example
backtrace:

	FAILED COMPARISON: status != expected
	Resolved to: 0 != 0
	in disable_button_scrolling() (pointer.c:115)

	Backtrace:
	0: ./test/test-pointer (litest_fail_comparison_int+0xab) [0x40973b]
	1: ./test/test-pointer (disable_button_scrolling+0x174) [0x40421b]
	2: ./test/test-pointer (middlebutton_middleclick+0x40) [0x40829c]
	3: /lib64/libcheck.so.0 (srunner_run+0x7f5) [0x7f0e8a277025]
	4: ./test/test-pointer (litest_run+0x107) [0x40a42b]
	5: ./test/test-pointer (main+0x2fa) [0x4090e7]
	6: /lib64/libc.so.6 (__libc_start_main+0xf0) [0x7f0e88f5e790]
	7: ./test/test-pointer (_start+0x29) [0x403ce9]
	8: ? (?+0x29) [0x29]

litest_backtrace() itself is copied from xserver/os/backtrace.c which git
blame attributes to Marcin.

CC:  Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-18 20:55:48 +10:00
..
50-litest.conf test: Prefix litest created device names with litest 2014-06-25 11:11:45 +10:00
build-cxx.cc test: Add include from C++ build test 2014-03-29 00:51:44 +01:00
build-pedantic.c Fix a couple of coding style issues 2015-05-01 12:09:57 +10:00
device.c test: switch the abs ranged tests over to real ranged tests 2015-05-08 14:08:57 +10:00
keyboard.c test: add litest_is_keyboard_event() helper function 2015-05-07 16:17:50 +10:00
litest-alps-semi-mt.c cosmetic: more duplicate empty line removal 2015-03-02 16:48:51 +10:00
litest-atmel-hover.c touchpad: add support for per-finger hovering information 2015-05-07 14:40:53 +10:00
litest-bcm5974.c test: bcm5974: down should be marked as static 2015-05-06 15:08:22 +10:00
litest-generic-singletouch.c test: add a generic single-touch device 2014-08-26 13:49:16 +10:00
litest-int.h test: add per-device udev rule support 2015-02-03 10:34:26 +10:00
litest-keyboard-razer-blackwidow.c test: add the Razer BlackWidow keyboard device 2015-04-08 11:42:50 +02:00
litest-keyboard.c style fix: Remove duplicate empty lines 2014-07-22 09:00:45 +10:00
litest-logitech-trackball.c evdev: enable button scrolling by default on mice without wheels 2015-04-28 17:12:31 +10:00
litest-mouse-roccat.c test: add LITEST_KEYS to roccat mouse features 2015-04-27 09:45:08 +10:00
litest-mouse.c test: drop empty test device interfaces 2015-01-06 09:53:25 +10:00
litest-ms-surface-cover.c test: upgrade to the Microsoft Surface Type Cover 2015-04-28 07:45:39 +10:00
litest-protocol-a-touch-screen.c test: add protocol A touch screen tests 2015-03-02 12:45:47 +10:00
litest-qemu-usb-tablet.c test: add QEMU tablet as test device 2014-11-11 09:55:42 +10:00
litest-selftest.c test: add a backtrace facility to litest 2015-05-18 20:55:48 +10:00
litest-synaptics-hover.c test: add a semi-mt + hover synaptics touchpad 2015-01-16 07:42:50 +10:00
litest-synaptics-st.c test: auto-update for BTN_TOOL_* when using litest_touch_ functions 2014-07-23 15:08:15 +10:00
litest-synaptics-t440.c test: auto-update for BTN_TOOL_* when using litest_touch_ functions 2014-07-23 15:08:15 +10:00
litest-synaptics-x1-carbon-3rd.c test: add per-device udev rule support 2015-02-03 10:34:26 +10:00
litest-synaptics.c test: auto-update for BTN_TOOL_* when using litest_touch_ functions 2014-07-23 15:08:15 +10:00
litest-trackpoint.c test: drop empty test device interfaces 2015-01-06 09:53:25 +10:00
litest-vmware-virtual-usb-mouse.c test: add VMWare Virtual USB Mouse device 2014-11-11 09:55:42 +10:00
litest-wacom-intuos-finger.c test: add a Wacom Intuos 5 Finger test device 2015-03-05 13:30:49 +10:00
litest-wacom-touch.c test: drop unused includes for libinput-util.h 2014-06-11 09:43:52 +10:00
litest-wheel-only.c test: add a scrollwheel-only device 2015-04-13 11:48:38 +02:00
litest-xen-virtual-pointer.c test: add Xen Virtual Pointer device 2014-11-11 09:55:42 +10:00
litest.c test: add a backtrace facility to litest 2015-05-18 20:55:48 +10:00
litest.h test: add a backtrace facility to litest 2015-05-18 20:55:48 +10:00
log.c Fix a couple of coding style issues 2015-05-01 12:09:57 +10:00
Makefile.am test: add a backtrace facility to litest 2015-05-18 20:55:48 +10:00
misc.c Fix a couple of coding style issues 2015-05-01 12:09:57 +10:00
path.c cosmetic: more duplicate empty line removal 2015-03-02 16:48:51 +10:00
pointer.c test: cast to int before integer comparison 2015-05-18 20:55:48 +10:00
symbols-leak-test.in add simple symbols leak checker 2015-02-13 10:20:44 +10:00
touch.c test: add litest_is_touch_event() helper function 2015-05-07 14:41:00 +10:00
touchpad.c Merge branch 'tap-to-end-drag' 2015-05-18 14:12:12 +10:00
trackpoint.c Fix a couple of coding style issues 2015-05-01 12:09:57 +10:00
udev.c Add libinput_set_user_data 2014-12-23 14:49:39 +10:00
valgrind.suppressions test: add a backtrace facility to litest 2015-05-18 20:55:48 +10:00